Implementing Checkout API in Node.js

Greetings,

I have successfully implemented an older version of Checkout API, using CreateCheckout, in PHP. I am now updating the site to React and the latest version of the API, and am trying to figure out how to code this. Obviously, I would use the Node.js implementation, but I’m not sure beyond that point.

It sounds like I would convert my cart of items into JSON and make it part of a request to CreatePaymentLink. The response will include an HTTP link that one would navigate to in order to get to the payment page. The wording of the docs imply that this would be followed by the user, but I have to wonder if my code can automatically follow the link without the user’s intervention.

I’m not looking for anyone to write my code for me, but a more comprehensive view of the workflow would help me immensely.

Thanks!

Hi @DavidStowell , yes, the CreatePaymentLink is the right way to go. You can structure the request to automatically open the returned url in a new window, however you may run into popup blockers so I’d still show the user a link that they can click on.

The workflow would be:

  1. Create the checkout link via CreatePaymentLink
  2. Try to automatically open the returned url with something like window.open() or another function
  3. In case of popup blockers, display the url to the user so that they can navigate to the page manually

You can find more info on the checkout API here: Checkout API . We also provide a node SDK to facilitate the implementation: Node.js SDK