Backend Integration
Create payments server-side for maximum security. Secret keys never leave your server.
Flow
- Customer clicks Pay on your site
- Your backend calls RazCrypto API with secret key
- You receive
checkout_pageURL - You redirect customer to checkout_page
- Customer pays → webhook fires to your server
Backend Examples
<?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',
'X-Gateway-Id: ' . getenv('RAZ_PUBLIC_KEY'),
'X-Secret-Key: ' . getenv('RAZ_SECRET_KEY')
],
CURLOPT_POSTFIELDS => json_encode([
'amount' => 10.50,
'chain' => 'BSC',
'currency' => 'USDT',
'email' => $customerEmail,
'callback_url' => 'https://yoursite.com/webhook',
'custom_data' => ['order_id' => $orderId]
])
]);
$result = json_decode(curl_exec($ch), true);
header('Location: ' . $result['checkout_page']);
?>
<?php
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-Gateway-Id' => config('services.razcrypto.public_key'),
'X-Secret-Key' => config('services.razcrypto.secret_key'),
])->post('https://razcryptogateway.com/api/v2/payments/create', [
'amount' => 10.50,
'chain' => 'BSC',
'currency' => 'USDT',
'email' => $request->email,
'callback_url' => route('webhook.razcrypto'),
'custom_data' => ['order_id' => $order->id],
]);
return redirect($response->json('checkout_page'));
?>
const axios = require('axios');
app.post('/api/create-payment', async (req, res) => {
const response = await axios.post(
'https://razcryptogateway.com/api/v2/payments/create',
{
amount: req.body.amount,
chain: 'BSC',
currency: 'USDT',
email: req.body.email,
callback_url: 'https://yoursite.com/webhook',
custom_data: { order_id: req.body.orderId }
},
{
headers: {
'X-Gateway-Id': process.env.RAZ_PUBLIC_KEY,
'X-Secret-Key': process.env.RAZ_SECRET_KEY
}
}
);
res.json({ checkout_page: response.data.checkout_page });
});
import requests, os
def create_payment(amount, email, order_id):
response = requests.post(
'https://razcryptogateway.com/api/v2/payments/create',
headers={
'X-Gateway-Id': os.getenv('RAZ_PUBLIC_KEY'),
'X-Secret-Key': os.getenv('RAZ_SECRET_KEY'),
'Content-Type': 'application/json'
},
json={
'amount': amount,
'chain': 'BSC',
'currency': 'USDT',
'email': email,
'callback_url': 'https://yoursite.com/webhook',
'custom_data': {'order_id': order_id}
}
)
return response.json()['checkout_page']