ngx-paypal
ngx-paypal copied to clipboard
onShippingChange.reject does not interrupt the flow - order completed
I am using largely your "create order on server" scenario with added onShippingChange callback. everything is working except when I need to reject order if shipping country does not match user country data on server - the order still goes to onApprove and onClientAuthorization and the order appears in the paypal Activity as a good order.
I expect the order flow to be interrupted at that point and user notified in the UI about the fact
onShippingChange: (data, actions) => {
console.log('onShippingChange - data: ', data);
this.http.post<boolean>(`${this.baseUrl}ppc/order/${this.order.id}/shipping`, data.shipping_address)
.toPromise()
.then((res) => {
if (res) {
console.log('onShippingChange - OK');
return actions.resolve();
}
else {
console.log('onShippingChange - FAIL');
this.showError = true;
return actions.reject();
}
})
.catch(error => {
console.error('Shipping change ERROR', error);
this.showError = true;
});
},
what am I doing wrong here?
Currently experiencing a similar issue. Customer is still able to make payment even after the action.reject() function is called.
I had to abandon using onShippingChange altogether.
Interesting, do you mind shedding some light on how you're currently handling shipping address changes? My current plan is to have an alert modal popup to inform the user whenever the country is not valid.
yeah thats what I wanted too.. but had to go without.. just write into your T&C that you can only use shipping addresses in certain countries and refund manually if they circumvent it.. i dont know of a better way.. but with reject not working it seems to me a bigger problem .. so i chose between two evils :)
Fair enough, possibly a bug on Paypal's end because I remember it working last year. In the meantime, I think I'll include the popup and also refund manually if they go ahead and circumvent it. Cheers.