API Reference
Initiate Payment
Create a payment and get a checkout link. Send your customer to the payment_url to complete the payment.
POST
__BASE_URL__/payment/create
Headers
Authorization
string
Required
Bearer token from the Access Token endpoint.
Example:
Bearer YOUR_ACCESS_TOKENBody Parameters
amount
decimal
Required
Your Amount , Must be rounded at 2 precision.
Example:
100.00currency
string
Required
Currency Code, Must be in Upper Case (Alpha-3 code)
Example:
USDreturn_url
url
Required
Enter your return or success URL
Example:
https://example.com/successcancel_url
url
Required
Enter your cancel or failed URL
Example:
https://example.com/cancelcustom
string
Optional
Transaction id which can be used your project transaction
Example:
ORDER-123456789Payment flow
- Create the payment with this endpoint.
- Redirect your customer to
data.payment_url. - The customer logs in and confirms the payment.
- The customer is sent back to your return_url with the payment result. Read more
Store the returned token and your custom value with your order. You will use them to match the payment result.
Request
curl --request POST \
--url '__BASE_URL__/payment/create' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"amount": "100.00",
"currency": "USD",
"return_url": "https://example.com/success",
"cancel_url": "https://example.com/cancel",
"custom": "ORDER-123456789"
}'
POST __BASE_PATH__/payment/create HTTP/1.1
Host: __HOST__
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json
{
"amount": "100.00",
"currency": "USD",
"return_url": "https://example.com/success",
"cancel_url": "https://example.com/cancel",
"custom": "ORDER-123456789"
}
<?php
$payload = [
'amount' => '100.00',
'currency' => 'USD',
'return_url' => 'https://example.com/success',
'cancel_url' => 'https://example.com/cancel',
'custom' => 'ORDER-123456789',
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => '__BASE_URL__/payment/create',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_ACCESS_TOKEN',
'Accept: application/json',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
$result = json_decode($response, true);
print_r($result);
<?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/success',
'cancel_url' => 'https://example.com/cancel',
'custom' => 'ORDER-123456789',
],
'headers' => [
'Authorization' => 'Bearer YOUR_ACCESS_TOKEN',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
]);
echo $response->getBody();
use Illuminate\Support\Facades\Http;
$response = Http::acceptJson()
->withToken('YOUR_ACCESS_TOKEN')
->post('__BASE_URL__/payment/create', [
'amount' => '100.00',
'currency' => 'USD',
'return_url' => 'https://example.com/success',
'cancel_url' => 'https://example.com/cancel',
'custom' => 'ORDER-123456789',
]);
if ($response->successful()) {
$data = $response->json('data');
} else {
$errors = $response->json('message.error');
}
const response = await fetch('__BASE_URL__/payment/create', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"amount": "100.00",
"currency": "USD",
"return_url": "https://example.com/success",
"cancel_url": "https://example.com/cancel",
"custom": "ORDER-123456789"
}),
});
const result = await response.json();
console.log(result);
import requests
payload = {
"amount": "100.00",
"currency": "USD",
"return_url": "https://example.com/success",
"cancel_url": "https://example.com/cancel",
"custom": "ORDER-123456789",
}
headers = {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Accept": "application/json",
"Content-Type": "application/json",
}
response = requests.request("POST", "__BASE_URL__/payment/create", json=payload, headers=headers)
print(response.json())
Response
Payment created
{
"message": {
"code": 200,
"success": [
"CREATED"
]
},
"data": {
"token": "2zMRmT3KeYT2BWMAyGhqEfuw4tOYOfGXKeyKqehZ8mF1E35hMwE69gPpyo3e",
"payment_url": "https://orvixpaybd.com/pay/sandbox/v1/user/authentication/form/2zMRmT3KeYT2BWMAyGhqEfuw4tOYOfGXKeyKqehZ8mF1E35hMwE69gPpyo3e"
},
"type": "success"
}
Validation failed
{
"message": {
"code": 400,
"error": [
"The return url field must be a valid URL."
]
},
"data": [],
"type": "error"
}
Access token expired
{
"message": {
"code": 401,
"error": [
"Request token is expired"
]
},
"data": [],
"type": "error"
}
Missing or invalid access token
{
"message": {
"code": 403,
"error": [
"Requested with invalid token!"
]
},
"data": [],
"type": "error"
}