Simulate card transactions
The quick start allows you to get cards running quickly
After you issued your first card in our test environment, you need to simulate transactions. This guide shows you how to do this.
Here you can find an explanation of the card transaction lifecycle. In this tutorial you will learn how to:
- Creating a test authorisation (always the first step)
- Capture a payment
- Reverse a payment
- Refund a payment
- Generate a test statement
These APIs only work in our test environment.
Create a test authorisation
You can create an authorisation like this:
curl https://api.test.yordex.com/cards/test/transactions
-H "Authorization:your-api-key"
-H "Content-type: application/json"
-X POST
-d '{
"cardId": ":card_id",
"amount": 1000,
"description": "description"
}'
Where the card_id is the id returned when creating the card.
The response will look like this:
{
"id": "<transaction Id>"
}
If you have set up a webhook, you will receive a notification.
Capture a payment
You can capture a payment like this:
curl https://api.test.yordex.com/cards/test/transactions/capture
-H "Authorization:your-api-key"
-H "Content-type: application/json"
-X POST
-d '{
"cardId": ":card id",
"id": ":transaction_id"
}'
Where the id was the transaction id returned when you created the authorisation.
Reverse a payment
You can reverse a payment like this:
curl https://api.test.yordex.com/cards/test/transactions/reverse
-H "Authorization:your-api-key"
-H "Content-type: application/json"
-X POST
-d '{
"cardId": ":card id",
"id": ":transaction_id"
}'
If you have set up a webhook, you will receive a notification.
Refund a payment
You can refund a payment like this:
curl https://api.test.yordex.com/cards/test/transactions/refund
-H "Authorization:your-api-key"
-H "Content-type: application/json"
-X POST
-d '{
"cardId": ":card id",
"id": ":transaction_id",
"amount": 500
}'
Generate a test statement
The generate the statement with captured transactions and up-to-date balance, please call the following API.
curl https://api.test.yordex.com/cards/test/statements
-H "Authorization:your-api-key"
-H "Content-type: application/json"
-X POST
-d '{
"accountId": ":account_id",
"fromDate":"2021-10-01"
}'
This API call is asynchronous. Please wait to get the statement.
Like the other APIs on this page, this API only works on tests. Here you can find how to get the full statement which you should also use on prod.
Updated over 1 year ago