Quick Start

This guide shows the process of performing a payment, using Carat Portal's HTML interface.

What you'll need

  • Active account on Carat Portal's homologation environment (obtained with our support team)
  • A tool capable of performing HTTP calls, such as Postman, REST Client or cURL
  • An application capable of receiving POST HTTPS calls

Creating a payment transaction

HTTP method: POST

URL: https:///e-sitef/init/json.se

Headers:

  • Content-Type: application/x-www-form-urlencoded

POST parameters:

  • Key: request;
  • Value: JSON object;
  • [response_type]: json or xml;

Basic JSON request example:

To use this example, don't forget to define the variable {{url}} to the value

{
  "merchant_id": "xxxxxxxxxx",
  "amount": "1800"
}
curl
--request POST "https://{{url}}/e-sitef/init/json.se"
--header "Content-Type: application/x-www-form-urlencoded"
-d 'request=%7B%22merchant_id%22%3A%22xxxxxxxxxx%22%2C%22amount%22%3A%221800%22%7D'
--verbose

Response:

{
  "responseCode": 0,
  "description": "OK. Transaction successful.",
  "url": "https://{{url}}/e-sitef/do.se?input['nit']=12345678asdfghjk12345678asdfghjk12345678asdfghjk12345678asdfghjk",
  "nsuesitef": "123451234512345",
  "nit": "12345678asdfghjk12345678asdfghjk12345678asdfghjk12345678asdfghjk"
}

Learn more about this service.

Redirecting the user

The store must then redirect the user to the URL returned by Carat Portal in the transaction creation step.

Receiving a status notification

As soon as the transaction status changes, Carat Portal will notify the store with a POST in its registered status URL.

@RestController
public class MyStatusController {

    @PostMapping(value = "/mystatus",
        consumes = "application/x-www-form-urlencoded; charset=utf-8")
    public ResponseEntity<String> myStatus(@RequestParam Map<String, String> request) {
        Log.info("status = " + request.get("status"));
        // ...
        return new ResponseEntity<>("OK", HttpStatus.OK);
    }

}

Below is an example of a request to be made by Carat Portal in the domain registered by the merchant:

curl -X POST \
  https://dominiocadastrado.com.br \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'cache-control: no-cache' \
  -d 'rede=Cielo&tipoFinanciamento=4&binCartao=455182&nsuesitef=191107123456780&tid=authorizerTransactionId12345678901234567&parcelas=2&nsu=merchantNsu&autorizadora=1&nit=nitWith64charsLike1234567890123456789012345678901234567890123457&pedido=orderId1234&tipoPagamento=C&finalCartao=2345&status=NEG'

Learn more about this service.