Recharge creation service
#
Authenticity POST x signatureCarat Portal has two methods of merchant authentication on the REST recharge interface: authenticity POST or signature.
In the authenticity POST method, Carat Portal will send the data of the newly created recharge transaction to the registered authenticity URL of the merchant.
In the signature method, the merchant must have a public RSA encryption key registered on Carat Portal and prepare a JWT signature (JSON Web Tokens) to be sent in the Authorization
header. In this case, the recharge transaction information will be returned directly in the response. Learn more.
#
Call details- Resource:
/v3/recharge
- HTTP Method:
POST
- Request format:
JSON
- Response format:
JSON
- Header parameters:
Parameter | Description | Format | Mandatory |
---|---|---|---|
Content-Type | It must be sent with the value application/json . | = 15 AN | YES |
Authorization | Merchant's signature in the Bearer {signature} format. Example: Bearer JHVGytfdgauygdauiw78264284527852897hagdg . | < 2000 AN | NO |
#
ExamplesBelow are some examples of the recharge creation service call using the cURL tool.
#
Creating a recharge transaction sending all parametersRequest:
To use this example, don't forget to define the variable {{url}}
with the value
esitef-homologacao.softwareexpress.com.br
Response:
Authenticity POST:
To use this example, don't forget to define the variable {{url}}
with the value
esitef-homologacao.softwareexpress.com.br
#
Creating a recharge transaction sending only the required parametersRequest:
To use this example, don't forget to define the variable {{url}}
with the value
esitef-homologacao.softwareexpress.com.br
Response:
#
Creating a recharge transaction with signatureRequest:
To use this example, don't forget to define the variable {{url}}
with the value
esitef-homologacao.softwareexpress.com.br
Response:
#
Request parametersThe table below describes the request parameters of the recharge creation service:
Parameter | Description | Format | Mandatory |
---|---|---|---|
merchant_key | Merchant key registered on Carat Portal | < 80 A | YES |
merchant_usn | Unique sequential number generated by the merchant | < 12 N | NO |
order_id | Order identification code generated by the merchant | < 20 AN | NO |
general_hash | Identification code of the table with the data related to the recharges (dealers, branches, amount ranges, expiration periods, among others). If the store hadn't performed a recharge previously or hadn't saved a previously received value from Carat Portal, the value: 0000000000000000 can be passed to Carat Portal. If the general_hash is not sent, the store will be obliged to make all queries to obtain the data necessary for the next steps of the recharge. | = 16 A | NO |
recharge_type | Type of the recharge to be performed. Values:
normal | = 6 A | NO |
#
Response parametersIn case of success, the HTTP response code will be 200
. Any other code must be interpreted as an error. The table below describes de response parameters of the recharge creation service:
Parameter | Description | Format |
---|---|---|
nit | Identification of the recharge transaction on Carat Portal | = 64 AN |
merchant_id | Merchant ID on Carat Portal | < 15 AN |
order_id | Order code generated by the merchant | < 20 AN |
merchant_usn | Unique sequential number generated by the merchant | < 12 N |
general_hash | Identification code of the table with the data related to the recharges (carriers, subsidiaries, ranges of values, validity of credits, among others). | = 16 AN |
esitef Element that describes Carat Portal's response. | ||
code | Carat Portal response code. Any code different from 0 (zero) means failure. Learn more. | < 4 N |
message | Carat Portal response message. | < 500 AN |
#
Authenticity POST parametersThe table below describes the parameters sent by Carat Portal on the authenticity POST:
Parameter | Description | Format |
---|---|---|
nit | Identifier of the cancel transaction to be used in the next step of the flow. | = 64 AN |
merchantId | Merchant code on Carat Portal. | < 15 AN |
orderId | Order ID of the payment created by merchant | < 20 AN |
merchantUSN | USN generated by the merchant for the payment | < 12 N |
generalHash | Identification code of the table with the data related to the recharges (dealers, branches, amount ranges, expiration periods, among others). | = 16 AN |
Carat Portal can also send new parameters without previous warning, which means that the merchant’s application must be prepared to receive extra fields and just ignore them.
#
Parameters sent by Carat Portal on HTTPS POSTImportant:
Carat Portal uses the
x-www-form-urlencoded
media type to send the HTTPS POST. Therefore, the server must accept this type of media on the merchant's registered URL to receive POST HTTPS.
Parameter | Description | Format |
---|---|---|
nit | Identification of the recharge transaction on Carat Portal | = 64 AN |
merchantId | Merchant ID on Carat Portal | < 15 AN |
orderId | Order code generated by the merchant | < 20 AN |
merchantUSN | Unique sequential number generated by the merchant | < 12 N |
generalHash | Identification code of the table with the data related to the recharges (carriers, subsidiaries, ranges of values, validity of credits, among others). | = 16 AN |