Introduction

The WorkxPay Payment Gateway enables merchants to securely receive payments from their customers. Our PCI-compliant flow ensures that you can accept payments with minimal effort while maintaining the highest level of security.

You can use our RESTful APIs to integrate into any environment (PHP, Node, Python, etc.) or use our pre-built plugins for popular platforms like WordPress.

API Endpoints

Base URL: https://payment.workxpay.com/api/

POST payment/create
POST payment/verify

Request Parameters

Required Fields

FieldDescriptionConstraint
API-KEYYour unique brand API key from dashboardRequired
amountPayment amount in decimal (e.g. 10.00)Required
success_urlThe URL we redirect to after successRequired
cancel_urlThe URL we redirect to after cancellation or timeoutRequired
webhook_urlServer URL that receives the signed payment resultOptional

Metadata Fields

You can send custom metadata to track customer information. This will be returned in the response.

FieldDescription
emailCustomer's email address
phoneCustomer's mobile number
order_idYour internal order reference ID

Create Payment

Initiate a new payment request and receive a secure payment link.

<?php
$curl = curl_init();
curl_setopt_array($curl, [
 CURLOPT_URL => 'https://payment.workxpay.com/api/payment/create',
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_CUSTOMREQUEST => 'POST',
 CURLOPT_POSTFIELDS => json_encode([
 'success_url' => 'https://site.com/success',
 'cancel_url' => 'https://site.com/cancel',
 'amount' => '100',
 'webhook_url' => 'https://site.com/webhook'
 ]),
 CURLOPT_HTTPHEADER => [
 'API-KEY: YOUR_KEY',
 'Content-Type: application/json'
 ],
]);
$res = curl_exec($curl);
curl_close($curl);
echo $res;
?>
<?php
$client = new \GuzzleHttp\Client();
$res = $client->post('https://payment.workxpay.com/api/payment/create', [
 'headers' => [
 'API-KEY' => 'YOUR_KEY',
 'Content-Type' => 'application/json',
 ],
 'json' => [
 'success_url' => 'https://site.com/success',
 'cancel_url' => 'https://site.com/cancel',
 'amount' => '100',
 ]
]);
echo $res->getBody();
?>
const axios = require('axios');
const data = {
 success_url: 'https://site.com/success',
 cancel_url: 'https://site.com/cancel',
 amount: 100
};
axios.post('https://payment.workxpay.com/api/payment/create', data, {
 headers: {
 'API-KEY': 'YOUR_KEY',
 'Content-Type': 'application/json'
 }
}).then(res => console.log(res.data));
import requests
import json

url = "https://payment.workxpay.com/api/payment/create"
payload = json.dumps({
 "success_url": "https://site.com/success",
 "cancel_url": "https://site.com/cancel",
 "amount": 100
})
headers = {
 "API-KEY": "YOUR_KEY",
 "Content-Type": "application/json"
}
res = requests.post(url, headers=headers, data=payload)
print(res.text)
package main

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

func main() {
 url := "https://payment.workxpay.com/api/payment/create"
 payload := strings.NewReader(`{
 "success_url": "https://site.com/success",
 "cancel_url": "https://site.com/cancel",
 "amount": "100"
 }`)

 req, _ := http.NewRequest("POST", url, payload)
 req.Header.Add("API-KEY", "YOUR_KEY")
 req.Header.Add("Content-Type", "application/json")

 res, _ := http.DefaultClient.Do(req)
 defer res.Body.Close()

 body, _ := ioutil.ReadAll(res.Body)
 fmt.Println(string(body))
}

Verify Payment

Verify the status with the transaction ID before you credit the customer. COMPLETED means the mobile payment was confirmed. PENDING means a bank transfer is waiting for your review. ERROR means the payment was not completed.

<?php
$curl = curl_init();
curl_setopt_array($curl, [
 CURLOPT_URL => 'https://payment.workxpay.com/api/payment/verify',
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_CUSTOMREQUEST => 'POST',
 CURLOPT_POSTFIELDS => '{"transaction_id":"T123"}',
 CURLOPT_HTTPHEADER => [
 'API-KEY: YOUR_KEY',
 'Content-Type: application/json'
 ],
]);
$res = curl_exec($curl);
curl_close($curl);
echo $res;
?>
<?php
$client = new \GuzzleHttp\Client();
$res = $client->post('https://payment.workxpay.com/api/payment/verify', [
 'headers' => [
 'API-KEY' => 'YOUR_KEY',
 'Content-Type' => 'application/json',
 ],
 'json' => [
 'transaction_id' => 'T123'
 ]
]);
echo $res->getBody();
?>
const axios = require('axios');
axios.post('https://payment.workxpay.com/api/payment/verify', {
 transaction_id: 'T123'
}, {
 headers: {
 'API-KEY': 'YOUR_KEY',
 'Content-Type': 'application/json'
 }
}).then(res => console.log(res.data));
import requests
import json

url = "https://payment.workxpay.com/api/payment/verify"
payload = json.dumps({"transaction_id": "T123"})
headers = {
 "API-KEY": "YOUR_KEY",
 "Content-Type": "application/json"
}
res = requests.post(url, headers=headers, data=payload)
print(res.text)
package main

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

func main() {
 url := "https://payment.workxpay.com/api/payment/verify"
 payload := strings.NewReader(`{"transaction_id":"T123"}`)

 req, _ := http.NewRequest("POST", url, payload)
 req.Header.Add("API-KEY", "YOUR_KEY")
 req.Header.Add("Content-Type", "application/json")

 res, _ := http.DefaultClient.Do(req)
 defer res.Body.Close()

 body, _ := ioutil.ReadAll(res.Body)
 fmt.Println(string(body))
}

Webhooks (Server-to-Server)

Webhooks allow your application to receive real-time notifications when a payment status changes. Configure your Webhook URL in your merchant dashboard. Our system will automatically send a signed POST request to your URL when a transaction is completed or failed.

Every callback includes X-WorkxPay-Timestamp and X-WorkxPay-Signature. The signature is HMAC-SHA256 of timestamp.body, using your brand API key. Reject the callback if the signature does not match or the timestamp is older than 5 minutes, then confirm the transaction with the verify API before crediting the customer.

Webhook Payload (POST)

FieldTypeDescription
paymentMethodStringThe method used for payment (e.g. bkash, nagad)
transactionIdStringThe unique transaction ID (TrxID)
paymentAmountDecimalThe total amount paid by the customer
paymentFeeDecimalThe gateway processing fee deducted
statusStringThe payment status (e.g. completed, failed, pending)

Example Payload

{ "paymentMethod": "bkash", "transactionId": "7FE3A8BC", "paymentAmount": "500.00", "paymentFee": "0.00", "status": "completed"}

PHP check: read the raw body, then hash_equals(hash_hmac('sha256', $timestamp . '.' . $rawBody, $apiKey), $signature).

Integration Best Practices

To ensure a secure and smooth payment experience for your users, please follow these guidelines when integrating WorkxPay:

Keep Your API Key Secret

Never expose your API-KEY in frontend code (like Javascript running in the browser) or public repositories. Always initiate payment requests from your secure backend server.

Always Verify Payments

Do not rely solely on the success URL redirect to fulfill an order, as users might close the browser early. Always use the Verify Payment API or configure Webhooks to securely confirm the transaction status before delivering services or goods.

Use Unique Order IDs

Pass a unique order_id in your metadata to easily match our transaction records with your database records if manual reconciliation is ever needed.

Downloads & Modules

Get started quickly with our pre-built plugins and SDKs.

WordPress Plugin
v1.2.0 • WooCommerce
WHMCS Module
v2.0.1 • Automation
SMM Panel Script
v3.5.0 • Perfect Panel
Mobile App
v8.1 • Android

Welcome Back

Sign in to your WorkxPay account
Continue with Google
or sign in with email
Forgot Password?