Preloader
Developer
Support Login in to Dashboard
API Reference

Check Payment Status

After the customer pays, they are redirected to your return_url. The payment result is sent in the query string.

GET https://example.com/success?type=success&data[trx_id]=...
Query Parameters
type string Required

Payment result: success or error.

Example: success
message.code integer Required

HTTP style result code.

Example: 200
message.success array Optional

Success messages. Sent when type is success.

Example: SUCCESS
message.error array Optional

Error messages. Sent when type is error.

data.token string Required

Payment token returned by Initiate Payment.

data.trx_id string Required

Transaction ID of the payment.

Example: BP2c7sAvw75MTlrP
data.amount decimal Required

Amount received by the merchant.

Example: 100.00
data.payer.username string Required

Username of the payer.

data.payer.email string Required

Email of the payer.

data.custom string Optional

The custom value you sent when creating the payment.

Example: ORDER-123456789

Never trust the redirect alone. Match data.token or data.custom with the order you saved and check the amount before you deliver the order.

If the customer cancels, or the payment cannot be processed, they are sent to your cancel_url.

Handle the return_url
<?php
// success.php  (your return_url)

$type    = $_GET['type'] ?? 'error';
$data    = $_GET['data'] ?? [];
$message = $_GET['message'] ?? [];

if ($type === 'success') {
    $token  = $data['token'];
    $trxId  = $data['trx_id'];
    $amount = $data['amount'];
    $custom = $data['custom'];   // your order id

    // 1. Find your order by $custom (or the saved token)
    // 2. Check the amount and mark the order as paid
    echo "Payment successful. Transaction: {$trxId}";
} else {
    echo 'Payment failed: ' . implode(', ', $message['error'] ?? []);
}
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

Route::get('success', function (Request $request) {
    if ($request->input('type') !== 'success') {
        return response()->json([
            'type'    => 'error',
            'message' => $request->input('message.error', []),
        ], 400);
    }

    $order = Order::where('reference', $request->input('data.custom'))->firstOrFail();
    $order->update([
        'status'         => 'paid',
        'transaction_id' => $request->input('data.trx_id'),
    ]);

    return response()->json([
        'type'    => 'success',
        'message' => 'Payment Success',
        'data'    => $request->input('data'),
    ]);
});
// Express.js — qs parses message[code]=200 into nested objects
app.get('/success', async (req, res) => {
  const { type, data = {}, message = {} } = req.query;

  if (type !== 'success') {
    return res.status(400).json({ type: 'error', message: message.error });
  }

  const order = await Order.findOne({ reference: data.custom });
  order.status = 'paid';
  order.transactionId = data.trx_id;
  await order.save();

  res.json({ type: 'success', data });
});
# Flask — query keys arrive as "data[trx_id]", "message[code]" ...
from flask import Flask, request, jsonify

app = Flask(__name__)

@app.get("/success")
def success():
    q = request.args
    if q.get("type") != "success":
        return jsonify(type="error", message=q.get("message[error][0]")), 400

    trx_id = q.get("data[trx_id]")
    custom = q.get("data[custom]")   # your order id
    amount = q.get("data[amount]")

    # find the order by custom, check amount, mark it paid
    return jsonify(type="success", trx_id=trx_id)
Query data (decoded)
Payment completed
{
    "message": {
        "code": 200,
        "success": [
            "SUCCESS"
        ]
    },
    "data": {
        "token": "2zMRmT3KeYT2BWMAyGhqEfuw4tOYOfGXKeyKqehZ8mF1E35hMwE69gPpyo3e",
        "trx_id": "BP2c7sAvw75MTlrP",
        "payer": {
            "username": "testuser",
            "email": "user@example.com"
        },
        "amount": "100.00",
        "custom": "ORDER-123456789"
    },
    "type": "success"
}
Payment could not be completed
{
    "message": {
        "code": 500,
        "error": [
            "Failed to create payment! Please try again"
        ]
    },
    "data": [],
    "type": "error"
}