Checkout
Accept payments online on your website or app with ease.
Before you can start accepting crypto payments, you need to create a 100pay Account and obtain your API keys.
Using the Checkout SDK
The Checkout SDK is a JavaScript library that allows developers to securely accept both one-time purchases and subscription payments on their website or app.
You can add it to your project using a package manager like npm, pnpm, or yarn. You can also use it directly by including the script tag in your HTML file.
Install 100Pay SDK
Import the Library
Or use the global variable shop100Pay
if you included the script tag in your HTML file.
Using shop100Pay
The shop100Pay
function is the main entry point for integrating 100Pay's checkout process into your application. Here's how you can use it:
Example Usage
shop100Pay
Function Parameters
The shop100Pay
function takes two parameters: chargeData
and displayOptions
.
chargeData
Object
ref_id
: A unique identifier for the transaction, typically generated using a UUID.api_key
: Your 100Pay API key required to authenticate the transaction.billing
: An object containing billing information:amount
: The amount to be charged.currency
: The currency in which the payment will be made (e.g.,USD
).description
: A brief description of the payment.country
: The country of the customer (e.g.,US
).pricing_type
: The type of pricing, eitherfixed
orvariable
.
customer
: An object containing customer information:user_id
: A unique identifier for the customer.name
: The customer's name.email
: The customer's email address.phone
: The customer's phone number.
metadata
: An object for additional metadata (e.g.,order_id
,charge_ref
, etc.).call_back_url
: A URL to which the user will be redirected after the payment is completed.onClose
: A callback function that is triggered when the user closes the payment modal.callback
: A callback function that is triggered when the transaction is successful.onError
: A callback function that is triggered if there is an error during the payment process.onPayment
: A callback function that is triggered after the payment is completed, with the payment reference as its argument.
displayOptions
Object
maxWidth
: An optional parameter to specify the maximum width of the payment modal.maxHeight
: An optional parameter to specify the maximum height of the payment modal.
shop100Pay
Function Signature
ChargeData
Interface
amount
: The amount to be charged.currency
: The currency for the payment.description
: A brief description of the payment.country
: The customer's country.pricing_type
: The type of pricing (fixed
orvariable
).
user_id
: A unique identifier for the customer.name
: The customer's name.email
: The customer's email address.phone
: The customer's phone number.
order_id
, charge_ref
, etc.).