Overview
GG Pay BD is an online payment automation platform for websites, applications and digital businesses.
The REST API allows your application to create payment sessions and verify transactions from your backend.
Use the following base URL for the GG Pay BD API.
https://autopay.ggtopup.shop
Setup
Complete the following steps before sending API requests.
- Create your GG Pay BD account.
- Complete your profile.
- Configure your payment methods.
- Add and verify your website domain.
- Generate your API credentials.
API Credentials
| Credential | Purpose |
|---|---|
app-key
|
Identifies your application. |
secret-key
|
Authenticates your request. |
host-name
|
Your registered website domain. |
Never expose your Secret Key in frontend JavaScript, public repositories or client-side mobile applications.
Payment Environment
GG Pay BD currently provides a live environment for real transactions.
Transactions created using the live environment are real transactions.
https://autopay.ggtopup.shop
Create Payment Endpoint
POST https://autopay.fasttopupbd.shop/request/payment/create
Create Payment
Send a POST request to create a new payment session.
Request Parameters
| Parameter | Type | Description |
|---|---|---|
cus_name
|
string | Required Customer name. |
cus_email
|
string | Required Customer email address. |
amount
|
string | Required Payment amount. |
success_url
|
string | URL after successful payment. |
cancel_url
|
string | URL after cancellation. |
Request Headers
| Header | Value | Purpose |
|---|---|---|
Content-Type
|
application/x-www-form-urlencoded | Request format. |
app-key
|
YOUR_API_KEY | API authentication. |
secret-key
|
YOUR_SECRET_KEY | Secret authentication. |
host-name
|
example.com | Registered domain. |
Integration Examples
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://autopay.fasttopupbd.shop/request/payment/create',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array(
'cus_name' => 'Demo User',
'cus_email' => 'demo@gmail.com',
'amount' => '10',
'success_url' => 'https://example.com/success.php',
'cancel_url' => 'https://example.com/cancel.php'
),
CURLOPT_HTTPHEADER => array(
'app-key: YOUR_API_KEY',
'secret-key: YOUR_SECRET_KEY',
'host-name: example.com'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post(
'https://autopay.fasttopupbd.shop/request/payment/create',
[
'headers' => [
'app-key' => 'YOUR_API_KEY',
'secret-key' => 'YOUR_SECRET_KEY',
'host-name' => 'example.com'
],
'form_params' => [
'cus_name' => 'Demo User',
'cus_email' => 'demo@gmail.com',
'amount' => '10',
'success_url' => 'https://example.com/success.php',
'cancel_url' => 'https://example.com/cancel.php'
]
]
);
echo $response->getBody();
const axios = require('axios');
const data = new URLSearchParams();
data.append('cus_name', 'Demo User');
data.append('cus_email', 'demo@gmail.com');
data.append('amount', '10');
data.append(
'success_url',
'https://example.com/success.php'
);
data.append(
'cancel_url',
'https://example.com/cancel.php'
);
axios.post(
'https://autopay.fasttopupbd.shop/request/payment/create',
data,
{
headers: {
'app-key': 'YOUR_API_KEY',
'secret-key': 'YOUR_SECRET_KEY',
'host-name': 'example.com'
}
}
)
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
Payment Response
After creating the payment session, redirect the customer to the payment page returned by your API response.
Successful Payment
Your success URL may receive transaction information.
success.php?transactionId=XXXX &paid_by=bkash &paymentAmount=10.00 &paymentFee=0.00 &success=1 &p_type=XXXX
Failed / Cancelled Payment
Your cancel URL may receive:
cancel.php?transactionId=XXXX &paymentAmount=10.00 &paymentFee=0.00 &success=0
Returned Parameters
| Parameter | Type | Description |
|---|---|---|
transactionId
|
string | Unique transaction ID. |
paymentAmount
|
string | Payment amount. |
paymentFee
|
string | Payment fee. |
success
|
integer | 1 = success, 0 = failed. |
p_type
|
string | Payment method/type. |
Verify Payment
Always verify a transaction from your backend before delivering products or services.
Do not trust only frontend redirect parameters. Verify the transaction server-to-server.
Verify Endpoint
POST https://autopay.fasttopupbd.shop/request/payment/verify
Verify Parameters
| Parameter | Type | Description |
|---|---|---|
transaction_id
|
string | Transaction ID that you want to verify. |
PHP Verification
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://autopay.fasttopupbd.shop/request/payment/verify',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array(
'transaction_id' => 'TRANSACTION_ID'
),
CURLOPT_HTTPHEADER => array(
'app-key: YOUR_API_KEY',
'secret-key: YOUR_SECRET_KEY',
'host-name: example.com'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Example Response
{
"cus_name": "Demo User",
"cus_email": "demo@gmail.com",
"amount": "10",
"transaction_id": "JJTG987652",
"status": "1",
"message": "success"
}
Verification Status
| Status | Meaning |
|---|---|
1
|
Payment verified successfully. |
0
|
Payment not verified. |
Available Modules
Integration modules can be provided for supported platforms.