Creates a payment session and returns a hosted payment_url. Redirect your customer there — QRPay renders the checkout, collects the payment and sends the customer back to your return_url when it’s done.
Authenticate with the Bearer access token. Tokens expire after 600 seconds — request a fresh one per session rather than storing them.
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST',
'{{base_url}}/payment/create', [
'json' => [
'amount' => '100.00',
'currency' => 'USD',
'return_url' => 'https://example.com/order/done',
'cancel_url' => 'https://example.com/order/cancel',
],
'headers' => [
'Authorization' => 'Bearer {{access_token}}',
'accept' => 'application/json',
'content-type' => 'application/json',
],
]);
echo $response->getBody();{
"message": {
"code": 200,
"success": ["CREATED"]
},
"data": {
"token": "2zMRmT3KeYT2BWMAyGhqEfuw4tOYOfGX...",
"payment_url": "https://your-qrpay-domain.com/payment/checkout/2zMRmT3KeYT2..."
},
"type": "success"
}{
"message": {
"code": 403,
"error": ["Requested with invalid token!"]
},
"data": [],
"type": "error"
}