- When the user returns the returnUrl endpoint, you make a call for the PaymentDetails API and check the status and proceed.
- To handle the corner case where the user might have paid but didn't return to your site, await the IPN message to proceed with your order shipment etc.,
- If the user cancels a payment they will be taken the cancelUrl endpoint and you can handle the flow accordingly
- In case of errors (like limit exceeded, currency not supported etc.,) the Pay operation will actually throw an error and you will be able to handle this as part of the error / exception catch flow.
Please use the following parameters when making the API call
returnUrl The URL to which the sender’s browser is redirected after approving a payment on paypal.com
cancelUrl The URL to which the sender’s browser is redirected if the sender cancels the approval for a payment on paypal.com.
ipnNotificationUrl The URL to which all IPN messages for this payment are sent
Suggest downloading the SDK and look at the samples that are bundled as part of it.
https://www.x.com/developers/paypal/documentation-tools/paypal-sdk-index