Quick Start
Your first payment in 5 minutes.
Step 1 - Get API Keys
- Register at dashboard.airpay.ru
- Go to Settings → API Keys
- Copy
sk_test_...(Sandbox secret key)
warning
Never expose your secret key (sk_) on the frontend. Use it on the server side only.
Step 2 - Create a Payment
- cURL
- PHP
- Python
- Node.js
curl -X POST https://sandbox.airpay.ru/v1/payments \
-H "Authorization: Bearer sk_test_YOUR_TEST_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 10000,
"currency": "RUB",
"capture": true,
"description": "Test payment",
"payment_method": {
"type": "token",
"token": "tok_test_visa_success"
}
}'
<?php
require_once 'vendor/autoload.php';
$client = new \AirPay\Client('sk_test_YOUR_TEST_KEY');
$payment = $client->payments->create([
'amount' => 10000,
'currency' => 'RUB',
'capture' => true,
'description' => 'Test payment',
'payment_method' => [
'type' => 'token',
'token' => 'tok_test_visa_success',
],
]);
echo $payment->id;
import airpay
client = airpay.Client(api_key="sk_test_YOUR_TEST_KEY")
payment = client.payments.create(
amount=10000,
currency="RUB",
capture=True,
description="Test payment",
payment_method={
"type": "token",
"token": "tok_test_visa_success",
},
)
print(payment.id)
const AirPay = require('@airpay/node');
const client = new AirPay('sk_test_YOUR_TEST_KEY');
const payment = await client.payments.create({
amount: 100_00,
currency: 'RUB',
capture: true,
description: 'Test payment',
payment_method: {
type: 'token',
token: 'tok_test_visa_success',
},
});
console.log(payment.id);
Step 3 - Check the Response
{
"id": "pay_3Kj8mN2pLq7rT",
"object": "payment",
"status": "SUCCEEDED",
"amount": 10000,
"currency": "RUB",
"created_at": "2024-11-15T10:23:45Z"
}
The SUCCEEDED status means the payment was processed successfully.
Step 4 - Set Up a Webhook (recommended)
Don't rely solely on the API response - configure a Webhook to receive notifications about payment status changes.