This method allows you to integrate with the PayerURL Payment Gateway using a simple PHP function. It's designed for systems where server-to-server communication is preferred over frontend SDKs.
| Name | Type | Required | Description |
|---|---|---|---|
| $invoiceId | string | ✅ | Unique invoice or order ID. |
| $amount | int | ✅ | Payment amount (in smallest currency unit, e.g., cents). |
| $currency | string | ❌ | Currency code (e.g., usd, bdt). Default: usd. |
| $data | array | ✅ | Contains customer info, redirect URLs, and API credentials. |
$data = [
'first_name' => 'John', // Optional
'last_name' => 'Doe', // Optional
'email' => 'john@example.com', // Optional
'redirect_url' => 'https://yourdomain.com/payment-success',
'notify_url' => 'https://yourdomain.com/api/payment-notify',
'cancel_url' => 'https://yourdomain.com/checkout',
'public_key' => 'your_public_key',
'secret_key' => 'your_secret_key',
];Get your API key : https://dash.payerurl.com/profile/get-api-credentials

- Collect user and order info on your platform.
- Call the payment() function with required details.
- User is redirected to PayerURL payment page.
- After payment:
- User is redirected to redirect_url.
- Your backend receives a callback at notify_url with transaction details.
- On cancellation, user is returned to cancel_url.
Authentication is done via HMAC SHA256 signature using your secret key. The request is then base64-encoded and added as a Bearer token.
require_once 'PayerUrlRequest.php';
$request = new PayerUrlRequest();
$invoiceId = 'INV-1001';
$amount = 1000; // $10.00
$currency = 'usd';
$data = [
'first_name' => 'Alice',
'last_name' => 'Smith',
'email' => 'alice@example.com',
'redirect_url' => 'https://yoursite.com/payment-success',
'notify_url' => 'https://yoursite.com/api/payment-notify',
'cancel_url' => 'https://yoursite.com/cart',
'public_key' => 'pk_live_xxxxxx',
'secret_key' => 'sk_live_xxxxxx',
];
$request->payment($invoiceId, $amount, $currency, $data);