Skip to main content
GET
/
verify
/
{txid}
Verify a transaction
curl --request GET \
  --url https://pay.gateway.example/opencharge/verify/{txid}
import requests

url = "https://pay.gateway.example/opencharge/verify/{txid}"

response = requests.get(url)

print(response.text)
const options = {method: 'GET'};

fetch('https://pay.gateway.example/opencharge/verify/{txid}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://pay.gateway.example/opencharge/verify/{txid}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

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

func main() {

url := "https://pay.gateway.example/opencharge/verify/{txid}"

req, _ := http.NewRequest("GET", url, nil)

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

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://pay.gateway.example/opencharge/verify/{txid}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://pay.gateway.example/opencharge/verify/{txid}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
{
  "status": "completed",
  "proof": {
    "txid": "gateway_tx_456",
    "issuer": 300,
    "from": {
      "ocid": 200,
      "reference": "wallet_tx_123"
    },
    "to": {
      "ocid": 500,
      "reference": "ord_xyz789"
    },
    "amount": "99.99",
    "currency": "USD",
    "timestamp": 1706500500,
    "memo": "Payment for ord_xyz789"
  },
  "signature": "a1b2c3..."
}
{
"error": {
"message": "<string>",
"details": {}
}
}
Optional endpoint for merchants to verify payment status. Returns the transaction details and signed proof if the payment is complete.

Use Cases

  • Merchant wants to verify a payment they didn’t receive a webhook for
  • Merchant’s webhook handler failed and needs to recover
  • Auditing and reconciliation

Implementation

app.get('/verify/:txid', async (req, res) => {
  const { txid } = req.params;

  // 1. Find the transaction
  const payment = await db.getPayment(txid);
  if (!payment) {
    return res.status(404).json({
      error: { code: 'TXID_NOT_FOUND', message: 'Transaction not found' }
    });
  }

  // 2. Build response based on status
  if (payment.status === 'pending_settlement') {
    return res.json({
      status: 'pending',
      txid: payment.txid,
      amount: payment.amount,
      currency: payment.currency,
      createdAt: payment.createdAt,
      expiresAt: payment.expiresAt
    });
  }

  if (payment.status === 'completed') {
    // Reconstruct the proof
    const proof = {
      txid: payment.txid,
      issuer: YOUR_OCID,
      from: payment.from,
      to: { ocid: payment.merchantOcid, reference: payment.orderId },
      amount: payment.amount,
      currency: payment.currency,
      timestamp: payment.completedAt,
      memo: payment.memo
    };

    const signature = signProof(proof);

    return res.json({
      status: 'completed',
      proof,
      signature
    });
  }

  // Handle other statuses (failed, expired, etc.)
  res.json({
    status: payment.status,
    txid: payment.txid
  });
});

Response Examples

Completed payment:
{
  "status": "completed",
  "proof": {
    "txid": "gateway_tx_456",
    "issuer": 300,
    "from": { "ocid": 200, "reference": "wallet_tx_123" },
    "to": { "ocid": 500, "reference": "ord_abc123" },
    "amount": "99.99",
    "currency": "USD",
    "timestamp": 1706500500
  },
  "signature": "a1b2c3..."
}
Pending payment:
{
  "status": "pending",
  "txid": "gateway_tx_456",
  "amount": "99.99",
  "currency": "USD",
  "createdAt": 1706500000,
  "expiresAt": 1706503600
}
Failed/expired:
{
  "status": "expired",
  "txid": "gateway_tx_456"
}

Path Parameters

txid
string
required

The transaction ID to verify

Response

Transaction verified

status
enum<string>
required
Available options:
completed,
pending,
failed
proof
object
required
signature
string
required