Create Payment
Create a new payment request and get a checkout URL to redirect your customer.
Endpoint
HTTP
POST https://razcryptogateway.com/api/v2/payments/create
Request Headers
Headers
Content-Type: application/json
Accept: application/json
X-Public-Key-Id: rz_pub_your_public_key_here
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
amount | number | ✅ Yes | Payment amount (minimum 0.01) |
chain | string | No | BSC, ETH, POLYGON (default: BSC) |
currency | string | No | USDT, USDC, DAI (default: USDT) |
email | string | No | Customer email |
mobile | string | No | Customer mobile number |
callback_url | string | No | Your webhook URL |
custom_data | object | No | Any JSON data — echoed back in webhook |
return_json | string | No | Set "true" to force JSON response |
Code Examples
curl -X POST "https://razcryptogateway.com/api/v2/payments/create" \
-H "Content-Type: application/json" \
-H "X-Public-Key-Id: rz_pub_6d6c763aaa20498c773fb7f0fea8cf5b" \
-H "Accept: application/json" \
-d '{
"amount": 10.50,
"chain": "BSC",
"currency": "USDT",
"email": "[email protected]",
"mobile": "9876543210",
"callback_url": "https://yourstore.com/webhook",
"return_json": "true"
}'
const response = await fetch('https://razcryptogateway.com/api/v2/payments/create', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-Public-Key-Id': 'rz_pub_your_public_key_here'
},
body: JSON.stringify({
amount: 10.50,
chain: 'BSC',
currency: 'USDT',
email: '[email protected]',
callback_url: 'https://yourstore.com/webhook',
return_json: 'true'
})
});
const data = await response.json();
window.location.href = data.checkout_page;
<?php
$ch = curl_init('https://razcryptogateway.com/api/v2/payments/create');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Accept: application/json',
'X-Public-Key-Id: rz_pub_your_public_key_here'
],
CURLOPT_POSTFIELDS => json_encode([
'amount' => 10.50,
'chain' => 'BSC',
'currency' => 'USDT',
'email' => '[email protected]',
'callback_url' => 'https://yourstore.com/webhook',
'return_json' => 'true'
])
]);
$result = json_decode(curl_exec($ch), true);
header('Location: ' . $result['checkout_page']);
?>
import requests
response = requests.post(
'https://razcryptogateway.com/api/v2/payments/create',
headers={
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-Public-Key-Id': 'rz_pub_your_public_key_here'
},
json={
'amount': 10.50,
'chain': 'BSC',
'currency': 'USDT',
'email': '[email protected]',
'callback_url': 'https://yourstore.com/webhook',
'return_json': 'true'
}
)
data = response.json()
print('Checkout URL:', data['checkout_page'])
const RazCrypto = require('razcrypto-node');
const razcrypto = new RazCrypto("YOUR_GATEWAY_ID", "YOUR_SECRET_KEY");
async function createOrder() {
const payment = await razcrypto.payment.create({
amount: 10.50,
currency: 'USDT',
chain: 'BSC',
email: '[email protected]',
callback_url: 'https://yourwebsite.com/webhook',
custom_data: { order_id: 'ORD-12345' }
});
console.log("Checkout URL:", payment.checkout_page);
}
Response
JSON Response
{
"status": "success",
"payment_id": "payid_abc123def456",
"amount": 10.50000646,
"currency": "USDT",
"chain": "BSC",
"address": "0x1234567890abcdef...",
"checkout_page": "https://razcryptogateway.com/pay/checkout/payid_abc123def456",
"hosted_page": "https://razcryptogateway.com/pay/payid_abc123def456",
"qr_code": "https://razcryptogateway.com/qr/usdt.png?address=0x...&amount=10.50000646",
"expiry_minutes": 30,
"expires_at": "2024-01-15T11:00:00Z"
}
Randomized Amount: The system adds a small decimal (e.g. 10.50 → 10.50000646) for unique blockchain matching. Settlement is based on this final amount.