Checkout
1. Create Session.
First you need to create a session from your backend using the API key generated through the dashboard, a session must have one of two types, add_card or payment.
Add Card
the add_card session is used to store a customer card, a unique customerId is required for add_card session type, while creating a new session, using this Id, you can get the corresponding customer cards when calling the getSession() method in the SDK
Request
curl --location --request POST 'https://sandbox.nearpay.io/checkout/sessions' \
--header 'Authorization: RoD43N1tjJs221nM37LR72Kf7IHG3uDYJAF4pu2HlrBkj9oxGdiUBO1sBGYN' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": "add_card",
"customer": {
"id": "${UUID}",
"name": "", // optional
"email": "", // optional
"mobile": "+966XXXXXXXXX" // optional
}
}'Response
Request
Response
2. Install SDK.
Install the payment SDK using either npm or yarn
3. PaymentSDK.
Using the SDK, you can use a previously created session to add cards, create payments and fetch previous payments as well.
Request:
Session Object:
Request:
Response
Last updated
