Quick start

Este guia mostra o processo de efetivação de um recarga, utilizando a interface web service REST do Carat.

O que você precisará#

  • Cadastro ativo no ambiente de homologação do Carat (obtido com nossa equipe de suporte)
  • Uma ferramenta capaz de realizar chamadas HTTP, como Postman, REST Client ou cURL

Criando a transação#

Tipo de requisição: POST

URL: https://esitef-homologacao.softwareexpress.com.br/e-sitef/v3/recharge

Headers:

  • Content-Type: application/json

Requisição:

Para usar este exemplo, não esquecer de definir a variável {{url}} com o valor
esitef-homologacao.softwareexpress.com.br

{
"begin_recharge_request": {
"merchant_key": "XXXXXXXX"
}
}
curl
--request POST "https://{{url}}/e-sitef/v3/recharge"
--header "Content-Type: application/json"
--data-binary
{
"begin_recharge_request":{
"merchant_key":"XXXXXXXX"
}
}
--verbose

Recebimento do POST de autenticidade:

@RestController
public class MyAuthenticityController {
@PostMapping(value = "/myauthenticity",
consumes = "application/x-www-form-urlencoded; charset=utf-8")
public ResponseEntity<String> myAuthenticity(@RequestParam Map<String, String> request) {
Log.info("nit = " + request.get("nit"));
// ...
// armazena o NIT da recarga
// ...
return new ResponseEntity<>("OK", HttpStatus.OK);
}
}

Resposta:

{
"begin_recharge_response": {
"esitef": {
"message": "OK. Transaction successful.",
"code": "0"
}
}
}

Saiba mais sobre esse serviço.

Listando concessionárias#

Tipo de requisição: GET

URL: https://esitef-homologacao.softwareexpress.com.br/e-sitef/v3/rechargedealers

Requisição:

Para usar este exemplo, não esquecer de definir a variável {{url}} com o valor
esitef-homologacao.softwareexpress.com.br

curl
--request GET "https://{{url}}/e-sitef/v3/rechargedealers?nit=asdfghjk12345678asdfghjk12345678asdfghjk12345678asdfghjk12345678&generalhash=0000000000000000"
--verbose

Resposta:

{
"list_dealers_response": {
"status": "NOV",
"esitef": {
"message": "OK. Transaction successful.",
"code": "0"
},
"authorizer": {
"message": "",
"code": "000"
},
"hashes": {
"general": "09A9681D09A9681D"
},
"dealers": [
{
"name": "Vivo",
"code": "001"
},
{
"name": "Claro",
"code": "002"
},
{
"name": "Oi",
"code": "003"
},
{
"name": "Tim",
"code": "004"
}
]
}
}

Saiba mais sobre esse serviço.

Listando dados da filial#

Tipo de requisição: GET

URL: https://esitef-homologacao.softwareexpress.com.br/e-sitef/v3/rechargebranches

Requisição:

Para usar este exemplo, não esquecer de definir a variável {{url}} com o valor
esitef-homologacao.softwareexpress.com.br

curl
--request GET "https://{{url}}/e-sitef/v3/rechargebranches?nit=asdfghjk12345678asdfghjk12345678asdfghjk12345678asdfghjk12345678&ddd=00&dealercode=1&generalhash=0000000000000000"
--verbose

Resposta:

{
"list_branch_data_response": {
"status": "NOV",
"esitef": {
"message": "OK. Transaction successful.",
"code": "0"
},
"sitef": {
"code": "000"
},
"hashes": {
"general": "09A9681D09A9681D"
},
"questions": [
{
"id": "5",
"display": "Qual o nome do seu pai?",
"rule": "3",
"min": "5",
"max": "30",
"type": "i"
}
],
"general": [
{
"message": "MENSAGEM DE TESTE"
}
],
"categories": [
{
"code": "01",
"description": "RECARGA",
"amount_ranges": [
{
"message": "MSG_FAIXA_1",
"amount_key": "7",
"bonus_in_percentage": "100",
"bonus": "50",
"payment_amount": "700",
"bonus_category": "1",
"expiry_date": "30",
"bonus_expiry_date": "15",
"min_amount": "500",
"max_amount": "10000"
},
{
"message": "MSG_FAIXA_2",
"amount_key": "8",
"bonus_in_percentage": "500",
"bonus_category": "2",
"min_amount": "1000",
"max_amount": "50000"
}
],
"fixed_amounts": [
{
"bonus": "50",
"message": "MSG_FIXO_1",
"amount": "300",
"amount_key": "1",
"bonus_category": "2",
"bonus_in_percentage": "200",
"payment_amount": "10",
"expiry_date": "60",
"bonus_expiry_date": "15"
},
{
"message": "MSG_FIXO_2",
"amount": "1500",
"amount_key": "2",
"payment_amount": "30"
},
{
"message": "MSG_FIXO_3",
"amount": "2000",
"amount_key": "3"
},
{
"amount": "2200",
"amount_key": "4",
"expiry_date": "90"
},
{
"message": "MSG_FIXO_4",
"amount": "5000",
"amount_key": "6",
"expiry_date": "120"
}
]
},
{
"code": "02",
"description": "SMS",
"amount_ranges": [],
"fixed_amounts": []
},
{
"code": "03",
"description": "PRIMEIRA_RECARGA",
"amount_ranges": [],
"fixed_amounts": []
}
],
"payment_methods": {
"max": "4",
"available": ["00", "01", "02:10", "03:10", "04:10", "05:10", "06:10"]
}
}
}

Saiba mais sobre esse serviço.

Efetivando a recarga#

Recarga com pagamento#

Tipo de requisição: PUT

URL: https://esitef-homologacao.softwareexpress.com.br/e-sitef/v3/recharge/<nit>

Headers:

  • Content-Type: application/json

Requisição:

Para usar este exemplo, não esquecer de definir a variável {{url}} com o valor
esitef-homologacao.softwareexpress.com.br

{
"do_recharge_request": {
"hashes": {
"general": "0000000000000000"
},
"dealer": {
"code": "1",
"type_code": "03",
"branch": {
"code": "98006000000"
}
},
"phone": {
"ddd": "11",
"number": "123456789"
},
"amount": "3000",
"amount_key": "3",
"used_payment_methods": ["11", "12"],
"answers": [
{
"code": "1",
"description": "resposta"
},
{
"code": "2",
"description": "resposta2"
}
],
"terminal_type": "03",
"cpf": "8298374982374",
"cnpj": "123121333000123",
"zip_code": "01310100",
"payment": {
"amount": "12",
"authorizer_id": "1",
"customer_id": "12341234",
"merchant_key": "OIAUSWHFN012375901J23047FNN00UYWHN0R871Y2ND87",
"installment": {
"number": "2",
"type": "4"
},
"card": {
"number": "1111111111111111",
"token": "",
"security_code": "123",
"expiry_date": "1222"
},
"extra_param": [
{
"key": "CRIPTO",
"value": "1"
}
]
}
}
}
curl
--request PUT "https://{{url}}/e-sitef/v3/recharge/asdfghjk12345678asdfghjk12345678asdfghjk12345678asdfghjk12345678"
--header "Content-Type: application/json"
--data-binary
{
"do_recharge_request":{
"hashes":{
"general":"0000000000000000"
},
"dealer":{
"code":"1",
"type_code":"03",
"branch":{
"code":"98006000000"
}
},
"phone":{
"ddd":"11",
"number":"123456789"
},
"amount":"3000",
"amount_key":"3",
"used_payment_methods":[
"11",
"12"
],
"answers":[
{
"code":"1",
"description":"resposta"
},
{
"code":"2",
"description":"resposta2"
}
],
"terminal_type":"03",
"cpf":"8298374982374",
"cnpj":"123121333000123",
"zip_code":"01310100",
"payment":{
"amount":"12",
"authorizer_id":"1",
"customer_id":"12341234",
"merchant_key":"OIAUSWHFN012375901J23047FNN00UYWHN0R871Y2ND87",
"installment":{
"number":"2",
"type":"4"
},
"card":{
"number":"1111111111111111",
"token":"",
"security_code":"123",
"expiry_date":"1222"
},
"extra_param":[
{
"key":"CRIPTO",
"value":"1"
}
]
}
}
}
--verbose

Resposta:

{
"do_recharge_response": {
"status": "PPC",
"order_id": "12344231",
"merchant_usn": "5123",
"esitef": {
"message": "OK",
"code": "0",
"usn": "123456789012345"
},
"sitef": {
"message": "OK",
"code": "0"
},
"host": {
"message": "OK",
"code": "0"
},
"acquirer": {
"branch_code": "cod filial",
"merchant_code": "codigoEstab"
},
"authorization": {
"confirmation_data": "000033333",
"authorizer_date": "20150514",
"authorizer_time": "1100",
"host_usn": "11122",
"sitef_usn": "333",
"number": "332234"
},
"customer": {
"total_copies": 3,
"receipt": "COMPROVANTE DE RECARGA via do cliente"
},
"merchant": {
"total_copies": 3,
"receipt": "COMPROVANTE DE RECARGA via do estabelecimento"
},
"payment_methods": {
"max": 4,
"available": [
{
"name": "dinheiro"
},
{
"name": "cheque"
}
]
},
"payment": {
"status": "PPC",
"amount": "12",
"type": "C",
"esitef": {
"usn": "098765432109876",
"date": "12/12/2012 12:12"
},
"customer": {
"receipt": "nwiugrnboinb APROVADO via do cliente"
},
"merchant": {
"receipt": "nwiugrnboinb APROVADO via do estabelecimento "
},
"authorizer_id": "1",
"acquirer": "CIELO",
"authorization": {
"number": "163457212",
"sitef_usn": "456456",
"host_usn": "654654",
"tid": "7334312a2",
"eci": "fr3u214wf71",
"sitef_date": "12122012"
},
"analysis": {
"status": "PEN",
"code": "0",
"message": "aprovado"
},
"extra_param": [
{
"key": "CRIPTO",
"value": "1"
}
],
"sitef": {
"code": "000"
}
}
}
}

Recarga sem pagamento#

Requisição:

Para usar este exemplo, não esquecer de definir a variável {{url}} com o valor
esitef-homologacao.softwareexpress.com.br

{
"do_recharge_request": {
"dealer": {
"code": "1"
},
"phone": {
"ddd": "11",
"number": "123456789"
},
"amount": "3000"
}
}
curl
--request PUT "https://{{url}}/e-sitef/v3/recharge/asdfghjk12345678asdfghjk12345678asdfghjk12345678asdfghjk12345678"
--header "Content-Type: application/json"
--data-binary
{
"do_recharge_request":{
"dealer":{
"code":"1"
},
"phone":{
"ddd":"11",
"number":"123456789"
},
"amount":"3000"
}
}
--verbose

Resposta:

{
"do_recharge_response": {
"status": "PPC",
"order_id": "12344231",
"merchant_usn": "5123",
"esitef": {
"message": "OK",
"code": "0",
"usn": "123456789012345"
},
"sitef": {
"message": "OK",
"code": "0"
},
"host": {
"message": "OK",
"code": "0"
},
"acquirer": {
"branch_code": "cod filial",
"merchant_code": "codigoEstab"
},
"authorization": {
"confirmation_data": "000033333",
"authorizer_date": "20150514",
"authorizer_time": "1100",
"host_usn": "11122",
"sitef_usn": "333",
"number": "332234"
},
"customer": {
"total_copies": 3,
"receipt": "COMPROVANTE DE RECARGA via do cliente"
},
"merchant": {
"total_copies": 3,
"receipt": "COMPROVANTE DE RECARGA via do estabelecimento"
},
"payment_methods": {
"max": 4,
"available": [
{
"name": "dinheiro"
},
{
"name": "cheque"
}
]
}
}
}

Saiba mais sobre esse serviço.

Confirmando a recarga#

Tipo de requisição: PUT

URL: https://esitef-homologacao.softwareexpress.com.br/e-sitef/v3/recharge/<nit>

Headers:

  • Content-Type: application/json

Requisição:

Para usar este exemplo, não esquecer de definir a variável {{url}} com o valor
esitef-homologacao.softwareexpress.com.br

{
"confirm_recharge_request": {
"confirm": "true",
"merchant_key": "AOSDJF210349H3R0374H874H3T7AHG90SF"
}
}
curl
--request PUT "https://{{url}}/e-sitef/v3/recharge/asdfghjk12345678asdfghjk12345678asdfghjk12345678asdfghjk12345678"
--header "Content-Type: application/json"
--data-binary
{
"confirm_recharge_request":{
"confirm":"true",
"merchant_key":"AOSDJF210349H3R0374H874H3T7AHG90SF"
}
}
--verbose

Resposta:

{
"confirm_recharge_response": {
"esitef": {
"message": "OK",
"code": "0"
},
"status": "CON",
"payment": {
"status": "CON"
}
}
}

Saiba mais sobre esse serviço.

Consultando a recarga#

Tipo de requisição: PUT

URL: https://esitef-homologacao.softwareexpress.com.br/e-sitef/v3/recharge/**<nit>\*\*

Preencha o campo <nit> na URL acima com o NIT obtido na resposta da fase de criação da transação.

Headers:

  • Content-Type: application/json

Requisição:

Para usar este exemplo, não esquecer de definir a variável {{url}} com o valor
esitef-homologacao.softwareexpress.com.br

curl
--request GET "https://{{url}}/e-sitef/v3/recharge/asdfghjk12345678asdfghjk12345678asdfghjk12345678asdfghjk12345678/?merchantkey=ASDFGHJK12345678ASDFGHJK12345678"
--verbose

Resposta:

{
"get_status_recharge_response": {
"status": "CON",
"esitef": {
"message": "OK",
"code": "0"
},
"authorizers": [
{
"name": "sitef",
"message": "textoExibicao",
"code": "codigoRespSitef"
},
{
"name": "nome operadora (186)",
"message": "OK",
"code": "196"
}
],
"acquirer": {
"branch_code": "cod filial",
"merchant_code": "codigoEstab"
},
"authorization": {
"confirmation_data": "000033333",
"authorizer_date": "20150514",
"authorizer_time": "1100",
"host_usn": "11122",
"sitef_usn": "333",
"number": "332234"
},
"customer": {
"total_copies": 3,
"receipt": "COMPROVANTE DE RECARGA mimimim cliente whiskas sache"
},
"merchant": {
"total_copies": 3,
"receipt": "COMPROVANTE DE RECARGA mimimim estabelecimento lorem ipsum"
},
"payment_methods": {
"max": 2,
"available": [
{
"name": "dinheiro"
},
{
"name": "cheque"
}
]
},
"payment": {
"status": "PPC",
"amount": "12",
"type": "C",
"esitef": {
"usn": "098765432109876",
"date": "12/12/2012 12:12"
},
"customer": {
"receipt": "nwiugrnboinbAPROVADOaoisuerhn"
},
"merchant": {
"receipt": "nwiugrnboinbAPROVADOaoisuerhn"
},
"authorizer_id": "1",
"acquirer": "CIELO",
"authorization": {
"number": "163457212",
"sitef_usn": "456456",
"host_usn": "654654",
"tid": "7334312a2",
"eci": "fr3u214wf71",
"sitef_date": "12122012"
},
"analysis": {
"status": "PEN",
"code": "0",
"message": "hahaha"
},
"extra_param": [
{
"key": "CRIPTO",
"value": "1"
}
],
"sitef": {
"code": "000"
}
}
}
}

Saiba mais sobre esse serviço.