ngx-paypal icon indicating copy to clipboard operation
ngx-paypal copied to clipboard

onShippingChange.reject does not interrupt the flow - order completed

Open maxima120 opened this issue 4 years ago • 5 comments

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?

maxima120 avatar Feb 20 '21 12:02 maxima120

Currently experiencing a similar issue. Customer is still able to make payment even after the action.reject() function is called.

nokoh avatar Apr 02 '21 08:04 nokoh

I had to abandon using onShippingChange altogether.

maxima120 avatar Apr 02 '21 09:04 maxima120

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.

nokoh avatar Apr 02 '21 13:04 nokoh

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 :)

maxima120 avatar Apr 02 '21 13:04 maxima120

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.

nokoh avatar Apr 02 '21 15:04 nokoh