Quick start

Esta guía muestra el proceso de registro de la tienda, utilizando la interfaz del servicio web REST de Portal Carat.

Que necesitarás#

  • Una tienda registrada en Portal Carat con permiso para usar esta API
  • Una herramienta capaz de realizar llamadas HTTP, como Postman, REST Client o cURL
  • Una aplicación capaz de recibir llamadas HTTPS POST, si se usa el POST de autenticidad

POST Authenticity X Signature#

Portal Carat tiene dos formas de autenticación de la tienda en la interfaz de creación, edición y consulta de la tienda REST: autenticidad POST o firma.

En el método POST de autenticidad, el Portal Carat enviará el token recién creado a la URL de autenticidad registrada de la tienda.

En el método de firma, la tienda debe tener una clave pública de encriptación RSA registrada en Portal Carat y debe ensamblar una firma JWT (JSON Web Tokens) para ser enviada en el encabezado Authorization. [Más información.] (autenticación-firma.md )

Creando un token#

tipo de solicitud: POST

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

Headers:

  • Content-Type: application/json
  • merchant_id: {tu código de tienda}
  • merchant_key: {la llave de tu tienda}

Solicitud:

curl
--request POST "https://esitef-homologacao.softwareexpress.com.br/e-sitef/api/v1/token/merchants"
--header "merchant_id: xxxxxxxx"
--header "merchant_key: xxxxxxxxxxx"
--verbose

Recibo de autenticidad POST:

@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("token = " + request.get("token"));
// ...
// armazena o token
// ...
return new ResponseEntity<>("OK", HttpStatus.OK);
}
}

Respuesta:

{
"response_code": 0,
"response_message": "OK. Transaction successful."
}

[Obtenga más información sobre este servicio.] (cadastro-lojas-ws-token.md)

Creando la tienda#

Tipo de solicitud : POST

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

Complete el campo <id > en la URL anterior con el código de la tienda que se creará.

Headers:

  • Content-Type : aplicación / json
  • merchant_id: {su código de tienda}
  • merchant_id: {clave de su tienda}
  • token: {token si se usa la publicación de autenticidad}
  • Authorization: {firma si se utiliza la firma JWT}

Solicitud:

{
"fantasy_name": "Teste de Loja",
"corporate_name": "Testes de Loja Ltda.",
"soft_descriptor": {
"fantasy_name": "Sub-comércio da Loja",
"country": "BR",
"mcc": "1234",
"id": "123456"
},
"subacquirer_group": {
"create": "true",
"id": "123456",
"cnpj": "12345678901234"
},
"domain": "www.testeloja.com",
"cnpj": "123123123123",
"address": "Rua do Teste, 123",
"city": "São Teste",
"state": "SP",
"zip_code": "12345678",
"phone_number": "11912341234",
"email": "testeloja@teste.com",
"transactional_urls": {
"status": "https://www.testeloja.com/status",
"authenticity": "https://www.testeloja.com/autent",
"hash": "https://www.testeloja.com/hash"
},
"return_urls": {
"success": "https://www.testeloja.com/sucesso",
"failure": "https://www.testeloja.com/fracasso",
"cancel": "https://www.testeloja.com/cancel"
},
"permissions": {
"payment": "true",
"pre_authorization": "false",
"recharge": "false",
"risk_analysis": "true",
"schedule": "true",
"iata": "false",
"card_store": "false",
"payment_link": "true"
},
"establishments": [
{
"code": "00000000123",
"routing_id": "1125",
"subacquirer_group_id": "123456"
},
{
"code": "00000000321",
"routing_id": "1005"
}
],
"authorizers": [
{
"id": "1",
"routing_id": "1125",
"min_installments_amount": "100",
"max_installments_without_interest": "1",
"max_installments_with_interest": "12",
"enable_subacquirer_group": "true"
},
{
"id": "2",
"routing_id": "201",
"min_installments_amount": "100",
"max_installments_without_interest": "1",
"max_installments_with_interest": "12",
"parameters": {
"merchantId": "8h37e9e23oe",
"merchantKey": "b9f374t5983t745f873tb45f93b4f2293b485ft34"
}
}
]
}
curl
--request POST "https://esitef-homologacao.softwareexpress.com.br/e-sitef/api/v1/merchants"
--header "Content-Type: application/json"
--header "merchant_id: xxxxxxxx"
--header "merchant_key: xxxxxxxxxxx"
--header "token: 1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqr"
--data-binary
{
"fantasy_name":"Teste de Loja",
"corporate_name":"Testes de Loja Ltda.",
"soft_descriptor":{
"fantasy_name":"Sub-comércio da Loja",
"country":"BR",
"mcc":"1234",
"id":"123456"
},
"subacquirer_group":{
"create":"true",
"id":"123456",
"cnpj":"12345678901234"
},
"domain":"www.testeloja.com",
"cnpj":"123123123123",
"address":"Rua do Teste, 123",
"city":"São Teste",
"state":"SP",
"zip_code":"12345678",
"phone_number":"11912341234",
"email":"testeloja@teste.com",
"transactional_urls":{
"status":"https://www.testeloja.com/status",
"authenticity":"https://www.testeloja.com/autent",
"hash":"https://www.testeloja.com/hash"
},
"return_urls":{
"success":"https://www.testeloja.com/sucesso",
"failure":"https://www.testeloja.com/fracasso",
"cancel":"https://www.testeloja.com/cancel"
},
"permissions":{
"payment":"true",
"pre_authorization":"false",
"recharge":"false",
"risk_analysis":"true",
"schedule":"true",
"iata":"false",
"card_store":"false",
"payment_link":"true"
},
"establishments":[
{
"code":"00000000123",
"routing_id":"1125",
"subacquirer_group_id":"123456"
},
{
"code":"00000000321",
"routing_id":"1005"
}
],
"authorizers":[
{
"id":"1",
"routing_id":"1125",
"min_installments_amount":"100",
"max_installments_without_interest":"1",
"max_installments_with_interest":"12",
"enable_subacquirer_group":"true"
},
{
"id":"2",
"routing_id":"201",
"min_installments_amount":"100",
"max_installments_without_interest":"1",
"max_installments_with_interest":"12",
"parameters":{
"merchantId":"8h37e9e23oe",
"merchantKey":"b9f374t5983t745f873tb45f93b4f2293b485ft34"
}
}
]
}
--verbose
curl
--request POST "https://esitef-homologacao.softwareexpress.com.br/e-sitef/api/v1/merchants"
--header "Content-Type: application/json"
--header "merchant_id: xxxxxxxx"
--header "merchant_key: xxxxxxxxxxx"
--header "Authorization: Bearer YYYYYYYYYYYYYY"
--data-binary
{
"cnpj":"123123123123",
"fantasy_name":"Teste de Loja",
"corporate_name":"Testes de Loja Ltda.",
"soft_descriptor":{
"fantasy_name":"Sub-comércio da Loja",
"country":"BR",
"mcc":"1234",
"id":"123456"
},
"subacquirer_group":{
"create":"true",
"id":"123456",
"cnpj":"12345678901234"
},
"domain":"www.testeloja.com",
"address":"Rua do Teste, 123",
"city":"São Teste",
"state":"SP",
"zip_code":"12345678",
"phone_number":"11912341234",
"email":"testeloja@teste.com",
"transactional_urls":{
"status":"https://www.testeloja.com/status",
"authenticity":"https://www.testeloja.com/autent",
"hash":"https://www.testeloja.com/hash"
},
"return_urls":{
"success":"https://www.testeloja.com/sucesso",
"failure":"https://www.testeloja.com/fracasso",
"cancel":"https://www.testeloja.com/cancel"
},
"permissions":{
"payment":"true",
"pre_authorization":"false",
"recharge":"false",
"risk_analysis":"true",
"schedule":"true",
"iata":"false",
"card_store":"false",
"payment_link":"true"
},
"establishments":[
{
"code":"00000000123",
"routing_id":"1125",
"subacquirer_group_id":"123456"
},
{
"code":"00000000321",
"routing_id":"1005"
}
],
"authorizers":[
{
"id":"1",
"routing_id":"1125",
"min_installments_amount":"100",
"max_installments_without_interest":"1",
"max_installments_with_interest":"12",
"enable_subacquirer_group":"true"
},
{
"id":"2",
"routing_id":"201",
"min_installments_amount":"100",
"max_installments_without_interest":"1",
"max_installments_with_interest":"12",
"parameters":{
"merchantId":"8h37e9e23oe",
"merchantKey":"b9f374t5983t745f873tb45f93b4f2293b485ft34"
}
}
]
}
--verbose

Respuesta:

{
"id": "qereIoinsd3d",
"key": "9B71234TB12D938T9384TDB294T923D412T938D1293D4B923D",
"response_code": "0",
"response_message": "OK"
}

[Obtenga más información sobre este servicio.] (Cadastro-lojas-ws-criacao.md)