API reference

Initiate payment

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.

POST{{base_url}}/payment/create

Authenticate with the Bearer access token. Tokens expire after 600 seconds — request a fresh one per session rather than storing them.

Request body

amountstringrequiredThe amount to charge, as a string rounded to 2 decimal places — e.g. "100.00". Sending a number returns 400 · The amount must be a string.
currencystringrequiredISO-4217 alpha-3 currency code in upper case, e.g. "USD". Must be a currency enabled on your merchant account.
return_urlstringrequiredWhere the customer lands after a successful payment. QRPay appends the payment token so you can verify the payment.
cancel_urlstringoptionalWhere the customer lands if they cancel or the payment fails. Defaults to your return_url when omitted.

What you get back

  • token — the payment session id. Store it against your order; you’ll match it on the return redirect.
  • payment_url — the hosted checkout page. Redirect the customer here (HTTP 302 or window.location).
Sandbox first
  • Keys created in your merchant panel start in SANDBOX mode — no real money moves until you switch the key to PRODUCTION.
  • Use small amounts and your own account while testing.
Request PHP · Guzzle
<?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();
Response 200 OK
{
  "message": {
    "code": 200,
    "success": ["CREATED"]
  },
  "data": {
    "token": "2zMRmT3KeYT2BWMAyGhqEfuw4tOYOfGX...",
    "payment_url": "https://your-qrpay-domain.com/payment/checkout/2zMRmT3KeYT2..."
  },
  "type": "success"
}
Response 403 · invalid token
{
  "message": {
    "code": 403,
    "error": ["Requested with invalid token!"]
  },
  "data": [],
  "type": "error"
}