I am working on an app with paypal payments. I have chosen to the the WebCheckoutClient as I spent too long trying to get the NativePaymentsClient to work. It all appears to be fine and I return to my app using deep links to display a button saying confirm. When I click on confirm I send a post request to api-m-sandbox.paypal.com/v2/checkout/orders/[ORDER-ID]/capture paypal will make the payment and it appears on my sandbox account balances. However I never get a call to "onPayPalWebSuccess". If I press back on the app the screen returns to the browser screen showing the spinning wheel and the message "One more Step" Finish Paying at ??? Store.
If I press back again as I am trying to exit the app the listener is triggered for onPayPalWebCancelled, which clearly it hasn't been as the payment has gone through.
The code is pretty much from the PayPal website but am I missing something.
There are only three http POSTS to paypal,
token, order, capture.
Am I missing something. Ideally I would like some sort of example to compare my code to or even a PAYPAL payments flowchart.
Help please as I'm wasting far too much time on this.
**** EDITED FOR ADDITIONAL INFORMATION ****
Am I correct in thinking that I only have to make 2 api calls.
Activity 1 will show a general button to express wish to make a payment.
OnClick of that button will send an order REST API call and store the returned order number. I then show a PAYPAL button to get allow the user to make the payment with PAYPAL. OnClick of this button will start the PayPalWebCheckoutClient which guides the user through the login process and asks them to "Continue to Review Order"
Clicking on this will then return using the deep link into a new Activity which will then ask the user to definately confirm the payment. On click of this I then send the /capture REST API which makes the payment in PayPal. On success it will return to the screen. If I then press the back button I get back into the PayPal browser that was opened by PayPalWebCheckoutClient (Inside my app) and I see a screen saying
"One more step"
Finish paying at test store"
Surely there must be a way of telling the PayPalWebClient that the order is now complete? This should move that browser on to show onPayPalWebSuccess. If I press the back key at this stage I get onPayPalWebCanceled even though the payment has been made.
Hope this extra helps as I'm almost there, just need this last step.
Thanks