PayOrc
Manage Payment

Void

Void an authorized payment to cancel it before capture.

Void

Version: 3.0.0

Prerequisite: Void only works on transactions that are authorized but not yet fully captured. If the payment has already been captured, use Refund instead. Void must also be enabled on your MID (allowVoid).

When and Why to Use Void

Use Void to cancel an authorization before funds are settled:

  1. Customer cancels before shipping.
  2. Fraud or suspicious activity detected before capture.
  3. Duplicate authorization created by mistake.
  4. You will not capture and want to release the card hold.

Void vs Refund:

  • Void — Cancels an authorization before capture. No money moves.
  • Refund — Returns money after capture.

You cannot void a captured transaction.

Endpoint

Void, Capture, and Refund share the same Manage Payment endpoint — only action changes.

MethodURL
POSThttps://api.payorc.com/orders/v1/transaction

Please use the test credentials for sandbox testing.


Headers

FieldTypeRequiredDescription
merchant-keyStringYesYour merchant API key
merchant-secretStringYesYour merchant API secret
Content-TypeStringYesMust be application/json

Request Body

The request body is flat (not nested under data).

FieldTypeRequiredDescription
actionStringYesMust be VOID
transaction_idStringYesPayOrc transaction ID to void
amountObjectYesAmount object
amount.currencyCodeStringYesISO currency code (e.g. AED)
amount.valueNumberYesAmount to void
reasonStringNoMerchant notes

Code Examples

Example 1 — Void cancelled order

curl --location 'https://api.payorc.com/orders/v1/transaction' \
--header 'merchant-key: {merchant-key}' \
--header 'merchant-secret: {merchant-secret}' \
--header 'Content-Type: application/json' \
--data '{
    "action": "VOID",
    "transaction_id": "1000010118",
    "amount": {
        "currencyCode": "AED",
        "value": 150.00
    },
    "reason": "Customer cancelled order before shipment"
}'

Example 2 — Node.js

const axios = require('axios');

const config = {
  method: 'post',
  url: 'https://api.payorc.com/orders/v1/transaction',
  headers: {
    'merchant-key': '{merchant-key}',
    'merchant-secret': '{merchant-secret}',
    'Content-Type': 'application/json'
  },
  data: {
    action: 'VOID',
    transaction_id: '1000010118',
    amount: {
      currencyCode: 'AED',
      value: 200.00
    },
    reason: 'Order cancelled by customer'
  }
};

axios(config)
  .then(response => console.log(JSON.stringify(response.data)))
  .catch(error => console.log(error.response?.data || error));

Example 3 — Python

import requests
import json

url = 'https://api.payorc.com/orders/v1/transaction'

payload = {
    "action": "VOID",
    "transaction_id": "1000010118",
    "amount": {
        "currencyCode": "AED",
        "value": 1.00
    },
    "reason": "Cleaning up test authorization"
}

headers = {
    'merchant-key': '{merchant-key}',
    'merchant-secret': '{merchant-secret}',
    'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, json=payload)
print(json.dumps(response.json(), indent=2))

Response — Success (200)

{
    "data": {
        "status": "VOID",
        "m_order_id": "ORD-2024-001",
        "p_order_id": 1000010228,
        "transaction_id": 1000010223,
        "amount": "150.00",
        "currency": "AED",
        "date": "04/08/2023"
    },
    "message": "Transaction successfully void.",
    "status": "success",
    "code": "00"
}

Capture, Void, and Refund share the same data shape: status, m_order_id, p_order_id, transaction_id, amount, currency, date.

Response — Error

{
    "message": "Transaction can't be void, already voided or not in state of to be void",
    "status": "fail",
    "code": "E0044"
}

Void vs Refund — Decision Guide

AspectVoidRefund
When to useAuthorization not yet capturedPayment already captured
Money movementReleases the holdReturns money to customer
MID requirementallowVoid enabledallowRefunds enabled
Typical use caseCancel / fraud before captureReturn after capture

On this page