Skip to content
Please wait…

Welcome to BijoyPay Docs

Reference for API version 1.0

BijoyPay is a payment automation tool that lets you use your own personal or merchant account as a payment gateway, so you can accept payments from your customers through your website. This page explains how the gateway works and how to integrate the BijoyPay API into your website.

Before you start

You will need an API key, a secret key and a brand key. Create a brand in the merchant dashboard and open API credentials to find yours.

API introduction

The BijoyPay payment gateway lets merchants receive money from their customers by redirecting them to the gateway's hosted payment page. The gateway connects multiple payment terminals including card systems, mobile financial services and local or international wallets. Once the payment is complete the customer is returned to your site, and seconds later you receive a notification with the transaction details.

This document is intended for the technical personnel supporting an online merchant's website. A working knowledge of HTML forms or cURL is required. You will need test credentials, which you can request through contact.

API operation

REST APIs are supported in two environments. Use the sandbox environment for testing, then move to live for production. When testing, generate an order URL with your test credentials to call the sandbox URIs. When you are ready to go live, use the live credentials assigned to your signature key to generate a live order URL for the live URIs. Your server must support cURL. If you prefer submitting an HTML form, a POST-based URL is provided alongside each cURL example.

Create payment URL

POST https://pay.bijoypay.com/api/payment/create

Payment verify API

POST https://pay.bijoypay.com/api/payment/verify

Parameter details

Fields to POST when creating a payment

Field name Description Required Example values
cus_name Customer full name Yes John Doe
cus_email Email address of the customer Yes john@gmail.com
amount The total amount payable. Skip the trailing zeros when the amount is a natural number. Yes 10 or 10.50 or 10.6
success_url URL the customer is returned to when the payment succeeds. Return them to the last page of your site where you can confirm the payment. Yes https://yourdomain.com/success.php
cancel_url URL to return the customer to your product page or home page. Yes https://yourdomain.com/cancel.php
meta_data Pass any JSON-formatted data. No JSON formatted

Fields required for payment verification

Field name Description Required Example values
transaction_id Transaction id received as a query parameter on the success URL you provided when creating the payment. Yes OVKPXW165414

Header details

Header name Value
Content-Type application/json
API-KEY App key from API credentials
SECRET-KEY Secret key from API credentials
BRAND-KEY Brand key from Brands

Integration

You can integrate this payment gateway into a PHP, Laravel, WordPress or WooCommerce site. Pick the language closest to your stack — the request shape is the same in all of them.

Sample request


      <?php

      $curl = curl_init();

      curl_setopt_array($curl, array(
        CURLOPT_URL => 'https://pay.bijoypay.com/api/payment/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 =>'{"success_url":"yourdomain.com/success","cancel_url":"yourdomain.com/cancel","metadata":{"phone":"016****"},"amount":"10"}',
        CURLOPT_HTTPHEADER => array(
          'API-KEY: YourAPIKeyHere',
          'Content-Type: application/json',
          'SECRET-KEY: YourSecretKeyHere',
          'BRAND-KEY: YourBrandKeyHere'
        ),
      ));

      $response = curl_exec($curl);

      curl_close($curl);
      echo $response;

      ?>
      

      <?php
      $client = new Client();
      $headers = [
        'API-KEY' => 'YourAPIKeyHere',
        'Content-Type' => 'application/json',
        'SECRET-KEY' => 'YourSecretKeyHere',
        'BRAND-KEY' => 'YourBrandKeyHere'
      ];
      $body = '{
        "success_url": "yourdomain.com/success",
        "cancel_url": "yourdomain.com/cancel",
        "metadata": {
          "phone": "016****"
        },
        "amount": "10"
      }';
      $request = new Request('POST', 'https://pay.bijoypay.com/api/payment/create', $headers, $body);
      $res = $client->sendAsync($request)->wait();
      echo $res->getBody();
      ?>
      

      const axios = require('axios');
      let data = JSON.stringify({
        "success_url": "yourdomain.com/success",
        "cancel_url": "yourdomain.com/cancel",
        "metadata": {
          "phone": "016****"
        },
        "amount": "10"
      });

      let config = {
        method: 'post',
        maxBodyLength: Infinity,
        url: 'https://pay.bijoypay.com/api/payment/create',
        headers: { 
          'API-KEY': 'YourAPIKeyHere', 
          'Content-Type': 'application/json',
          'SECRET-KEY': 'YourSecretKeyHere',
          'BRAND-KEY': 'YourBrandKeyHere'
        },
        data : data
      };

      axios.request(config)
      .then((response) => {
        console.log(JSON.stringify(response.data));
      })
      .catch((error) => {
        console.log(error);
      });


      

      import requests
      import json

      url = "https://pay.bijoypay.com/api/payment/create"

      payload = json.dumps({
        "success_url": "yourdomain.com/success",
        "cancel_url": "yourdomain.com/cancel",
        "metadata": {
          "phone": "016****"
        },
        "amount": "10"
      })
      headers = {
        'API-KEY': 'YourAPIKeyHere',
        'Content-Type': 'application/json',
        'SECRET-KEY': 'YourSecretKeyHere',
        'BRAND-KEY': 'YourBrandKeyHere'
      }

      response = requests.request("POST", url, headers=headers, data=payload)

      print(response.text)
      

      package main

      import (
        "fmt"
        "strings"
        "net/http"
        "io/ioutil"
      )

      func main() {

        url := "https://pay.bijoypay.com/api/payment/create"
        method := "POST"

        payload := strings.NewReader(`{"success_url":"yourdomain.com/success","cancel_url":"yourdomain.com/cancel","metadata":{"phone":"01521412457"},"amount":"10"}`)

        client := &http.Client {
        }
        req, err := http.NewRequest(method, url, payload)

        if err != nil {
          fmt.Println(err)
          return
        }
        req.Header.Add("API-KEY", "YourAPIKeyHere")
        req.Header.Add("Content-Type", "application/json")
        req.Header.Add("SECRET-KEY", "YourSecretKeyHere")
        req.Header.Add("BRAND-KEY", "YourBrandKeyHere")

        res, err := client.Do(req)
        if err != nil {
          fmt.Println(err)
          return
        }
        defer res.Body.Close()

        body, err := ioutil.ReadAll(res.Body)
        if err != nil {
          fmt.Println(err)
          return
        }
        fmt.Println(string(body))
      }
      

Response Details

Field Name Type Description
Success Response
status bool TRUE
message String Message for Status
payment_url String Payment Link (where customers will complete their payment)
Error Response
status bool FALSE
message String Message associated with the error response
Completing Payment Page task you will be redirected to success or cancel page based on transaction status with the following Query Parameters: yourdomain.com/(success/cancel)?transactionId=******&paymentMethod=***&paymentAmount=**.**&paymentFee=**.**&status=pending or success or failed

Verify request


<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://pay.bijoypay.com/api/payment/verify',
  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 =>'{"transaction_id":"ABCDEFH"}',
  CURLOPT_HTTPHEADER => array(
    'API-KEY: YourAPIKeyHere',
    'Content-Type: application/json',
    'SECRET-KEY: Secret key From API credentials',
    'BRAND-KEY: Brand key From Brands'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

?>
      

<?php
$client = new Client();
$headers = [
  'API-KEY' => 'YourAPIKeyHere',
  'Content-Type' => 'application/json',
  'SECRET-KEY' => 'Secret key From API credentials',
  'BRAND-KEY' => 'Brand key From Brands'
];
$body = '{
  "transaction_id": "ABCDEFH"
}';
$request = new Request('POST', 'https://pay.bijoypay.com/api/payment/verify', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();

?>
      

const axios = require('axios');
let data = JSON.stringify({
  "transaction_id": "ABCDEFH"
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://pay.bijoypay.com/api/payment/verify',
  headers: { 
    'API-KEY': 'YourAPIKeyHere', 
    'Content-Type': 'application/json',
    'SECRET-KEY': 'Secret key From API credentials',
    'BRAND-KEY': 'Brand key From Brands'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});
      

import http.client
import json

conn = http.client.HTTPSConnection("local.pay.expensivepay.com")
payload = json.dumps({
  "transaction_id": "ABCDEFH"
})
headers = {
  'API-KEY': 'YourAPIKeyHere',
  'Content-Type': 'application/json',
  'SECRET-KEY': 'Secret key From API credentials',
  'BRAND-KEY': 'Brand key From Brands'
}
conn.request("POST", "/api/payment/verify", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
      

package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://pay.bijoypay.com/api/payment/verify"
  method := "POST"

  payload := strings.NewReader(`{"transaction_id":"ABCDEFH"}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("API-KEY", "YourAPIKeyHere")
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("SECRET-KEY", "Secret key From API credentials")
  req.Header.Add("BRAND-KEY", "Brand key From Brands")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
      
Sample Response

{
    "cus_name": "John Doe",
    "cus_email": "john@gmail.com",
    "amount": "900.000",
    "transaction_id": "OVKPXW165414",
    "metadata": {
      "phone": "015****",
    },
    "payment_method": "bkash",
    "status": "COMPLETED"
}
      

Response Details

Field Name Type Description
Success Response
status string COMPLETED or PENDING or ERROR
cus_name String Customer Name
cus_email String Customer Email
amount String Amount
transaction_id String Transaction id Generated by System
metadata json Metadata used for Payment creation
Error Response
status bool FALSE
message String Message associated with the error response

Ready-made modules

WordPress

Integrate the payment gateway into your WordPress website. Whether you run an e-commerce store, a membership site or a donation platform, the module lets you accept payments online. Download it and start collecting payments.

Download WordPress module

WHMCS

Integrate the gateway into your WHMCS setup. Accept payments from your customers, manage invoices and track transactions from within WHMCS.

Download WHMCS module

SMM panel

Add the gateway to your SMM panel. Streamline the payment step for your social media marketing services and give clients a smooth checkout.

Download SMM panel module

Mobile app

Install the bridge app on the Android phone that receives your payment SMS. It is the only hardware the setup needs — it reads each payment message and lets the gateway confirm the order automatically.

Download the bridge app

Need help integrating?

Tell us what you are building and we will point you at the right endpoint.