1. Creating a crypto payment.
The merchant's website or app sends a request to the Processing Service to create a payment, which has the following form:
POST https://<HOSTNAME>/api/v1/payments/create
Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l
Idempotence-Key: ps_1614589640890_3134
Content-Type: application/json
{
"email": "[email protected]",
"shop_order_id": "208843-42-23-842",
"client_amount": "10",
"client_cryptocurrency": "USDT",
"client_amount_of_shipping": "1",
"callback_url": "https://website.com/api/change-status",
"description": "Order #208843-42-23-864",
"expires": "2023-02-22T00:00:00-00:00"
}
Fields description>
Field | Type | Required | Description |
---|---|---|---|
string | yes | buyer's email; used when refunds are necessary; | |
shop_order_id | string | no | shop order id |
client_amount | string | yes | total payment amount (currency is specified in the merchant's profile); |
client_cryptocurrency | string | yes | currency displayed for the client |
client_amount_of_shipping | string | no | amount of shipping. This field has an informational function. |
callback_url | string | no | URL address of callback API of the store to which the Processing Service will send a request when payment status is changed (when payment is executed) Attention! Keep in mind that if the site in which You are testing payments is not publicly accessible for requests from the Internet, then notifications of changes in the status of payments from Our processing service will not be able to reach Your online store, as a result of which the status of orders in your store will not change. |
description | string | no | if you need to add a description of the payment which the merchant wants to see in the personal account, you must pass the description parameter. Description must not exceed 128 characters. |
expires | string | no | the date when the payment expires in RFC3339 format. Default: 1 hour from the moment of sending; |
The processing service returns the created payment object:
{
"id": "3021c31c-fffb-40d0-995c-d301b33aab06",
"status": "pending",
"client_amount": "10",
"client_cryptocurrency": "USDT",
"client_amount_of_shipping": "1",
"description": "Order #208843-42-23-864",
"confirmation_token": "04a20cec-45b6-4402-b7c9-cad3d3efeb5e",
"confirmation_url": "https://website.com/api/change-status",
"created_at": "2022-11-24T19:21:22.611733+00:00",
"expires": "2023-02-22T00:00:00+00:00",
"receipt_code": "90496d33-b9f7-40bd-a7b1-846dfe719786",
"test": false
}
You'll need to get <confirmation_token>
variable for widget activation.
Fields description
Field | Type | Required | Description |
---|---|---|---|
id | string | yes | payment identifier |
status | string | yes | payment status. Value options: "pending"- pending payment; "awaiting_payment_confirmation" - the transaction was found in the mempool, its confirmation in the blockchain network is pending; "paid" - payment made; "cancelled" - the payment is cancelled by the seller; "expired" - payment time has expired; |
client_amount | string | yes | total amount of payment |
client_currency | string | yes | payment currency |
client_amount_of_shipping | string | yes | amount of shipping |
description | string | yes | payment description, maximum 128 characters |
confirmation_token | string | yes | payment token, that is necessary to initialize the widget |
confirmation_url | string | yes | URL address of callback API of the store to which the Processing Service will send a request when payment status is changed (when payment is executed) |
created_at | string | yes | payment creation date, RFC3339 format |
expires | string | yes | date when payment expires, RFC3339 format |
receipt_code | string | yes | check t |
test | boolean | yes | lag for test order for API debugging |