This documentation explains the authentication mechanism used in auth.php
, located at:
api/v1/utils/auth.php
To verify and authorize API access using merchant credentials, domain validation, and IP whitelisting.
Header Name | Description | Required |
---|---|---|
API-USERNAME | Your unique API username | โ |
API-PASSWORD | Your API password | โ |
API-APP-KEY | Application key for the integration | โ |
API-SECRET-KEY | Secret key to authenticate the request | โ |
merchant_id
.active_domain
, whitelist_ip
, and status
.401 Unauthorized
curl -X POST https://pickbo.com/api/v1/initiate-payment.php \
-H "API-USERNAME: merchant_user" \
-H "API-PASSWORD: merchant_pass" \
-H "API-APP-KEY: app_123" \
-H "API-SECRET-KEY: secret_456" \
-d '{ "amount": 100, "callback_url": "https://merchant.com/callback" }'
{
"status": "error",
"message": "Unauthorized IP address."
}
function normalizeDomain($domain) {
if (!$domain) return null;
$domain = strtolower(trim($domain));
$domain = preg_replace('/^www\./', '', $domain);
$domain = preg_replace('/^https?:\/\//', '', $domain);
$domain = rtrim($domain, '/');
return $domain;
}
function unauthorized($message) {
http_response_code(401);
echo json_encode([
"status" => "error",
"message" => $message
]);
exit;
}
active_domain
and whitelist_ip
are properly set.POST https://pickbo.com/api/v1/initiate-payment.php
Header Name | Type | Required | Description |
---|---|---|---|
API-USERNAME | string | โ | Your assigned API Username |
API-KEY | string | โ | Your assigned API Key (secret) |
Content-Type | string | โ | Must be application/json |
Required Fields:
Field | Type | Description |
---|---|---|
amount | float | Total payment amount |
currency | string | Currency code (e.g., BDT) |
customer_name | string | Customer's name |
customer_email | string | Customer's email |
customer_mobile | string | Customer's mobile number |
callback_url | string | Your callback URL (must be HTTPS) |
{
"amount": 250.00,
"currency": "BDT",
"customer_name": "Tanvir Ahmed",
"customer_email": "tanvir@example.com",
"customer_mobile": "01712345678",
"callback_url": "https://yourdomain.com/checkout/callback"
}
{
"status": "success",
"message": "Payment initiated successfully.",
"payment_id": "123",
"invoice_id": "INV-1722946334128",
"redirect_url": "https://payment.pickbo.com/checkout/INV-1722946334128"
}
{
"status": "error",
"message": "API-USERNAME header missing."
}
Pickbo will redirect to your callback_url
with invoice
, status
, and paymentID
as query parameters.
POST https://pickbo.com/api/v1/execute-payment.php
Send API-USERNAME
and API-KEY
in the headers.
Field | Type | Description |
---|---|---|
invoice_id | string | Invoice ID from Pickbo |
payment_id | string | Payment ID from gateway |
status | string | One of: success, failed, cancel |
// payment-status.php
$status = $_GET['status'] ?? 'unknown';
$invoice = $_GET['invoice'] ?? '';
$payment_id = $_GET['paymentID'] ?? '';
if ($status === 'success') {
echo "โ
Payment Successful! Invoice: $invoice";
} else {
echo "โ Payment Failed or Cancelled. Invoice: $invoice";
}