Hi, I need help with function in the client side
navehmevorach
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Mar-04-2020
02:54 AM
So I having trouble to redirect the customer to a new page after the process is done
this is my code so far and I will love to understand how i redirecting the client to a new page using a node server
Thanks!!
paypal
.Buttons({
style: {
color: 'blue',
},
onInit: function(data, actions) {
actionStatus = actions
actionStatus.disable()
},
onClick: function(data, actions) {
url = searchInput.value
const isURL = validURL(url)
if (isURL) {
// Remove Existing Error message
if (searchInput.nextElementSibling.classList[1]) {
searchInput.nextElementSibling.classList.remove('err-message--show')
}
// Calculate the price
const photoAmount = document.querySelector('.header__photos').value * 1
price = String(0.9 * photoAmount)
// Enable The Paypal Button
actionStatus.enable()
} else {
searchInput.nextElementSibling.classList.add('err-message--show')
}
},
enableStandardCardFields: true,
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [
{
amount: {
value: price,
currency_code: 'ILS'
}
}
]
})
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
alert('Transaction completed by ' + details.payer.name.given_name)
// Call your server to save the transaction
return axios.post('/paypal-transaction-complete', {
orderID: data.orderID,
})
})
},
onError: function(err) {
// Show an error page here, when an error occurs
console.log('error')
}
})
.render('#paypal-button-container')
Labels:
Login to Me Too
- Labels:
-
REST SDK
0 REPLIES 0
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- Change the button from Sandbox to Production in REST APIs
- When I do PayPal capture Order, I keep on getting Invalid Request Connection in REST APIs
- Error: "Unable to change shipping method. Please try again." in PayPal popup in REST APIs
- Simple Paypal button integration results in 404 error in Sandbox Environment
- Payment not automatically being captured, funds not transferred in Sandbox Environment