๐Ecommerce Widget
Integrate PurplePay widget to your Ecommerce website.
This guide will take you through the process of integrating PurplePay checkout page to your ecommerce website and start accepting crypto payments instantly.
Ecommerce Widget Integration
Create an API key, here.
In case of a SPA,
Paste the HTML code in the
public/index.html
or_documents.tsx
or directly in the file where you want to make the checkout.Itโs important that you donโt change the
id
of the div. **NOTE: Remember to switch 'YOUR_API_KEY' here with the generated key.To load the widget script, you'd have to load the script tag of your checkout page.
Upon document load, the widget is initialised automatically.
The payment sessions are created with the method
window.createPaymentSession
which take in arguments:orderID
The order id of the cart.
orderAmount
The amount to be paid in USD.
chainId
Chain in which payment is to be done.
successCallback
Callback to be called once payment is successful.
You have to call this method with the correct arguments to initiate a checkout session.
Once the payment is done, using the successCallback, you can perform actions in your app.
Last updated