Online Store
Online store integration enables you to sell multiple products at their corresponding prices using a single payment form. You can also track how much each customer paid for products or the total amount paid for all products in your store.

Payment Form
Set up an Integration form and fill in the necessary details:
Your store address (for example,
mystore.com
)Coins that you accept for payment
Your receiving blockchain address
Your return URL. This is the address on your website to redirect customers after they complete the payment. More information on it is below.
Backend Integration
To build the checkout flow on your site, you will need to make two things happen from your server:
Create a payment session and redirect users by the URL you get from repaya API
Handle returning users after they complete the payment
1. Create a payment session
Perform a request to repaya's Rest API to create a payment session. Be sure to set IDs in the customer
and product
fields to the corresponding IDs in your own database to be able to verify them after the payment is complete. Use the checkoutUrl
field from the response to redirect your user.
Create a payment session to initiate the checkout flow
jAY7k
key_1432
Payment session created
POST /api/public/1/session HTTP/1.1
Host: repaya.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 194
{
"formLinkId": "jAY7k",
"customer": {
"id": "user_123141",
"data": "text"
},
"product": {
"id": "product_123141",
"name": "Awesome product",
"data": "text"
},
"price": {
"USD_MULTI_1": "15.0"
},
"clientId": "key_1432"
}
Payment session created
{
"checkoutUrl": "https://repaya.io/checkout/id_124124",
"id": "id_124124",
"formLinkId": "jAY7k",
"receiver": "0x0000000000000000000000000000000000000000",
"customer": {
"id": "user_123141"
},
"product": {
"id": "product_123141",
"name": "Awesome product"
},
"price": {
"USD_MULTI_1": "15.0"
},
"clientId": "key_1432"
}
2. Verify payment
When the payment is completed, the customer will be redirected to your website on the return URL you provided during the payment form setup. Verify the payment status at this step by requesting it via the API. The sessionId
for the request will be provided to you in the query parameter of the return URL.
Save the resulting payment in your DB if you want to enumerate all the customer payments later or use them another way.
Payment session ID
id_124124
A payment associated with a given session, null if missing
GET /api/public/1/payment HTTP/1.1
Host: repaya.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
A payment associated with a given session, null if missing
{
"id": "pid_3251",
"customer": {
"id": "user_123141",
"data": "text"
},
"product": {
"id": "product_123141",
"name": "Awesome product",
"data": "text"
},
"sender": "0x0000000000000000000000000000000000000000",
"receiver": "0x0000000000000000000000000000000000000000",
"amount": "15.0",
"paidAmount": "5.0",
"status": "pending",
"coin": {
"code": "USD_MULTI_1",
"name": "USD Stablecoins"
}
}
See also
Check out the full Rest API Reference and Client libraries section to find out more.
You can also find the complete working example for this flow on Github.
Last updated
Was this helpful?