Documentation for Paystation

In this section you'll find basic information about Paystation and how to install it and use it properly. If you're first time user then you should read Getting Started section first.

Demo Pay Registration

Hosted Checkout

Hosted Checkout Integration

Here, you will redirect the customer to Paystation Hosted page to display the payment channels and Customer will be redirected after completing payment to your website with payment response.

Payment Process Environment

We have both Live environment and Test/Sandbox environment in Paystation. You just need to use proper URL and Store ID's to process payments. We provide separate store ID for live and test

Live Environment

All the transaction made using this environment are counted as real transaction, URL starts with https://api.paystation.com.bd

Grant Token

API NAME : GRANT TOKEN
API URL : https://api.paystation.com.bd/grant-token
METHOD : POST

Request Data

Param_Name Data_Type Description
Request Header
merchantId string (30) Mandatory - Your Merchant ID will be provided by PayStation.
password string (30) Mandatory - Your Password will be provided by PayStation.

Request Response

Param_Name Description
status_code status_code "200" indicates successfully token generated. All codes except "200" are for failed.
status success/failed
message Details message
token If success, you will get token here.

Sample Request & Response

						
1.PHP CURL SCRIPT : 
						
$header=array(
    'merchantId:xxxxxx',
    'password:xxxxxx'                                                        
);
$url = curl_init("https://api.paystation.com.bd/grant-token");
curl_setopt($url,CURLOPT_HTTPHEADER, $header);
curl_setopt($url,CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($url,CURLOPT_RETURNTRANSFER, true);
curl_setopt($url,CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($url,CURLOPT_FOLLOWLOCATION, 1);
$tokenData=curl_exec($url);
curl_close($url);


2. SUCCESS RESPONSE (json format):
{
    "status_code":"200",
    "status":"success",
    "message":"Token generated successfully.",
    "token":"lGxWsAwfLa1oHuTAWQOhubunmZmmpVQltKJJoznC7ntrO58CeJOnDspKd1xT"
}

3. FAILED RESPONSE (json format):
{
    "status_code":"1001",
    "status":"failed",
    "message":"Invalid Credential."
}				
                        
					

Create Payment

API NAME : PAYMENT CREATE
API URL : https://api.paystation.com.bd/create-payment
METHOD : POST

Request Data

Param_Name Data_Type Description
Request Header
token Mandatory Generated token using grant token API.
Request Body
invoice_number string (20) Mandatory - Unique Invoice ID to identify your order in both your end and Paystation.
currency string (20) Mandatory - Transaction Currency i.e BDT.
payment_amount decimal (10,2) Mandatory - Total Amount of your order to be paid. i.e 1250.00
reference string (20) - Extra Reference number to identify your order in your end.
cust_name string (200) Mandatory - Your customer name to address the customer in payment receipt email
cust_phone string (15) Mandatory - The phone/mobile number of your customer to contact if any issue arises
cust_email string (50) Mandatory - Valid email address of your customer to send payment receipt from Paystation end
cust_address string (255) Address of your customer. Not mandatory but useful if provided
callback_url string (200) Mandatory - Callback URL of your website. After success/failed we will send you the response via your callback URL.
checkout_items ~ ~ ~ Your customer order's checkout items/cart data you need to send the checkout items in json_encode format.

Request Response

Param_Name Description
status_code status_code "200" indicates successfully payment link generated. All codes except "200" are for failed.
status success/failed
message Details message
payment_url If success, you will get payment_url here.

Sample Request & Response

						
1.PHP CURL REQUEST : 
						
$header=array(
    'token:lGxWsAwfLa1oHuTAWQOhubunmZmmpVQltKJJoznC7ntrO58CeJOnDspKd1xT'                                                       
);
$body=array(
    'invoice_number' => "2021252525",           
    'currency' => "BDT",                        
    'payment_amount' => "120",
    'reference' => "102030",
    'cust_name' => "Jhon Max",
    'cust_phone' => "01700000001",
    'cust_email' => "max@gmail.com",
    'cust_address' => "Dhaka, Bangladesh",
    'callback_url' => "http://www.yourdomain.com/success.php",
    'checkout_items' => "orderItems"
);

$url = curl_init("https://api.paystation.com.bd/create-payment");
curl_setopt($url,CURLOPT_HTTPHEADER, $header);
curl_setopt($url,CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($url,CURLOPT_RETURNTRANSFER, true);
curl_setopt($url,CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($url,CURLOPT_POSTFIELDS, $body);
curl_setopt($url,CURLOPT_FOLLOWLOCATION, 1);
$responseData=curl_exec($url);
curl_close($url);


2. SUCCESS RESPONSE (json format):
{
    "status_code":"200",
    "status":"success",
    "message":"Payment Created Successfully.",
    "payment_url":"https://api.paystation.com.bd/checkout/121301028928655/2jWsXVEsi1waq33QEbN0MxZjm7axBnZEIkZmeHoQFdLb7tz57h"
}

3. FAILED RESPONSE (json format):
{
    "status_code":"2001",
    "status":"failed",
    "message":"Invalid Token."
}				
                        
					

Payment Notification (callback)

After completing payment we will send you the payment information via your callback url that you have sent in payment create API. We will send you data via header parameter.

Example : http://yourdomain.com/success.php?status=Successful&invoice_number=2021252525&trx_id=10XB9900

Header Parameters

Param Name Description
status Payment Status: Successful/Failed/Canceled
invoice_number Your unique invoice_number that you have been sent in payment create API.
trx_id Payment Transaction ID (you will get trx_id for success payment only)

Retrive Transaction

API NAME : TRANSACTION RETRIVE
API URL : https://api.paystation.com.bd/retrive-transaction
METHOD : POST

Request Data

Param Name Data Type Description
Request Header Parameter
token Mandatory Generated token using grant token API.
Request Body
invoice_number MandatoryYour unique invoice_number that you have been sent in payment create API.
trx_id Mandatory Payment Transaction ID (the value could be null if you get null value in your callback url )

Request Response

Param_Name Description
status_code status_code "200" indicates your request reached to us successfully.
status success/failed (request status)
message Details message
data (If status_code is "200")
invoice_number Your unique invoice_number that you have been sent in payment create API.
trx_status Transaction status (Success/Failed/Refund) - You must be confirmed the payment is success/failed/canceled by this parameter.
trx_id Payment Transaction ID
payment_amount Payment Amount (1200.00)
order_date_time Transaction Time (2022-12-25 10:25:30)
payer_mobile_no Payer Mobile Number
payment_method bKash/Nagad/Rocket/Upay/Mastercard/Visa
reference Your extra reference number that you have sent in payment create API
checkout_items checkout_items that you have sent in payment create API

Sample Request & Response

						
1.PHP CURL REQUEST : 
						
$header=array(
    'token:lGxWsAwfLa1oHuTAWQOhubunmZmmpVQltKJJoznC7ntrO58CeJOnDspKd1xT'                                                       
);
$body=array(
    'invoice_number' => "2021252525",           
    'trx_id' => "10XB9900"
);

$url = curl_init("https://api.paystation.com.bd/retrive-transaction");
curl_setopt($url,CURLOPT_HTTPHEADER, $header);
curl_setopt($url,CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($url,CURLOPT_RETURNTRANSFER, true);
curl_setopt($url,CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($url,CURLOPT_POSTFIELDS, $body);
curl_setopt($url,CURLOPT_FOLLOWLOCATION, 1);
$responseData=curl_exec($url);
curl_close($url);


2. SUCCESS RESPONSE (json format):
{
    "status_code":"200",
    "status":"success",
    "message":"Transaction found.",
    "data":
    {
       "invoice_number":"2021252525", 
       "trx_status":"Success",
       "trx_id":"10XB9900",
       "payment_amount":"120",
       "order_date_time":"2022-12-25 10:25:30",
       "payer_mobile_no":"01700000001",
       "payment_method":"bkash",
       "reference":"102030",
       "checkout_items":"orderItems",
    }
}

3. SUCCESS RESPONSE (BUT TRANSACTION FAILED):
{
    "status_code": "200",
    "status": "success",
    "message": "Transaction found",
    "data": {
        "invoice_number": "2021252525",
        "trx_status": "Failed",
        "trx_id": "",
        "payment_amount": "120.00",
        "order_date_time": "2023-01-14 11:04:42",
        "payer_mobile_no": "",
        "payment_method": "",
        "reference": "102030",
        "checkout_items": "orderItems"
    }
}

3. FAILED RESPONSE (json format):
{
    "status_code":"2001",
    "status":"failed",
    "message":"Invalid Token."
}