Passage.js API Sample Responses

Provides example success and error responses to help understand the passage API response structure and handling.

Create Page Token

Generate a short-lived client token used to initialize the hosted payment page or tokenization widget. This token must be obtained before rendering the payment form.


Response — 200 OK

{
  "error_no": "S00",
  "error_code": "00",
  "clientToken": "0bc8b3***********160ad",
  "validity": "2026-04-29 05:17:40"
}

Response fields

FieldTypeDescription
error_nostringS00 indicates the token was created successfully
error_codestringGateway error code. 00 = no error
clientTokenstringShort-lived client token used to initialize the payment page or tokenization widget
validitystringToken expiry timestamp in YYYY-MM-DD HH:MM:SS format. The token cannot be used after this time

Response — 400 (Processing Error)

{
  "error_no": "D07",
  "mesg": "PROCESSING ERROR",
  "msg": "PROCESSING ERROR",
  "desc": "NOT A VALID APP KEY"
}

Response fields

FieldTypeDescription
error_nostringD07 indicates an invalid App Key
mesgstringError message
msgstringError message
descstringDetailed description of the error cause

Error code reference

error_noMeaningTypical cause
S00SuccessClient token generated
D07Processing errorApp Key is invalid or unrecognised

Create Card Token

Tokenize a card using the client token obtained from the Create Page Token endpoint. Returns a reusable card token that can be used for future transactions without re-entering card details.


Response — 200 OK (Token Created)

Card was successfully validated and tokenized.

{
  "error_no": "S00",
  "error_code": "S00",
  "cardToken": "D554**********0FB670",
  "card_brand": "Visa",
  "card_type": "D",
  "response": null
}

Response fields

FieldTypeDescription
error_nostringS00 indicates the card was tokenized successfully
error_codestringS00 mirrors error_no on success
cardTokenstringPartially masked reusable card token for future transactions
card_brandstringCard network (e.g. Visa, Mastercard)
card_typestringCard type — D = Debit, C = Credit
responsestring | nullAdditional response message; null on success

Response — 200 OK (Card Declined)

Card was presented but declined by the issuer during tokenization validation. The outer error_no indicates the overall status; the switch_response object contains the detailed decline reason.

{
  "error_no": "S00",
  "error_code": "E98",
  "response": "Error code :54",
  "switch_response": {
    "error_no": "E98",
    "error_code": "54",
    "success_url": false,
    "txnid": null,
    "batch_no": 136,
    "switch_error_code": "V0548",
    "mesg": "Card expired",
    "desc": "Error code :54",
    "msg": "Card expired",
    "isFlexSendOrNot": "V0548"
  }
}

Response fields

FieldTypeDescription
error_nostringS00 — the request was processed, but the card was declined
error_codestringE98 when the card was declined by the issuer
responsestringShort description of the decline reason
switch_responseobjectFull switch-level decline details (see below)

switch_response fields

FieldTypeDescription
error_nostringE98 indicates a declined transaction
error_codestringIssuer decline code (e.g. 54 = card expired)
success_urlbooleanAlways false for declined operations
txnidstring | nullTransaction identifier; null when not assigned
batch_nointegerSettlement batch identifier
switch_error_codestringSwitch-level error code
mesgstringError message
descstringDetailed error description
msgstringError message
isFlexSendOrNotstringFlex routing indicator; mirrors switch_error_code

Important: A card decline response still returns HTTP 200 with outer error_no: "S00". Always check error_code — if it is E98, the card was declined. Read switch_response for the full decline reason.


Response — 400 (Processing Error)

{
  "error_no": "91",
  "mesg": "ERROR: CARD TOKEN",
  "msg": "ERROR: CARD TOKEN",
  "desc": "INVALID EPI PROVIDED"
}

Response fields

FieldTypeDescription
error_nostring91 indicates a configuration or input error
mesgstringError category
msgstringError message
descstringDetailed description of the error cause

Error code reference

error_noerror_codeMeaningTypical cause
S00S00SuccessCard tokenized successfully
S00E98Card declinedCard expired, invalid, or rejected by issuer
91Processing errorEPI provided is invalid or does not exist

Sale API

Process a sale using a card token obtained from the Create Card Token endpoint.


Response — 200 OK (Approved)

{
  "error_no": "S00",
  "success_url": true,
  "error_code": "00",
  "amount": "20.00",
  "tax": "1.02",
  "customfee": "1",
  "msg": "APPROVED",
  "desc": "APPROVAL TAS678",
  "additional_info": null,
  "clerk_id": null,
  "clerk_name": null,
  "clerk_label": null,
  "additionalKeyOne": null,
  "additionalKeyTwo": null,
  "additionalValueOne": null,
  "additionalValueTwo": null,
  "approval_code": "TAS678",
  "rrn": "611905501102",
  "txnid": "10337052",
  "created_date": "29/04/2026",
  "created_time": "01:14:45",
  "tran_no": 1,
  "stan": 724387,
  "batch_no": 136,
  "is_partial_approve": 0,
  "partial_amount": "000000002000",
  "pan": "XXXX1111",
  "card_type": null,
  "phone_number": "",
  "email_id": "",
  "zip": null,
  "card_holder_name": "",
  "expiry_date": "/",
  "address": "",
  "epi": "2319923425",
  "channel": "ECOMM",
  "orderdescription": "king size bed 10x12",
  "invoicenumber": "inv0001",
  "token": "AD21*************E0C594",
  "card_brand": "Visa",
  "netamt": 22.02
}

Response fields

FieldTypeDescription
error_nostringS00 indicates a successful transaction
success_urlbooleantrue when the transaction is approved
error_codestringGateway error code. 00 = no error
amountstringCharged amount in decimal format
taxstringTax amount applied
customfeestringCustom fee applied to the transaction
msgstringResult (e.g. APPROVED)
descstringDetailed description including the approval code
additional_infostring | nullReserved for additional metadata
clerk_idstring | nullClerk identifier, if provided
clerk_namestring | nullClerk name, if provided
clerk_labelstring | nullClerk label, if provided
additionalKeyOnestring | nullCustom key field 1
additionalKeyTwostring | nullCustom key field 2
additionalValueOnestring | nullCustom value field 1
additionalValueTwostring | nullCustom value field 2
approval_codestringIssuer-returned authorization code
rrnstringRetrieval reference number for reconciliation
txnidstringUnique transaction identifier
created_datestringTransaction date in DD/MM/YYYY format
created_timestringTransaction time in HH:MM:SS format
tran_nointegerSequential transaction number within the batch
stanintegerSystem trace audit number
batch_nointegerSettlement batch identifier
is_partial_approveinteger1 if partially approved; 0 for full approval
partial_amountstringApproved amount in zero-padded 12-digit format
panstringMasked card number — last 4 digits shown (e.g. XXXX1111)
card_typestring | nullCard type, if returned by the issuer
phone_numberstringCardholder phone number, if provided
email_idstringCardholder email address, if provided
zipstring | nullBilling ZIP code, if provided
card_holder_namestringName on card, if provided
expiry_datestringCard expiry. Returns "/" when not stored with the token
addressstringBilling address, if provided
epistringMerchant terminal / EPI identifier
channelstringTransaction channel (e.g. ECOMM)
orderdescriptionstringItem or order description
invoicenumberstringMerchant-supplied invoice reference
tokenstringPartially masked card token used for this transaction
card_brandstringCard network (e.g. Visa, Mastercard)
netamtnumberNet amount charged including all fees

Response — 400 (Declined)

{
  "error_no": "E98",
  "error_code": "V1",
  "success_url": false,
  "txnid": "10337055",
  "batch_no": 136,
  "switch_error_code": "V0605",
  "mesg": "Invalid card token",
  "desc": "Error code :V1",
  "msg": "Invalid card token",
  "isFlexSendOrNot": "V0605"
}

Response fields

FieldTypeDescription
error_nostringE98 indicates a declined transaction
error_codestringDecline code (e.g. V1 = invalid card token)
success_urlbooleanAlways false for declined transactions
txnidstringTransaction identifier (assigned even on decline)
batch_nointegerSettlement batch identifier
switch_error_codestringSwitch-level error code returned by the network
mesgstringError message
msgstringError message
descstringDetailed error description
isFlexSendOrNotstringFlex routing indicator; mirrors switch_error_code

Response — 400 (Processing Error)

{
  "error_no": "D06",
  "mesg": "PROCESSING ERROR",
  "msg": "PROCESSING ERROR",
  "desc": "NOT A VALID APP ID"
}

Response fields

FieldTypeDescription
error_nostringD06 indicates an invalid App ID
mesgstringError message
msgstringError message
descstringDetailed description of the error cause

Error code reference

error_noMeaningTypical cause
S00ApprovedTransaction successful
E98DeclinedCard token is invalid or expired
D06Processing errorApp ID is invalid or unrecognised