What is the API Flow for a Product Button Checkout
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am working on the PayPal REST API with the latest JavaScript SDK and started with a set of PayPal buttons on the product page, but can't understand how to add a set of Shipping Method options to an existing order via the PATCH request, what is the flow...
The new customer lands on the product and clicks the Pay By Card PayPal button and here we go...
- Create a new order (We know nothing about this customer other than he wants to buy Product X)
- Customer fills in shipping info on the PayPal guest checkout with a shipping address and clicks continue triggering the onShippingChange: function.
- Now we know the customers address location our App generates some available shipping rates JSON...
And here is where I can't find any docs to get those rates to the existing order via a PATCH request so that the customer can pick a shipping method.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good day @MattKennedy,
Thank you for posting to the PayPal community.
Update/Patch Order API : https://developer.paypal.com/docs/api/orders/v2/#orders_patch.
Note : The shipping callback is a method passed in the paypal.Buttons function to receive and handle changes the buyer has made to their shipping information. If you have passed any shipping.options to actions.order.create(), then whenever a new option is selected, the shipping callback, onShippingChange is called. You can access the selected options in the data parameter passed as follows:
Please refer the below detailed guide link :
Sincerely,
Chiranjeevi
PayPal/Braintree MTS
If this post or any other was helpful, please enrich the community by giving kudos or accepting it as a solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Looking at this, all shipping options need to be passed on create order, but we can't do that because don't know the buyers delivery location yet, so we can't just offer all shipping methods.
Lets just pretend that we have live shipping rates based on shoppers delivery location, so passing shipping methods on initial orderCreate is not feasible.
Is it best to get the users shipping address, triggering the onShippingChange then, create a new order on PayPal, this new order contains the users shipping address and relevant shipping options based on the delivery location?

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- "System error. Please try again later" when connecting to paypal sandbox account with my android app in Sandbox Environment
- How to enable on-demand / recurring payments to existing PayPal checkout? in SDKs
- PayPal Pay buttons a mysterious process in PayPal Payments Standard
- permission_denied response in call to patch order when paying by Card in Braintree Client-side Integration (JS, iOS, Android SDKs)
- Sandbox isnt working in REST APIs