Card Void

Void (cancel) a recently completed card transaction. Voids are typically available only within the same batch/settlement period.


Example

var sid = FawrySDK.generateSessionId();
var clientTimeStamp = Date.now();

// Get signature from your backend (no amount needed for void)
var sigResponse = await fetch('/api/generate-signature', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
        merchantAccountNumber: 'YOUR_ACCOUNT_NUMBER',
        sid: sid,
        clientTimeStamp: clientTimeStamp,
    }),
});
var sigData = await sigResponse.json();

try {
    var result = await FawrySDK.requestVoid(FawrySDK.PaymentOptionType.CARD)
        .setTransactionFCRN('ORIGINAL_FCRN_HERE')
        .setSignature(sigData.signature)
        .setSid(sid)
        .setClientTimeStamp(clientTimeStamp)
        .setPartnerCode('YOUR_PARTNER_CODE')
        .setMerchantAccountNumber('YOUR_ACCOUNT_NUMBER')
        .setBtc(99901)
        .send();

    if (result.isSuccess()) {
        console.log('Void successful!');
    }
} catch (error) {
    console.error('Void failed:', error.message);
}

Parameters

Parameter Method Required Description
Transaction FCRN setTransactionFCRN() No FCRN of the transaction to void
Order ID setOrderId() No Order/reference ID
Split Payment setSplitPayment() No Enable split payment void
Chain UID setChainUID() No Chain UID for split payments

Plus all common builder methods (signature, sid, timestamp, setBtc, optional setPrintReceipt / setDisplayInvoice — default false, etc.).


Successful void

A successful void returns statusCode: 3 (REVERSED), which result.isSuccess() recognizes as success.

result.isSuccess()                    // true when statusCode is 1 or 3
result.header.status.statusCode       // 3 (REVERSED)
result.header.status.statusDesc       // 'reversed'

Example successful response

{
  "header": {
    "messageCode": "void",
    "status": {
      "statusCode": 3,
      "statusDesc": "reversed",
      "hostStatusCode": 0,
      "hostStatusDesc": "Voided"
    }
  },
  "body": {
    "fcrn": "FCRN-VOID-001"
  }
}

Example failed response

{
  "header": {
    "messageCode": "void",
    "status": {
      "statusCode": 0,
      "statusDesc": "failed",
      "hostStatusDesc": "Void not allowed"
    }
  },
  "body": {}
}

Back to top

© Fawry Payment Solutions. All rights reserved.

This site uses Just the Docs, a documentation theme for Jekyll.