Skip to main content
GET
/
v3
/
ocpay
/
checkPayment
/
:ref
curl --request GET \
  --url https://api.oneclickdz.com/v3/ocpay/checkPayment/OCPL-A1B2C3-D4E5 \
  --header 'X-Access-Token: YOUR_API_KEY'
{
  "success": true,
  "data": {
    "status": "CONFIRMED",
    "message": "Payment confirmed successfully",
    "paymentRef": "OCPL-A1B2C3-D4E5",
    "transactionDetails": {
      "amount": 5000,
      "currency": "DZD",
      "isSandbox": false,
      "createdDate": "2025-01-15T10:30:00Z"
    }
  },
  "meta": {
    "timestamp": "2025-01-15T10:35:00Z",
    "requestId": "req_abc123xyz"
  }
}

Overview

Check payment status in real-time using the payment reference. Essential for order processing, status polling, and payment verification.
Automatic Environment Detection: This endpoint automatically checks both production (SATIM) and sandbox transactions based on where the payment was created.

Path Parameters

ref
string
required
Payment reference code (format: OCPL-XXXXXX-YYYY) Examples: - OCPL-A1B2C3-D4E5 - OCPL-123456-7890
This is the paymentRef returned when you created the payment link

Response

success
boolean
Indicates if the operation was successful
data
object
Payment status information
meta
object
Response metadata

Status Values Explained

When you see this:
  • Customer hasn’t started the payment process yet
  • Payment is currently being processed by the bank
  • Link was just created and not yet used
What to do:
  • Continue polling for status updates
  • Display “Payment pending” to customer
  • Don’t fulfill the order yet
When you see this: - Payment completed successfully - Funds will be credited to your OneClick balance What to do: - Mark order as paid in your system - Fulfill the order/provide service - Send confirmation to customer
When you see this:
  • Payment was declined or failed
  • Payment link expired (20 minutes)
  • Customer cancelled the payment
What to do:
  • Mark order as failed/cancelled
  • Create a new payment link if customer wants to retry
  • Don’t fulfill the order
Payment links expire 20 minutes after creation if no payment is initiated. After expiration, the status will be FAILED.
curl --request GET \
  --url https://api.oneclickdz.com/v3/ocpay/checkPayment/OCPL-A1B2C3-D4E5 \
  --header 'X-Access-Token: YOUR_API_KEY'
{
  "success": true,
  "data": {
    "status": "CONFIRMED",
    "message": "Payment confirmed successfully",
    "paymentRef": "OCPL-A1B2C3-D4E5",
    "transactionDetails": {
      "amount": 5000,
      "currency": "DZD",
      "isSandbox": false,
      "createdDate": "2025-01-15T10:30:00Z"
    }
  },
  "meta": {
    "timestamp": "2025-01-15T10:35:00Z",
    "requestId": "req_abc123xyz"
  }
}

Integration Example

Here’s how to implement status checking in your order system:
async function checkOrderPayment(orderId) {
  // Get payment ref from your database
  const order = await db.orders.findOne({ id: orderId });

  if (!order || !order.paymentRef) {
    throw new Error("Order not found or no payment link");
  }

  // Check payment status
  const response = await fetch(
    `https://api.oneclickdz.com/v3/ocpay/checkPayment/${order.paymentRef}`,
    {
      headers: { "X-Access-Token": process.env.ONECLICK_API_KEY },
    }
  );

  const data = await response.json();

  // Update order status based on payment status
  switch (data.data.status) {
    case "CONFIRMED":
      await db.orders.update(orderId, {
        status: "paid",
        paidAt: new Date(),
      });
      // Fulfill order
      await fulfillOrder(orderId);
      break;

    case "FAILED":
      await db.orders.update(orderId, {
        status: "payment_failed",
      });
      break;

    case "PENDING":
      // Keep polling
      break;
  }

  return data.data;
}

Next Steps