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 URLhttps://pay.greenpay.bd
Authentication এবং Domain Security
প্রতিটি request-এ Brand-এর API key header-এ পাঠাতে হবে। API key URL বা frontend source code-এ প্রকাশ করবেন না।
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 থাকে।
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 দিয়ে পাঠান।
Merchant 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 করতে হবে।
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