Paypal Payments Standard Javascript Documentation

dimedaughter
Contributor
Contributor

Does anyone have any documentation for the Payments Standard JS SDK?

 

The documentation on the site only refers to extremely basic functions like changing the currency.

 

I want to itemise the purchase units, handle VAT and enable/disable the button based on stock levels for product variants but there doesn't appear to be any information on how to do this

 

The API reference only refers to the Rest API (and has next to no code examples) but seems to suggest that this is possible.

Login to Me Too
5 REPLIES 5

MTS_Chiranjeevi
Moderator
Moderator

Hi @dimedaughter,

 

Thank you for contacting PayPal community.

 

We apologize for any inconvenience.

 

I request to please refer the Smart Payment Buttons, which use the PayPal JavaScript SDK.

 

Sincerely,

Chiranjeevi

PayPal, Inc.

 

If this post or any other was helpful, please enrich the community by giving kudos or accepting it as a solution.
Login to Me Too

dimedaughter
Contributor
Contributor

As I said in my original post, this doesn't answer any of my questions.

Login to Me Too

lunardigital
Contributor
Contributor

Did you find a place with the documentation? Also struggling here.

Login to Me Too

dimedaughter
Contributor
Contributor

Short answer: there isn't any.

 

There's an issue tracking it in Paypal's github but the entirety of their response after 8 months has been "lol sorry".

 

You just have to kinda guess at what the code should be by using the REST API documentation.

 

Also, if you're using webhooks: "CHECKOUT.ORDER.APPROVED" doesn't always mean that payment was successful, but "PAYMENT.CAPTURE.COMPLETED" doesn't contain the items in the order so you may need to use both.

 

Unfortunately ['resource']['id'] is different for both of these. ['resource']['purchase_units'][0]['payments']['captures'][0]['id'] on "CHECKOUT.ORDER.APPROVED" matches ['resource']['id'] on "PAYMENT.CAPTURE.COMPLETED", but it doesn't always exist so I have no idea how PayPal expects people to actually align a successful order to a successful payment. There's no documentation on this either.

Login to Me Too

lunardigital
Contributor
Contributor

Incredible. Whelp, thanks anyway.

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.