skip to Main Content

With the oldest PayPal API, setting the return URL when a checkout is accomplishment, or when checkout is eliminated is easy, as described here:

Payment payment = new Payment();
RedirectUrls redirectUrls = new RedirectUrls();
redirectUrls.setCancelUrl(cancelUrl);
redirectUrls.setReturnUrl(successUrl);
payment.setRedirectUrls(redirectUrls);

How can I accomplished this goal with new PayPal API?
I have already setting an url return (google.com for testing) in my sandbox account but it seems not work..

2

Answers


  1. Which new API? There are several. Are you using the Checkout-Java-SDK? The best integrations do not use a redirect, and hence do not need a return URL.

    Instead, implement two routes on your server that return JSON data — one for ‘Create Order’ and one for ‘Capture Order’, documented here.

    The approval flow to pair those two routes with is: https://developer.paypal.com/demo/checkout/#/pattern/server

    This flow does not redirect away, hence there is no need or use for a return URL and if specified it will be ignored.

    I have already setting an url return (google.com for testing) in my sandbox account but it seems not work.

    That is for non-API integrations that use a link or HTML form post. There is no API integration that pays any attention to that profile setting.

    Login or Signup to reply.
  2. I know this is an old post now but with REST API, there is a way to return these URLs. If you go to https://developer.paypal.com/api/orders/v2/ and click the application_context object link, you would be able to see the other details you can add to pass into your payload — eg. brand_name, return_url, cancel_url etc. I do not think that Paypal has provided now an SDK but would love to know if there is. Right now, only the REST endpoints and payloads are available on their developer page.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search