This API will receive a payment creation request with necessary information.
Through this API, a payment creation request is received by VivaroPay.
Endpoint
{base_url}/create
{base_url} is the api endpoint (sandbox or live).
Request Headers
Include the following request headers:
Parameter | Value | Required |
---|---|---|
Authorization | Token found from the Get Token Api | YES |
Content-Type | application/json | YES |
Accept | application/json | NO |
Request Parameters
Include the following request parameters
Parameter | Type | Required | Description |
---|---|---|---|
tran_id | String | YES | Unique transaction id (Max 32 characters) |
amount | Number | YES | Transaction amount |
method | String | NO | Must be one of bkash-p2p | bkash-p2c | nagad-p2p | nagad-p2c | rocket-p2p | upay-p2p. If it is specified then gateway will redirect the customer to the specified payment method instead of showing available payment options. |
meta_data | JSON | NO | Optional data. Must be in json format. You can pass your player information such as player uid and other info as json format here. |
callback_url | String | YES | Valid URL to which VivaroPay will redirect customers after payment is successful or failed. |
webhook_url | String | NO | Valid URL to which VivaroPay will send the payment information silently in post format. |
**Note : method parameter will work in live payment endpoint. It will not work in sandbox mode.**
Success Parameters
Parameter | Type | Description |
---|---|---|
status | Boolean | Request status (True or False) |
statusMessage | String | Message related to request |
paymentURL | String | Payment url |
Example Code
<?php
$curl = curl_init();
$reqData = [
"tran_id" => "547844SDDHSDSD",
"amount" => 500,
"meta_data" => json_encode([
"uniqueId" => 1,
"player_name" => 'Player Name',
"player_father_name" => 'Player Father Name',
]),
"callback_url" => "https://yourdomain.com/callback",
"webhook_url" => "https://yourdomain.com/webhook",
];
$headers = [
"Authorization: Bearer YOUR TOKEN",
'Content-Type: application/json'
];
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://vivaropay.live/api/v1.0.0-beta/payment/sandbox/create',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($reqData),
CURLOPT_HTTPHEADER => $headers,
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
curl --location 'https://vivaropay.pro/api/v1.0.0-beta/payment/sandbox/create' \
--header 'Authorization: Bearer Your Token' \
--header 'Content-Type: application/json' \
--data '{
"tran_id": "547844SDDHSDSD",
"amount": "500",
"callback_url": "https://yourdomain.com/callback",
"webhook_url": "https://yourdomain.com/webhook",
}'
Success Response
{
"status": true,
"statusMessage": "Payment url generated",
"paymentURL": "https://sandbox.vivaropay.live/0auclgaur8ezhfamzzixggoennmwzzsuv2z"
}