---
updatedAt: 2026-10-27T08:50:31.000Z
---

# Virtual Store's Payment Page

The merchant's payment page must contain the Carat Portal's script. Below are the URL's for download:

**URL for Production environment:**\ <br/>\
https\://<URLPOSTMANPROD/>/js/esitefpayment-1.0.min.js

**URL for Homologation environment:**\ <br/>\
https\://<URLPOSTMAN/>/js/esitefpayment-1.0.min.js

## Fields with card data

The card fields must contain the classes specified below:

[block:parameters]
{
  "data": {
    "h-0": "Parameter",
    "h-1": "Description",
    "h-2": "Format",
    "h-3": "Mandatory",
    "0-0": "`esitef-cardnumber`",
    "0-1": "Customer's card number (PAN).",
    "0-2": "<u>\\<</u> 19 N",
    "0-3": "YES",
    "1-0": "`esitef-cardexpirydate`",
    "1-1": "Card expiry date in `MMYY` format.",
    "1-2": "= 4 N",
    "1-3": "YES",
    "2-0": "`esitef-cardexpirymonth`<br/>& `esitef-cardexpiryyear`",
    "2-1": "Card expiry month and year, in `MM` and `YY` format, respectively. These fields can be sent instead of `esitef-cardexpirydate`. If all these fields are sent at the same time, the split date (`esitef-cardexpirymonth` and `esitef-cardexpiryyear`) will have priority.",
    "2-2": "= 2 N",
    "2-3": "YES",
    "3-0": "`esitef-cardsecuritycode`",
    "3-1": "Card security code.",
    "3-2": "<u>\\<</u> 5 N",
    "3-3": "YES",
    "4-0": "`esitef-cardholder`",
    "4-1": "Card holder name. <FISERV noTags>Only mandatory for payments with e-Rede, GetNet WS and VR (SmartNet).</FISERV>",
    "4-2": "<u>\\<</u> 30 AN",
    "4-3": "COND."
  },
  "cols": 4,
  "rows": 5,
  "align": [
    null,
    null,
    "center",
    "center"
  ]
}
[/block]

## Calling Carat Portal's script

When the customer fills the card data and clicks "pay", the merchant's page must call the `esitefDoPayment` JavaScript function, passing as argument a request with the following fields:

[block:parameters]
{
  "data": {
    "h-0": "Parameter",
    "h-1": "Description",
    "h-2": "Format",
    "h-3": "Mandatory",
    "0-0": "`nit`",
    "0-1": "Transaction identification in Carat Portal. The field `nit` received by the transaction creation service.",
    "0-2": "= 64 AN",
    "0-3": "YES",
    "1-0": "`payToken`",
    "1-1": "The field `pay_token` received by the transaction creation service. This token can only be used once.",
    "1-2": "= 66 AN",
    "1-3": "YES",
    "2-0": "`merchantId`",
    "2-1": "Merchant code on Carat Portal. The production and certification codes will be different.",
    "2-2": "<u>\\<</u> 15 AN",
    "2-3": "YES",
    "3-0": "`locale`",
    "3-1": "Language of the messages returned in validation errors (`onInvalid` callback). It can receive the following values: <br/>`pt` - Portuguese <br/> `en` - English <br/> `es` - Spanish <br/> If the locale is not sent, `pt` will be used.",
    "3-2": "= 2 A",
    "3-3": "NO",
    "4-0": "`isCardSecurityCode`<br/> `Optional`",
    "4-1": "Defines if the card security code will be validated as a mandatory or optional field. Send `true` if it's an optional field. If this field is not sent, the value `false` will be used (mandatory security code).",
    "4-2": "<u>\\<</u> 5 T/F",
    "4-3": "NO",
    "5-0": "`onSuccess`",
    "5-1": "Callback function the will be called after a successful payment on Carat Portal. This function receives as argument the payment response described in [Success and failure callbacks response.](#success-and-failure-callbacks-response)",
    "5-2": "F",
    "5-3": "YES",
    "6-0": "`onFailure`",
    "6-1": "Callback function the will be called after an unsuccessful payment on Carat Portal. This function receives as argument the payment response described in [Success and failure callbacks response.](#success-and-failure-callbacks-response)",
    "6-2": "F",
    "6-3": "YES",
    "7-0": "`onInvalid`",
    "7-1": "Callback function that will be called after a JavaScript validation error. This function receives as argument the error list described in [Validation error callback response](#validation-error-callback-response)",
    "7-2": "F",
    "7-3": "YES"
  },
  "cols": 4,
  "rows": 8,
  "align": [
    null,
    null,
    "center",
    "center"
  ]
}
[/block]

## Success and failure callbacks response

The `onSuccess` and `onFailure` callback functions receive as argument an object containing information related to the payment. Below are the descriptions of these fields:

[block:parameters]
{
  "data": {
    "h-0": "Parameter",
    "h-1": "Description",
    "h-2": "Format",
    "0-0": "`code`",
    "0-1": "Carat Portal response code. Any code different from `0` (zero) means failure. For further information, refer to the [Response codes.](codigos-da-api#response-codes)",
    "0-2": "<u>\\<</u> 4 N",
    "1-0": "`message`",
    "1-1": "Carat Portal response message.",
    "1-2": "<u>\\<</u> 500 AN",
    "2-0": "**payment**",
    "3-0": "`authorizer_code`",
    "3-1": "Authorizer response code.",
    "3-2": "<u>\\<</u> 10 AN",
    "4-0": "`authorizer_message`",
    "4-1": "Authorizer response message.",
    "4-2": "<u>\\<</u> 500 AN",
    "5-0": "`status`",
    "5-1": "Status of the payment transaction on Carat Portal.",
    "5-2": "= 3 AN",
    "6-0": "`nit`",
    "6-1": "Identifier of the payment transaction on Carat Portal.",
    "6-2": "= 64 AN",
    "7-0": "`order_id`",
    "7-1": "Order code sent by the merchant on the creation of the transaction.",
    "7-2": "<u>\\<</u> 40 AN",
    "8-0": "`customer_receipt`",
    "8-1": "Customer's receipt.",
    "8-2": "<u>\\<</u> 4000 AN",
    "9-0": "`authorizer_id`",
    "9-1": "Code of the authorizer used on the transaction.",
    "9-2": "<u>\\<</u> 4 N"
  },
  "cols": 3,
  "rows": 10,
  "align": [
    null,
    null,
    "center"
  ]
}
[/block]

## Validation error callback response

The `onInvalid` callback function receives as argument a list of error objects, containing the fields below:

[block:parameters]
{
  "data": {
    "h-0": "Parameter",
    "h-1": "Description",
    "h-2": "Format",
    "0-0": "`field`",
    "0-1": "Name of the field in error.",
    "0-2": "<u>\\<</u> 30 AN",
    "1-0": "`cause`",
    "1-1": "Error message.",
    "1-2": "<u>\\<</u> 100 AN"
  },
  "cols": 3,
  "rows": 2,
  "align": [
    null,
    null,
    "center"
  ]
}
[/block]

## Example

Below is an example of a page integrated with Carat Portal's JavaScript payment:

To use this example, don't forget to define the variable `{{url}}` to the value<br/> **<URLPOSTMAN/>**

```html
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <script
      type="text/javascript"
      src="https://{{url}}/js/esitefpayment-1.0.min.js"
    ></script>
    <script>
      function myPay() {
          var request = {
              onSuccess: function(response) {
                  console.log(response.code);
                  console.log(response.message);
                  console.log(response.payment.authorizer_code);
                  console.log(response.payment.authorizer_message);
                  console.log(response.payment.status);
                  console.log(response.payment.nit);
                  console.log(response.payment.order_id);
                  console.log(response.payment.customer_receipt);
                  console.log(response.payment.authorizer_id);
              },
              onFailure: function(response) {
                  console.log(response.code);
                  console.log(response.message);
                  console.log(response.payment.authorizer_code);
                  console.log(response.payment.authorizer_message);
                  console.log(response.payment.status);
                  console.log(response.payment.nit);
                  console.log(response.payment.order_id);
                  console.log(response.payment.authorizer_id);
              },
              onInvalid: function(errors) {
                  for (var i = 0; i < errors.length; i++) {
                      console.log(errors[i].field);
                      console.log(errors[i].cause);
                  }
              },
              nit: ‘1234567890123456789012345678901234567890123456789012345678901234',
              payToken: ‘123456789012345678901234567890123456789012345678901234567890123456',
              merchantId: 'xxxxxxxx',
              locale: 'pt',
              isCardSecurityCodeOptional: false
          };
          esitefDoPayment(request);
      }
    </script>
  </head>

  <body>
    <form method="POST">
      <input type="text" class="esitef-cardnumber" />
      <input type="text" class="esitef-cardexpirymonth" />
      <input type="text" class="esitef-cardexpiryyear" />
      <input type="text" class="esitef-cardsecuritycode" />
      <input type="button" onclick="myPay()" />
    </form>
  </body>
</html>
```