Introduction

Welcome to the aspayds payment integration. Use our API to create invoices and process payments securely.

Base URL: https://payment.aspayds.net/api

Authentication

Authenticate your requests by passing your API Key and Secret in the request headers.

x-api-key: YOUR_PUBLIC_KEY
x-api-secret: YOUR_SECRET_KEY

POST

Create Invoice

Create a new payment invoice and get the payment URL to redirect your customer.

/payment/create

Body Parameters

Field Req Description
amount Yes Payment amount (Numeric).
customer_name Yes Full name (Max 255 chars).
transaction_reference Yes Unique ID (Max 20 chars).
callback_url Yes Redirect URL after payment.
curl -X POST https://payment.aspayds.net/api/payment/create \
  -H "x-api-key: YOUR_KEY" \
  -H "x-api-secret: YOUR_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 100,
    "customer_name": "John Doe",
    "transaction_reference": "TRX123456",
    "callback_url": "https://yoursite.com/callback"
  }'
Success Response (200 OK)
{
  "status": "success",
  "invoice_id": "ATINV17038392001234",
  "payment_url": "https://aspayds.net/methods/eyJpdiI6..."
}

GET

Check Payment Status

Verify the status of a transaction using the Invoice ID or Transaction Reference.

Endpoint Definition

GET /payment/{id}

*{id} can be the invoice_number OR transaction_reference.

curl https://payment.aspayds.net/api/payment/ATINV1703839200 \
  -H "x-api-key: YOUR_KEY" \
  -H "x-api-secret: YOUR_SECRET"
Response
{
  "invoice_id": "ATINV17038392001234",
  "status": "paid",
  "amount_paid": 100,
  "paid_at": "2023-12-29T14:30:00Z"
}

POST

Batch Check Payment Status

Check the status of multiple transactions in a single request.

/payment/batch/status

Body Parameters

Field Req Description
ids Yes Array of invoice IDs or transaction refs.
curl -X POST https://payment.aspayds.net/api/payment/batch/status \
  -H "x-api-key: YOUR_KEY" \
  -H "x-api-secret: YOUR_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "ids": ["ATINV123", "TRX456"]
  }'
Response
{
  "status": "success",
  "total_requested": 2,
  "total_found": 2,
  "invoices": [
    {
      "invoice_id": "ATINV123",
      "transaction_reference": "REF1",
      "status": "paid",
      "amount": 100,
      "amount_paid": 100
    },
    {
      "invoice_id": "ATINV456",
      "transaction_reference": "REF2",
      "status": "pending",
      "amount": 500,
      "amount_paid": 0
    }
  ],
  "not_found_ids": []
}

Callback & Redirect URL

After the payment is completed or cancelled, users will be automatically redirected to your callback URL with query parameters containing the payment status and details.

Success Redirect

{callback_url}?status=success&invoice_id={invoice_id}&transaction_reference={transaction_ref}

User is redirected here when payment is successful.

Cancel Redirect

{callback_url}?status=cancel&invoice_id={invoice_id}&transaction_reference={transaction_ref}

User is redirected here when payment is cancelled.

Query Parameters

Parameter Description Example
status Payment status (success or cancel) success
invoice_id Generated invoice number ATINV1703856789123
transaction_reference Your unique transaction reference TXN123456
// Handle callback in your PHP application
// Route: https://yoursite.com/payment/callback

$status = $_GET['status']; // 'success' or 'cancel'
$invoiceId = $_GET['invoice_id'];
$transactionRef = $_GET['transaction_reference'];

if ($status === 'success') {
    // Verify payment status with API
    $client = new \GuzzleHttp\Client();
    $response = $client->get("https://payment.aspayds.net/api/payment/{$invoiceId}", [
        'headers' => [
            'x-api-key' => 'YOUR_API_KEY',
            'x-api-secret' => 'YOUR_API_SECRET',
        ]
    ]);
    
    $paymentData = json_decode($response->getBody(), true);
    
    if ($paymentData['status'] === 'paid') {
        // Payment confirmed - update your database
        // Mark order as paid, send confirmation email, etc.
        echo "Payment successful!";
    }
} else {
    // Payment was cancelled
    echo "Payment cancelled by user.";
}

Important: Always verify the payment status by calling the GET /payment/{id} endpoint after receiving the callback. Never trust the callback parameters alone for order fulfillment.


Payout API

Use the Payout API to send funds to your users/customers. Perfect for withdrawals, refunds, and disbursements.

Payout methods must be configured in your Store settings before using the API.

GET

Get Payout Methods

Retrieve the list of available payout methods configured for your store.

/payout/methods
curl https://payment.aspayds.net/api/payout/methods \
  -H "x-api-key: YOUR_KEY" \
  -H "x-api-secret: YOUR_SECRET"
Response
{
  "status": "success",
  "data": [
    {
      "id": 1,
      "name": "bKash",
      "type": "mobile_banking",
      "account_type": "Personal",
      "currency": "BDT",
      "min_amount": 100,
      "max_amount": 50000,
      "logo": "https://payment.aspayds.net/storage/payout/bkash.png"
    }
  ]
}

POST

Create Payout Request

Initiate a payout to send funds to a recipient.

/payout/request

Body Parameters

Field Req Description
payout_method_id Yes Method ID from /payout/methods.
amount Yes Payout amount (Numeric).
recipient_name Yes Recipient's full name.
recipient_account Yes Account number / mobile number.
transaction_reference Yes Your unique reference (Max 50 chars).
description No Optional note.
callback_url No Webhook URL for status updates.
curl -X POST https://payment.aspayds.net/api/payout/request \
  -H "x-api-key: YOUR_KEY" \
  -H "x-api-secret: YOUR_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "payout_method_id": 1,
    "amount": 500,
    "recipient_name": "John Doe",
    "recipient_account": "01712345678",
    "transaction_reference": "WD123456"
  }'
Success Response (201 Created)
{
  "status": "success",
  "message": "Payout request created successfully",
  "payout_id": "ATPAY17038392001234",
  "transaction_reference": "WD123456",
  "amount": 500,
  "fee": 0,
  "total_amount": 500,
  "status": "pending"
}

GET

Check Payout Status

Check the status of a payout request using the Payout ID or Transaction Reference.

Endpoint Definition

GET /payout/{id}

*{id} can be the payout_id OR transaction_reference.

curl https://payment.aspayds.net/api/payout/ATPAY17038392001234 \
  -H "x-api-key: YOUR_KEY" \
  -H "x-api-secret: YOUR_SECRET"
Response
{
  "payout_id": "ATPAY17038392001234",
  "transaction_reference": "WD123456",
  "status": "completed",
  "amount": 500,
  "fee": 0,
  "total_amount": 500,
  "recipient_name": "John Doe",
  "recipient_account": "01712345678",
  "processed_at": "2023-12-29T14:30:00Z",
  "created_at": "2023-12-29T14:00:00Z"
}

Payout Statuses

Status Description
pending Payout is awaiting processing.
processing Payout is being processed.
completed Payout was successful.
rejected Payout was rejected by admin.
cancelled Payout was cancelled.

POST

Batch Check Payout Status

Check the status of multiple payout requests in a single request.

/payout/batch/status

Body Parameters

Field Req Description
ids Yes Array of payout IDs or transaction refs.
curl -X POST https://payment.aspayds.net/api/payout/batch/status \
  -H "x-api-key: YOUR_KEY" \
  -H "x-api-secret: YOUR_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "ids": ["ATPAY123", "WD456"]
  }'
Response
{
  "status": "success",
  "total_requested": 2,
  "total_found": 2,
  "payouts": [
    {
      "payout_id": "ATPAY123",
      "transaction_reference": "WD123",
      "status": "completed",
      "amount": 500
    },
    {
      "payout_id": "ATPAY456",
      "transaction_reference": "WD456",
      "status": "pending",
      "amount": 1000
    }
  ],
  "not_found_ids": []
}

Webhooks

Webhooks allow you to receive real-time notifications when payout events occur. Provide a callback_url parameter when creating a payout request to receive notifications.

Important: Your endpoint must respond with a 2xx status code within 10 seconds.

Event Types

Event Description
payout.completed Payout has been successfully processed
payout.processing Payout is being processed
payout.rejected Payout has been rejected
payout.cancelled Payout has been cancelled

Webhook Payload

All webhooks are sent as HTTP POST requests with JSON body:

Payout Completed Webhook
{
"event": "payout.completed",
"timestamp": "2026-02-09T21:30:00.000Z",
"data": {
"payout_id": "ATPAY17038392001234",
"transaction_reference": "WD123456",
"status": "completed",
"amount": 500.00,
"fee": 0.00,
"recipient_name": "John Doe",
"recipient_account": "01712345678",
"processed_at": "2026-02-09T21:30:00.000Z"
}
}

Security Headers

Each webhook request includes the following headers:

Header Description
X-Webhook-Event The event type (e.g., payout.completed)
X-Webhook-Timestamp Unix timestamp of when the webhook was sent
Content-Type application/json

Webhooks

Webhooks allow you to receive real-time notifications when events occur. Provide a callback_url parameter when creating an invoice or payout request to receive notifications.

Important: Your endpoint must respond with a 2xx status code within 10 seconds.

Event Types

Event Description
payment.completed Payment has been successfully verified
payout.completed Payout has been successfully processed
payout.processing Payout is being processed
payout.rejected Payout has been rejected
payout.cancelled Payout has been cancelled

Webhook Payload

All webhooks are sent as HTTP POST requests with JSON body:

Payment Completed Webhook
{
  "event": "payment.completed",
  "timestamp": "2026-02-09T21:30:00.000Z",
  "data": {
    "invoice_id": "ATINV17038392001234",
    "transaction_reference": "TRX123456",
    "status": "completed",
    "amount": 100.00,
    "amount_paid": 100.00,
    "currency": "BDT",
    "customer_name": "John Doe",
    "paid_at": "2026-02-09T21:30:00.000Z"
  }
}
Payout Completed Webhook
{
  "event": "payout.completed",
  "timestamp": "2026-02-09T21:30:00.000Z",
  "data": {
    "payout_id": "ATPAY17038392001234",
    "transaction_reference": "WD123456",
    "status": "completed",
    "amount": 500.00,
    "fee": 0.00,
    "recipient_name": "John Doe",
    "recipient_account": "01712345678",
    "processed_at": "2026-02-09T21:30:00.000Z"
  }
}

Security Headers

Each webhook request includes the following headers:

Header Description
X-Webhook-Event The event type (e.g., payment.completed)
X-Webhook-Timestamp Unix timestamp of when the webhook was sent
Content-Type application/json

Best Practices

  • Always respond with a 2xx status code to acknowledge receipt
  • Process webhooks asynchronously if they require heavy processing
  • Verify the event by checking payment/payout status via API before taking action
  • Store webhook logs for debugging and auditing purposes
  • Use HTTPS endpoints only for production environments
  • Check the X-Webhook-Timestamp to prevent replay attacks

Available SDKs

Speed up your integration with our official libraries.