Quick start

Creating a transaction#

HTTP method: POST

URL: https://esitef-homologacao.softwareexpress.com.br/e-sitef/api/v1/store

Headers:

  • Content-Type: application/json
  • merchant_id: {your merchant id}
  • merchant_key: {your merchant key}

Request:

To use this example, don't forget to define the variable {{url}} to the value
esitef-homologacao.softwareexpress.com.br

{
"merchant_usn": "16013439434",
"customer_id": "11122211122"
}
curl
--request POST "https://{{url}}/e-sitef/api/v1/store"
--header "Content-Type: application/json"
--header "merchant_id: xxxxxxxxxxx"
--header "merchant_key: xxxxxxxxxxx"
--data-binary
{
"merchant_usn":"16013439434",
"customer_id":"11122211122"
}
--verbose

Response:

{
"code": "0",
"message": "OK. Transaction successful.",
"store": {
"status": "CON",
"nsua": "18051600000560A",
"merchant_usn": "16013439434",
"customer_id": "11122211122",
"nita": "Z123adsfrh342r72498r34920ur23r328r2038r023rh0h203rh032r082380rf43",
"store_token": "123456789012345678901234567890123456789012345678901234567890123456"
}
}

Learn more about this service.

Page of virtual merchant#

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

URL for Production environment:


https://esitef.softwareexpress.com.br/js/esitefstore-1.0.min.js

URL for Homologation environment:


https://esitef-homologacao.softwareexpress.com.br/js/esitefstore-1.0.min.js

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
esitef-homologacao.softwareexpress.com.br

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script
type="text/javascript"
src="https://{{url}}/js/esitefstore-1.0.min.js"
></script>
<script>
function myStore() {
var request = {
onSuccess: function (response) {
console.log(response.code);
console.log(response.message);
console.log(response.store.status);
console.log(response.store.nita);
console.log(response.store.merchant_usn);
},
onFailure: function (response) {
console.log(response.code);
console.log(response.message);
console.log(response.store.status);
console.log(response.store.nita);
console.log(response.store.merchant_usn);
},
onInvalid: function (errors) {
for (var i = 0; i < errors.length; i++) {
console.log(errors[i].field);
console.log(errors[i].cause);
}
},
nita: 'Zdn2482f8924jh8fh842390hfef2fij20fj40jf024jf9j240hf4hjf0h243f84jf',
storeToken:
'123456789012345678901234567890123456789012345678901234567890123456',
merchantId: 'xxxxxxxx',
locale: 'pt',
authorizerId: '2',
};
esitefStore(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="button" onclick="myStore()" />
</form>
</body>
</html>

Receiving a store notification#

As soon as the store process is finished, Carat Portal will notify the merchant with a POST on their registered store URL, containing the stored card token.

@RestController
public class MyStoreController {
@PostMapping(value = "/mystore",
consumes = "application/x-www-form-urlencoded; charset=utf-8")
public ResponseEntity<String> myStore(@RequestParam Map<String, String> request) {
Log.info("token = " + request.get("hash"));
// ...
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://urlDaLojaCadastrada.com.br \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'cache-control: no-cache' \
-d 'nsua=9055020677&nita=1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqr&nsu=09055020677&status=CON&hash=67890afghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqr&bin=498406&final=2268&autorizadora=1'

Learn more about this service.