---
updatedAt: 2026-09-29T09:21:32.000Z
agentTools:
  projectIndex: https://valorapi.readme.io/llms.txt
---

# 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

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

### Response fields

| Field         | Type   | Description                                                                                      |
| ------------- | ------ | ------------------------------------------------------------------------------------------------ |
| `error_no`    | string | `S00` indicates the token was created successfully                                               |
| `error_code`  | string | Gateway error code. `00` = no error                                                              |
| `clientToken` | string | Short-lived client token used to initialize the payment page or tokenization widget              |
| `validity`    | string | Token expiry timestamp in `YYYY-MM-DD HH:MM:SS` format. The token cannot be used after this time |

***

### Response — 400 (Processing Error)

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

### Response fields

| Field      | Type   | Description                             |
| ---------- | ------ | --------------------------------------- |
| `error_no` | string | `D07` indicates an invalid App Key      |
| `mesg`     | string | Error message                           |
| `msg`      | string | Error message                           |
| `desc`     | string | Detailed description of the error cause |

***

### Error code reference

| `error_no` | Meaning          | Typical cause                      |
| ---------- | ---------------- | ---------------------------------- |
| `S00`      | Success          | Client token generated             |
| `D07`      | Processing error | App 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.

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

### Response fields

| Field        | Type           | Description                                                  |
| ------------ | -------------- | ------------------------------------------------------------ |
| `error_no`   | string         | `S00` indicates the card was tokenized successfully          |
| `error_code` | string         | `S00` mirrors `error_no` on success                          |
| `cardToken`  | string         | Partially masked reusable card token for future transactions |
| `card_brand` | string         | Card network (e.g. `Visa`, `Mastercard`)                     |
| `card_type`  | string         | Card type — `D` = Debit, `C` = Credit                        |
| `response`   | string \| null | Additional 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.

```json
{
  "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

| Field             | Type   | Description                                                  |
| ----------------- | ------ | ------------------------------------------------------------ |
| `error_no`        | string | `S00` — the request was processed, but the card was declined |
| `error_code`      | string | `E98` when the card was declined by the issuer               |
| `response`        | string | Short description of the decline reason                      |
| `switch_response` | object | Full switch-level decline details (see below)                |

### `switch_response` fields

| Field               | Type           | Description                                         |
| ------------------- | -------------- | --------------------------------------------------- |
| `error_no`          | string         | `E98` indicates a declined transaction              |
| `error_code`        | string         | Issuer decline code (e.g. `54` = card expired)      |
| `success_url`       | boolean        | Always `false` for declined operations              |
| `txnid`             | string \| null | Transaction identifier; `null` when not assigned    |
| `batch_no`          | integer        | Settlement batch identifier                         |
| `switch_error_code` | string         | Switch-level error code                             |
| `mesg`              | string         | Error message                                       |
| `desc`              | string         | Detailed error description                          |
| `msg`               | string         | Error message                                       |
| `isFlexSendOrNot`   | string         | Flex 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)

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

### Response fields

| Field      | Type   | Description                                   |
| ---------- | ------ | --------------------------------------------- |
| `error_no` | string | `91` indicates a configuration or input error |
| `mesg`     | string | Error category                                |
| `msg`      | string | Error message                                 |
| `desc`     | string | Detailed description of the error cause       |

***

### Error code reference

| `error_no` | `error_code` | Meaning          | Typical cause                                |
| ---------- | ------------ | ---------------- | -------------------------------------------- |
| `S00`      | `S00`        | Success          | Card tokenized successfully                  |
| `S00`      | `E98`        | Card declined    | Card expired, invalid, or rejected by issuer |
| `91`       | —            | Processing error | EPI 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)

```json
{
  "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

| Field                | Type           | Description                                                |
| -------------------- | -------------- | ---------------------------------------------------------- |
| `error_no`           | string         | `S00` indicates a successful transaction                   |
| `success_url`        | boolean        | `true` when the transaction is approved                    |
| `error_code`         | string         | Gateway error code. `00` = no error                        |
| `amount`             | string         | Charged amount in decimal format                           |
| `tax`                | string         | Tax amount applied                                         |
| `customfee`          | string         | Custom fee applied to the transaction                      |
| `msg`                | string         | Result (e.g. `APPROVED`)                                   |
| `desc`               | string         | Detailed description including the approval code           |
| `additional_info`    | string \| null | Reserved for additional metadata                           |
| `clerk_id`           | string \| null | Clerk identifier, if provided                              |
| `clerk_name`         | string \| null | Clerk name, if provided                                    |
| `clerk_label`        | string \| null | Clerk label, if provided                                   |
| `additionalKeyOne`   | string \| null | Custom key field 1                                         |
| `additionalKeyTwo`   | string \| null | Custom key field 2                                         |
| `additionalValueOne` | string \| null | Custom value field 1                                       |
| `additionalValueTwo` | string \| null | Custom value field 2                                       |
| `approval_code`      | string         | Issuer-returned authorization code                         |
| `rrn`                | string         | Retrieval reference number for reconciliation              |
| `txnid`              | string         | Unique transaction identifier                              |
| `created_date`       | string         | Transaction date in `DD/MM/YYYY` format                    |
| `created_time`       | string         | Transaction time in `HH:MM:SS` format                      |
| `tran_no`            | integer        | Sequential transaction number within the batch             |
| `stan`               | integer        | System trace audit number                                  |
| `batch_no`           | integer        | Settlement batch identifier                                |
| `is_partial_approve` | integer        | `1` if partially approved; `0` for full approval           |
| `partial_amount`     | string         | Approved amount in zero-padded 12-digit format             |
| `pan`                | string         | Masked card number — last 4 digits shown (e.g. `XXXX1111`) |
| `card_type`          | string \| null | Card type, if returned by the issuer                       |
| `phone_number`       | string         | Cardholder phone number, if provided                       |
| `email_id`           | string         | Cardholder email address, if provided                      |
| `zip`                | string \| null | Billing ZIP code, if provided                              |
| `card_holder_name`   | string         | Name on card, if provided                                  |
| `expiry_date`        | string         | Card expiry. Returns `"/"` when not stored with the token  |
| `address`            | string         | Billing address, if provided                               |
| `epi`                | string         | Merchant terminal / EPI identifier                         |
| `channel`            | string         | Transaction channel (e.g. `ECOMM`)                         |
| `orderdescription`   | string         | Item or order description                                  |
| `invoicenumber`      | string         | Merchant-supplied invoice reference                        |
| `token`              | string         | Partially masked card token used for this transaction      |
| `card_brand`         | string         | Card network (e.g. `Visa`, `Mastercard`)                   |
| `netamt`             | number         | Net amount charged including all fees                      |

***

### Response — 400 (Declined)

```json
{
  "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

| Field               | Type    | Description                                         |
| ------------------- | ------- | --------------------------------------------------- |
| `error_no`          | string  | `E98` indicates a declined transaction              |
| `error_code`        | string  | Decline code (e.g. `V1` = invalid card token)       |
| `success_url`       | boolean | Always `false` for declined transactions            |
| `txnid`             | string  | Transaction identifier (assigned even on decline)   |
| `batch_no`          | integer | Settlement batch identifier                         |
| `switch_error_code` | string  | Switch-level error code returned by the network     |
| `mesg`              | string  | Error message                                       |
| `msg`               | string  | Error message                                       |
| `desc`              | string  | Detailed error description                          |
| `isFlexSendOrNot`   | string  | Flex routing indicator; mirrors `switch_error_code` |

***

### Response — 400 (Processing Error)

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

### Response fields

| Field      | Type   | Description                             |
| ---------- | ------ | --------------------------------------- |
| `error_no` | string | `D06` indicates an invalid App ID       |
| `mesg`     | string | Error message                           |
| `msg`      | string | Error message                           |
| `desc`     | string | Detailed description of the error cause |

***

### Error code reference

| `error_no` | Meaning          | Typical cause                     |
| ---------- | ---------------- | --------------------------------- |
| `S00`      | Approved         | Transaction successful            |
| `E98`      | Declined         | Card token is invalid or expired  |
| `D06`      | Processing error | App ID is invalid or unrecognised |

<br />

<style>
.markdown-body {  
  --markdown-radius: 3px;  
  --markdown-title: #225FAC;  
  --markdown-line-height: 2;  
  padding: 10px;
}

.markdown-body table {
  font-size: 13px;
}

.markdown-body table td,
.markdown-body table th {
  padding: 6px 8px;
}

.markdown-body p {
  font-size: 16px;
}

.markdown-body pre,
.markdown-body code {
  font-size: 13px;
}
</style>