import requests
API_URL = "https://www.mcqhub.thetextualmentor.top/api/v1/payment/create"
HEADERS = {
"Accept": "application/json",
"X-Public-Key": "pk_live_YOUR_PUBLIC_KEY",
"X-Secret-Key": "sk_live_YOUR_SECRET_KEY"
}
payload = {
"merchant_order_id": "ORD-1001",
"amount": 500,
"customer_name": "Tanvir Ahmed",
"customer_phone": "01711223344",
"success_url": "https://yourwebsite.com/payment/success",
"cancel_url": "https://yourwebsite.com/payment/cancel",
"webhook_url": "https://yourwebsite.com/api/payment/webhook"
}
response = requests.post(API_URL, json=payload, headers=HEADERS, timeout=15)
data = response.json()
if response.status_code == 200 and data.get("status") == "success":
print("Redirect Customer to:", data["payment_url"])
else:
print("Error:", data.get("message"))
<?php
$payload = [
'merchant_order_id' => 'ORD-1001',
'amount' => 500,
'customer_name' => 'Tanvir Ahmed',
'customer_phone' => '01711223344',
'success_url' => 'https://yourwebsite.com/success.php',
'cancel_url' => 'https://yourwebsite.com/cancel.php',
'webhook_url' => 'https://yourwebsite.com/webhook.php',
];
$ch = curl_init('https://www.mcqhub.thetextualmentor.top/api/v1/payment/create');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: application/json',
'X-Public-Key: pk_live_YOUR_PUBLIC_KEY',
'X-Secret-Key: sk_live_YOUR_SECRET_KEY',
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
if (!empty($data['payment_url'])) {
header('Location: ' . $data['payment_url']);
exit;
}
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'Accept' => 'application/json',
'X-Public-Key' => config('services.payauto.public_key'),
'X-Secret-Key' => config('services.payauto.secret_key'),
])->post('https://www.mcqhub.thetextualmentor.top/api/v1/payment/create', [
'merchant_order_id' => 'ORD-1001',
'amount' => 500,
'customer_name' => 'Tanvir Ahmed',
'customer_phone' => '01711223344',
'success_url' => route('payauto.success'),
'cancel_url' => route('payauto.cancel'),
'webhook_url' => route('payauto.webhook'),
]);
$data = $response->json();
if ($response->successful() && !empty($data['payment_url'])) {
return redirect()->away($data['payment_url']);
}
const axios = require('axios');
async function initiatePayment() {
const { data } = await axios.post('https://www.mcqhub.thetextualmentor.top/api/v1/payment/create', {
merchant_order_id: 'ORD-1001',
amount: 500,
customer_name: 'Tanvir Ahmed',
customer_phone: '01711223344',
success_url: 'https://yourwebsite.com/success',
webhook_url: 'https://yourwebsite.com/webhook'
}, {
headers: {
'Accept': 'application/json',
'X-Public-Key': 'pk_live_YOUR_PUBLIC_KEY',
'X-Secret-Key': 'sk_live_YOUR_SECRET_KEY'
}
});
return data.payment_url;
}