For a basic connection to the service, you need to learn how to work with one type of request and handle postback.
The main request you need to get started is /api/v1/bill/create
Example request:
curl --location --request POST 'https://cardlink.link/api/v1/bill/create' \
--header 'Authorization: Bearer 123|q4uNcWNKMNZoSFSY1XTxp36nsM0kUMSu0otSA95' \
--form 'amount=16' \
--form 'order_id="Order 123"' \
--form 'description="Payment Description"' \
--form 'type="normal"' \
--form 'shop_id="G1vrEyX0LR"' \
--form 'currency_in="RUB"' \
--form 'custom="my_custom_data"' \
--form 'payer_pays_commission=1' \
--form 'name="Payment"'
Example response:
{
"success": "true",
"link_url": "https://cardlink.shop/en/link/3P1p2rgW7Y",
"link_page_url": "https://cardlink.shop/en/transfer/3P1p2rgW7Y",
"bill_id": "3P1p2rgW7Y
}
Next, you need to redirect the user to the link specified in "link_page_url". After payment, the user will be redirected to the page specified in Success/Fail URL depending on the payment status.
The user is redirected via a POST request of the following format:
{
"OutSum": "18.54",
"CurrencyIn": "RUB",
"InvId": "Order 123",
"custom": "my_custom_data",
"SignatureValue": "5A41374P24C99A2156D1D306C800B53C"
}
After redirecting to Success or Fail URL, the user should see a message with the payment status.
Since you can get the order_id back, and in the example above - this is the InvId field, you can immediately show a message like
Your order InvId has been successfully paid. Thank you for your payment!
or
Payment for order InvId failed. Please try again or contact support
You will also receive a Postback to the Result URL specified in the store settings. The data format is as follows:
{
"Status": "SUCCESS",
"InvId": "Order 123",
"Commission": "2.54",
"CurrencyIn": "RUB",
"OutSum": "18.54",
"TrsId": "3P1p2rgW7Y",
"custom": "my_custom_data",
"SignatureValue": "4A41373E24C99A2656D1D306C800B53C
}
Based on this Postback, you need to change the order status in your system.
Having received the SUCCESS status, you change the order status in your database to "PAID"
Having received the FAIL status, you accordingly change the order status in your system to "NOT PAID"
The above is enough to start accepting payments.