order
to your client session.
Creating a client session provides you with a client token, a temporary key used to initialize the Universal Checkout.
The information you include in the client session is used in the Dashboard:
X-Api-Key
header. Create an API key by visiting the developer page of the Primer Dashboard.
Make sure to set the following scopes for your API Key:
client_tokens:write
transactions:authorize
Field | Description |
---|---|
orderId | Your reference for the payment. _Make sure to keep track of orderId - you will later receive updates to the payment via Webhooks. The payment will contain the orderId specified in the client session. _ |
currencyCode | The three-letter currency code in ISO 4217 format. e.g. use USD for US dollars. |
order.lineItems | The details of the line items of the order. |
@primer-io/checkout-web
.This package includes TypeScript definitions.script
tag, please use our CDN instead.Primer
functions are called on the client side, or use our CDN instead.Primer.min.js
script and the Checkout.css
stylesheet on the page where you want to render the Checkout.
Make sure to pass the proper version in the URL.Primer.min.js
will add the Primer
object to the global scope:Primer.showUniversalCheckout(clientToken, options)
. Make sure to pass a selector to your container in the options.onCheckoutComplete
callback to be notified when the payment has been successfully completed. Use it to show an order confirmation screen.PAYMENT.STATUS
event.If you are not yet ready to receive webhooks, you can use https://webhook.site to test your implementation.onCheckoutFail
callback