Documentation sections
Documentation/Recipes
Test mode
Sandbox shop: payments without the provider and outcome simulation
Test mode lets you verify your integration end to end - creating a payment, the payment page, and webhook delivery - without real money and without a bank involved. To use it, create a separate sandbox shop in the dashboard.
Test payments do not affect your balance or payouts, and you choose the outcome of each payment yourself with a button on the payment page. They are included in dashboard analytics, but the test portion of the numbers is marked with a separate warning - it is not real revenue.
Step 1. Create a test shop
In the dashboard, open the Shops section, click "Add shop" and select the "Test" tab. The shop is activated immediately, with no application or moderation - each user has one. Issue an API key on the "API keys" tab and save a Webhook URL on the Webhook tab, just like for a live shop. If you no longer need the test shop, delete it in its settings - you can then create a new one.
Step 2. Create a payment
The request is identical to a live one - only the key changes. The response is a regular payment object flagged with isTest: true; the example is abbreviated, the full field list is in the Payment object section.
curl https://tabpay.org/api/v1/payments \
-H "X-Api-Key: tp_test_shop_key" \
-H "Content-Type: application/json" \
-d '{
"amountKopecks": 19900,
"orderId": "test-1",
"description": "Integration check"
}'{
"id": "6b9d2c88-4f1a-4c0e-9b7d-2f8e5a1c3d90",
"orderId": "test-1",
"status": "CREATED",
"amountKopecks": 19900,
"isTest": true,
"payUrl": "https://tabpay.org/pay/6b9d2c88-4f1a-4c0e-9b7d-2f8e5a1c3d90"
}Step 3. Choose the outcome on the payment page
Open payUrl in a browser. Instead of the SBP and card options, the page shows three buttons:
- Pay - the payment moves to
SUCCESS. - Decline - the payment moves to
FAILED. - Expire - the payment moves to
EXPIRED.
The provider is not involved in test mode - no money moves. The full list of statuses is in Payment statuses.
Step 4. Receive the webhook
For any of the three outcomes, TabPay sends a webhook to the shop's URL. The body is identical to a live one but contains test: true - your live handler can use it to tell a simulation apart:
{
"id": "6b9d2c88-4f1a-4c0e-9b7d-2f8e5a1c3d90",
"orderId": "test-1",
"status": "SUCCESS",
"amountKopecks": 19900,
"telegramId": null,
"metadata": null,
"test": true
}The signatures are computed with the same algorithms as in live mode: X-Signature and the recommended X-Signature-V2 with the X-Timestamp header (see Signature verification), so test mode lets you verify them as well.
Things to keep in mind
- An outcome is applied only once - after moving to a final status the payment is closed, and repeating any outcome returns an error.
- To accept live payments, create a regular shop: it goes through moderation, and its payments are sent to the provider.