When is the onError function called?
thierryler
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Mar-15-2022
11:41 AM
Hello. Using the standard integration, I cannot figure out when the onError function is supposed to be called. Can someone give an example?
Here is my code:
<script src="https://www.paypal.com/sdk/js?client-id={{ ppClientId }}¤cy=EUR"></script>
<script>
showSpinner();
paypal.Buttons({
style: {
shape: 'pill',
},
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
currency_code: "EUR",
value: "{{ price }}",
},
invoice_id: "{{ invoice.ppInvoiceId }}",
custom_id: "{{ invoice.ppCustomId }}",
}],
{# application_context: {
shipping_preference: "SET_PROVIDED_ADDRESS",
}, #}
payer: {
email_address: "{{ email }}",
name: {
given_name: "{{ firstname }}",
surname: "{{ lastname }}",
},
{# phone: {
phone_number: "{{ phone }}"
}, #}
address: {
address_line_1: "{{ streetAddress1 }}",
address_line_2: "{{ streetAddress2 }}",
postal_code: "{{ postalCode }}",
country_code: "{{ countryCode | upper}}",
admin_area_2: "{{ city | upper}}",
}
}
});
},
onApprove: function(data, actions) {
console.log('ICE ::: onApprove ::: data: ', data)
showSpinner();
...
},
onCancel: function (data) {
// console.log('ICE ::: onCancel ::: data: ', data)
hideSpinner();
},
onError: function (err) {
console.log('ICE ::: onError ::: data: ', err)
hideSpinner();
},
onClick: function() {
console.log('ICE ::: onClick')
},
onInit: function(data, actions) {
console.log('ICE ::: onInit ::: data: ', data)
hideSpinner();
}
}).render('#paypal-button-container');
</script>
whatever I do, it never goes into onError...
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
- permission_denied response in call to patch order when paying by Card in Braintree Client-side Integration (JS, iOS, Android SDKs)
- Braintree PayPal Docusign No Work Help No Work Need Other Option in Braintree Client-side Integration (JS, iOS, Android SDKs)
- Change the button from Sandbox to Production in REST APIs
- Woocommerce order meta data does not contain Paypal fees when order status goes to processing. in REST APIs
- Advance integration form field processing in REST APIs