API Reference

Create Payment

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:

ParameterValueRequired
AuthorizationToken found from the Get Token ApiYES
Content-Typeapplication/jsonYES
Acceptapplication/jsonNO

Request Parameters

Include the following request parameters

ParameterTypeRequiredDescription
tran_idStringYESUnique transaction id (Max 32 characters)
amountNumberYESTransaction amount
methodStringNOMust 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_dataJSONNOOptional data. Must be in json format. You can pass your player information such as player uid and other info as json format here.
callback_urlStringYESValid URL to which VivaroPay will redirect customers after payment is successful or failed.
webhook_urlStringNOValid 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

ParameterTypeDescription
statusBooleanRequest status (True or False)
statusMessageStringMessage related to request
paymentURLStringPayment 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"
}