Current Production API https://pay.greenpay.bd
Developer Overview

Welcome To GreenPay Docs Last updated: 2026-07-06

GreenPay is a simple and Secure payment automation tool which is designed to use personal account as a payment gateway so that you can accept payments from your customer through your website where you will find a complete overview on how GreenPay works and how you can integrate GreenPay API in your website


API Introduction

Production API v1

GreenPay Merchant Payment API

JSON REST API

বর্তমান public merchant integration-এ Payment Create, Payment Verify, Hosted Checkout Status এবং Webhook lifecycle response রয়েছে। Android device/SMS ingestion API merchant checkout integration-এর অংশ নয়, তাই এই public document-এ আলাদা রাখা হয়েছে।

Base URL https://pay.greenpay.bd

Authentication এবং Domain Security

প্রতিটি request-এ Brand-এর API key header-এ পাঠাতে হবে। API key URL বা frontend source code-এ প্রকাশ করবেন না।

Required Headers
API-KEY: YOUR_BRAND_API_KEYContent-Type: application/jsonAccept: application/json
Domain rule: success_url, cancel_url এবং optional webhook_url-এর hostname Merchant-এর active approved Brand domain-এর একটি হতে হবে। Server-to-server request-এ source_domain অথবা X-GREENPAY-DOMAIN পাঠানো recommended।
POST

Create Payment

https://pay.greenpay.bd/api/payment/create

নতুন hosted checkout session তৈরি করে। সফল হলে customer-কে payment_url-এ redirect করুন। Session ১৫ মিনিটের জন্য valid থাকে।

FieldRequiredTypeRules
amountYesnumber0-এর বেশি এবং সর্বোচ্চ 1,000,000।
success_urlYesURLApproved merchant domain-এর valid URL।
cancel_urlYesURLApproved merchant domain-এর valid URL।
webhook_urlNoURLLifecycle webhook; approved domain হতে হবে।
source_domainRecommendedstring/URLServer-side integration source domain।
cus_nameNostringCustomer full name।
cus_emailNoemailReminder/completed email-এর জন্য ব্যবহার হয়।
cus_phoneNostringCustomer phone number।
currencyNostringDefault merchant/system currency; সাধারণত BDT।
metadataNoJSON objectOrder/product/custom reference data। String নয়।
return_typeNostringMerchant callback preference; default GET।
cURL Request
curl --request POST 'https://pay.greenpay.bd/api/payment/create' \ --header 'API-KEY: YOUR_BRAND_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{"cus_name":"Aminul Islam","cus_email":"customer@example.com","cus_phone":"01300000000","amount":1200,"currency":"BDT","success_url":"https://shop.example.com/payment/success","cancel_url":"https://shop.example.com/payment/cancel","webhook_url":"https://shop.example.com/payment/webhook","source_domain":"shop.example.com","metadata":{"order_id":"ORDER-1001","items":[{"name":"Premium Package","quantity":1,"price":1200}]}}'
Success Response · HTTP 200
{ "success": true, "status": 1, "state": "success", "code": "PAYMENT_SESSION_CREATED", "message": "Payment session created successfully.", "payment_url": "https://pay.greenpay.bd/api/execute/0f37dcbfa54a42bd9cf04e25d52f0201", "status_url": "https://pay.greenpay.bd/api/status/0f37dcbfa54a42bd9cf04e25d52f0201", "transaction_id": "GP7QKEK1003399", "payment_id": "0f37dcbfa54a42bd9cf04e25d52f0201", "expires_at": "2026-07-18 16:30:00"}
Standard Error Response
{ "success": false, "status": "error", "state": "blocked", "code": "DOMAIN_NOT_ALLOWED", "message": "এই API request Merchant account-এর অনুমোদিত domain থেকে আসেনি।", "data": { "can_retry": false, "count_attempt": false, "approved_domains": [ "shop.example.com" ] }}

Payment Create Response Codes

HTTPCodeMeaning
200PAYMENT_SESSION_CREATEDCheckout session তৈরি হয়েছে; payment_url-এ customer redirect করুন।
400INVALID_API_REQUESTশুধু create এবং verify operation গ্রহণযোগ্য।
401INVALID_API_KEYAPI-KEY পাওয়া যায়নি বা সঠিক নয়।
403BRAND_INACTIVE / MERCHANT_INACTIVEBrand বা Merchant inactive।
403MERCHANT_PLAN_INACTIVE / MERCHANT_PLAN_EXPIREDMerchant plan active নয় বা মেয়াদ শেষ।
403MERCHANT_DOMAIN_NOT_CONFIGUREDMerchant-এর active approved domain নেই।
403INVALID_CALLBACK_DOMAINsuccess_url, cancel_url বা webhook_url valid URL নয়।
403CALLBACK_DOMAIN_NOT_ALLOWEDCallback URL approved domain-এর নয়।
403DOMAIN_NOT_ALLOWEDRequest source approved merchant domain-এর নয়।
403INTERNAL_*GreenPay internal Add Wallet/Invoice reference, ownership বা amount mismatch।
422INVALID_METADATAmetadata JSON object/array নয়।
422INVALID_PAYMENT_PARAMETERSamount, success_url অথবা cancel_url invalid/missing।
500PAYMENT_SESSION_CREATE_FAILEDDatabase/session creation failure; retry করা যেতে পারে।

Checkout Redirect এবং Status Page

Payment create response-এর payment_url customer browser-এ খুলুন। Merchant redirect URL-এ নিচের query parameters আসতে পারে:

Redirect Example
https://shop.example.com/payment/success ?transactionId=GP7QKEK1003399 &paymentMethod=bkash &paymentAmount=1200.00 &paymentFee=0.00 &status=success

Customer-facing live status দেখতে create response-এর status_url ব্যবহার করা যায়। Server-side source of truth হিসেবে সবসময় Verify API বা signed/private webhook handling ব্যবহার করুন।

POST

Verify Payment

https://pay.greenpay.bd/api/payment/verify

transaction_id দিয়ে Merchant-এর payment lifecycle status যাচাই করে। Verify request একই Brand API key দিয়ে পাঠান।

Verify Request
curl --request POST 'https://pay.greenpay.bd/api/payment/verify' \ --header 'API-KEY: YOUR_BRAND_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{"transaction_id":"GP7QKEK1003399"}'
Completed
{ "success": true, "status": "COMPLETED", "code": "PAYMENT_COMPLETED", "message": "আপনার payment সফলভাবে যাচাই ও সম্পন্ন হয়েছে।", "data": { "can_retry": false, "count_attempt": false, "reason": null }, "cus_name": "Aminul Islam", "cus_email": "customer@example.com", "amount": "1200.000", "currency": "BDT", "transaction_id": "GP7QKEK1003399", "metadata": { "order_id": "ORDER-1001", "source_domain": "shop.example.com", "api_brand_id": 27, "request_source": "external_merchant_api" }, "payment_method": "bkash", "payment_setting_id": 68, "review_id": null, "review_status": null}
Pending
{ "success": false, "status": "PENDING", "code": "PAYMENT_PENDING", "message": "Payment এখনো সম্পন্ন হয়নি। payment তথ্য সঠিকভাবে দিয়ে verification সম্পন্ন করুন।", "data": { "can_retry": true, "count_attempt": false, "reason": null }, "transaction_id": "GP7QKEK1003399"}
Verification Locked
{ "success": false, "status": "VERIFICATION_LOCKED", "code": "VERIFICATION_ATTEMPTS_EXCEEDED", "message": "Verification attempt limit শেষ হয়েছে। নির্ধারিত সময় পরে আবার চেষ্টা করুন।", "data": { "can_retry": false, "count_attempt": false, "reason": null, "unlock_at": "2026-07-18 19:30:00", "seconds_until_unlock": 7200 }, "transaction_id": "GP7QKEK1003399"}

Verify Lifecycle Codes

HTTPCodeMeaning
200PAYMENT_COMPLETEDPayment completed।
200PAYMENT_PENDINGPayment এখনো pending; পুনরায় verify করা যাবে।
200MERCHANT_REVIEW_PENDINGMerchant review-এর অপেক্ষায়।
200MERCHANT_REVIEW_APPROVEDMerchant approve করেছেন; checkout থেকে আবার verify করুন।
200PAYMENT_REJECTEDMerchant payment reject করেছেন; reason থাকলে response-এ থাকবে।
200PAYMENT_CANCELLEDPayment cancelled; terminal state।
200PAYMENT_REFUNDEDPayment refunded; terminal state।
200VERIFICATION_ATTEMPTS_EXCEEDEDAttempt limit শেষ; unlock_at পর্যন্ত blocked।
422TRANSACTION_ID_REQUIREDtransaction_id দেওয়া হয়নি।
404TRANSACTION_NOT_FOUNDAPI owner-এর জন্য transaction পাওয়া যায়নি।
401/403INVALID_API_KEY / access codesAPI key, Merchant, Brand বা Plan access invalid।

Hosted Checkout Security Codes

Code groupPossible codesWhat it means
Payment methodPAYMENT_METHOD_DISABLED, PAYMENT_METHOD_MISMATCHSelected method global/merchant configuration-এর সঙ্গে মিলছে না অথবা বন্ধ।
Receiving accountPAYMENT_ACCOUNT_NOT_SELECTED, PAYMENT_ACCOUNT_SELECTION_REQUIRED, PAYMENT_ACCOUNT_NOT_FOUND, PAYMENT_ACCOUNT_INACTIVE, PAYMENT_ACCOUNT_INCOMPLETECheckout-এর জন্য valid receiving account নির্বাচন বা configuration প্রয়োজন।
Account integrityPAYMENT_ACCOUNT_MISMATCH, PAYMENT_ACCOUNT_CHANGED, PAYMENT_ACCOUNT_TYPE_REQUIRED, PAYMENT_ACCOUNT_TYPE_INACTIVESession তৈরির পর account/method context বদলেছে অথবা requested account type usable নয়।
Reuse protectionPAYMENT_ALREADY_USED, PAYMENT_ALREADY_RESERVED, PAYMENT_ALREADY_COMPLETEDএকটি transaction evidence অন্য checkout-এ ব্যবহার/reserve হয়েছে অথবা payment আগে completed।
Terminal/reviewMERCHANT_REVIEW_PENDING, PAYMENT_CANCELLED, PAYMENT_REFUNDED, VERIFICATION_ATTEMPTS_EXCEEDEDMerchant decision, terminal lifecycle অথবা verification lock।
Important: status text এবং code দুটোই check করুন। Completed ছাড়া terminal states—Rejected, Cancelled ও Refunded—আবার success করা যাবে না।

Webhook Lifecycle

webhook_url দেওয়া থাকলে GreenPay payment lifecycle event queue করে retry সহ POST delivery করে। Endpoint দ্রুত HTTP 2xx return করবে এবং একই event পুনরায় আসতে পারে ধরে idempotent processing করতে হবে।

Webhook JSON Payload
{ "success": true, "code": "PAYMENT_COMPLETED", "status": "payment_completed", "message": "Payment completed successfully.", "reason": null, "transaction_id": "GP7QKEK1003399", "payment_id": "0f37dcbfa54a42bd9cf04e25d52f0201", "merchant_uid": 384, "brand_id": 27, "amount": 1200, "currency": "BDT", "payment_method": "bkash", "payment_setting_id": 68, "state_updated_at": "2026-07-18 16:18:20", "occurred_at": "2026-07-18T16:18:20+06:00"}
PAYMENT_COMPLETEDMERCHANT_REVIEW_PENDINGMERCHANT_REVIEW_APPROVEDPAYMENT_REJECTEDPAYMENT_CANCELLEDPAYMENT_REFUNDEDVERIFICATION_ATTEMPTS_EXCEEDEDVERIFICATION_ATTEMPTS_RESETVERIFICATION_AUTO_UNLOCKED

Production Integration Checklist

  1. Brand active করুন এবং correct API key server-side environment variable-এ রাখুন।
  2. Brand domain active/approved করুন; callback URLs একই approved owner domain-এর রাখুন।
  3. Create response থেকে payment_url customer-কে redirect করুন এবং transaction_id নিজের order-এর সঙ্গে save করুন।
  4. Success redirect-কে একা payment proof হিসেবে ব্যবহার করবেন না; Verify API বা webhook দিয়ে final state confirm করুন।
  5. Webhook duplicate delivery idempotently handle করুন; transaction_id + code দিয়ে deduplicate করা নিরাপদ।
  6. Error response-এর data.can_retry এবং data.count_attempt অনুসরণ করুন।

Integration

You can integrate our payment gateway into your PHP Laravel WordPress WooCommerce sites.

Sample Request

 <?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://pay.greenpay.bd/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","webhook_url":"yourdomain.com/webhook","metadata":{"phone":"016****"},"amount":"10"}', CURLOPT_HTTPHEADER => array( 'API-KEY: gnXi7etgWNhFyFGZFrOMYyrmnF4A1eGU5SC2QRmUvILOlNc2Ef', 'Content-Type: application/json' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ?> 
 <?php $client = new Client(); $headers = [ 'API-KEY' => 'gnXi7etgWNhFyFGZFrOMYyrmnF4A1eGU5SC2QRmUvILOlNc2Ef', 'Content-Type' => 'application/json' ]; $body = '{ "success_url": "yourdomain.com/success", "cancel_url": "yourdomain.com/cancel", "webhook_url": "yourdomain.com/webhook", "metadata": { "phone": "016****" }, "amount": "10" }'; $request = new Request('POST', 'https://pay.greenpay.bd/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", "webhook_url": "yourdomain.com/webhook", "metadata": { "phone": "016****" }, "amount": "10" }); let config = { method: 'post', maxBodyLength: Infinity, url: 'https://pay.greenpay.bd/api/payment/create', headers: { 'API-KEY': 'gnXi7etgWNhFyFGZFrOMYyrmnF4A1eGU5SC2QRmUvILOlNc2Ef', 'Content-Type': 'application/json' }, 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.greenpay.bd/api/payment/create" payload = json.dumps({ "success_url": "yourdomain.com/success", "cancel_url": "yourdomain.com/cancel", "webhook_url": "yourdomain.com/webhook", "metadata": { "phone": "016****" }, "amount": "10" }) headers = { 'API-KEY': 'gnXi7etgWNhFyFGZFrOMYyrmnF4A1eGU5SC2QRmUvILOlNc2Ef', 'Content-Type': 'application/json' } 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.greenpay.bd/api/payment/create" method := "POST" payload := strings.NewReader(`{"success_url":"yourdomain.com/success","cancel_url":"yourdomain.com/cancel","webhook_url":"yourdomain.com/webhook","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", "gnXi7etgWNhFyFGZFrOMYyrmnF4A1eGU5SC2QRmUvILOlNc2Ef") req.Header.Add("Content-Type", "application/json") 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.greenpay.bd/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: gnXi7etgWNhFyFGZFrOMYyrmnF4A1eGU5SC2QRmUvILOlNc2Ef', 'Content-Type: application/json' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ?> 
 <?php $client = new Client(); $headers = [ 'API-KEY' => 'gnXi7etgWNhFyFGZFrOMYyrmnF4A1eGU5SC2QRmUvILOlNc2Ef', 'Content-Type' => 'application/json' ]; $body = '{ "transaction_id": "ABCDEFH" }'; $request = new Request('POST', 'https://pay.greenpay.bd/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.greenpay.bd/api/payment/verify', headers: { 'API-KEY': 'gnXi7etgWNhFyFGZFrOMYyrmnF4A1eGU5SC2QRmUvILOlNc2Ef', 'Content-Type': 'application/json' }, 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': 'gnXi7etgWNhFyFGZFrOMYyrmnF4A1eGU5SC2QRmUvILOlNc2Ef', 'Content-Type': 'application/json' } 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.greenpay.bd/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", "gnXi7etgWNhFyFGZFrOMYyrmnF4A1eGU5SC2QRmUvILOlNc2Ef") req.Header.Add("Content-Type", "application/json") 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

Modules

Download ready-made plugins, modules and tools to integrate quickly with your system.

WordPress WooCommerce Plugin Version

See Setup Video: YouTube Video

WHMCS Module

See Setup Video: How To Setup Video here

Sketchware Module

See Setup Video: How To Setup Video here

Modified SMM Panel Module

See Setup Video: Video here

Mobile App Download

See Setup Video: How To Setup App Video here