Criar
POST
/cashins
Você pode usar essa rota para criar um cashin.
Fields
Nome | Tipo | Descrição | Obrigatório |
---|---|---|---|
external_id | string | String que é passada como identificador externo do cashin | Sim |
value | number | Valor inteiro que representa o valor do cashin | Sim |
description | string | String que representa a descrição do cashin a ser pago | Sim |
expiration | number | Valor do tipo inteiro que representa o tempo, em segundos, de expiração do cashin criado | Sim |
payer | object | Dados do pagador do cashin | Sim |
payer.type | string | Tipo do pagador ("J" para pessoa jurídica, "F" para pessoa física) | Sim |
payer.name | string | Nome do pagador | Sim |
payer.document | string | Documento do pagador (CPF ou CNPJ) | Sim |
payer.phone | string | Número de telefone do pagador | Sim |
payer.address | object | Objeto contendo os dados do endereço do pagador | Sim |
payer.address.postal_code | string | CEP do endereço do pagador | Sim |
payer.address.street | string | Nome da rua do endereço do pagador | Sim |
payer.address.number | string | Número do endereço do pagador | Sim |
payer.address.complement | string | Complemento do endereço do pagador | Sim |
payer.address.neighborhood | string | Bairro do endereço do pagador | Sim |
payer.address.city | string | Cidade do endereço do pagador | Sim |
payer.address.state | string | Estado do endereço do pagador | Sim |
beneficiaries | array[object] | Uma lista com os dados dos beneficiários do cashin | Sim |
beneficiaries[].document | string | Documento do beneficiário do cashin | Sim |
beneficiaries[].value | number | Valor inteiro que representa o valor do cashin para o beneficiário | Sim |
beneficiaries[].type | number | Tipo de beneficiário do cashin (1 para pessoa física, 2 para pessoa jurídica) | Sim |
Exemplo de Payload
- Minimo
- Completo
{
"external_id": "71900d60-0ec6-4f48-a966-95c8a0318126",
"payer": {
"type": "J",
"name": "ZEMOBANK",
"document": "12345678910"
},
"value": 5,
"description": "Deposit teste",
"expiration": 360
}
{
"external_id": "71900d60-0ec6-4f48-a966-95c8a0318126",
"value": 1000,
"description": "this is description",
"expiration": 1200,
"payer": {
"type": "J",
"name": "name payer",
"document": "12345678910",
"address": {
"postal_code": "12345678",
"street": "RUA",
"number": "123",
"complement": "CASA",
"neighborhood": "LOCAL DE REFERÊNCIA",
"city": "CIDADE",
"state": "ESTADO"
}
},
"beneficiaries": [
{
"document": "12345678910",
"value": 5,
"type": 2
}
]
}
Observação
Aceitamos o header qrcode
recebendo o valor true
para retornar o base64 do QRCode.
Exemplo de Resposta
- 200 - Success
- 422 - Duplicated
- 422 - Invalid field
- 403 - Unauthorized/Forbidden
Status Code: 200
{
"status": "received",
"message": "cashin in processing",
"data": {
"cashin_id": "4245648248e24461818fe421ac7a02a1",
"br_code": "00020101021226800014br.gov.bcb.pix2558apipix-psti.sinqia.com.br/v2/pub/00204963/816b7b2a37fe418a52040000530398654040.015802BR5924ZEMOTESTE 123456Sao Paulo62070503***6304D677"
}
}
Com o header qrcode
sendo passado na requisição:
Status Code: 200 com QRCode
{
"status": "received",
"message": "cashin in processing",
"data": {
"cashin_id": "4245648248e24461818fe421ac7a02a1",
"br_code": "00020101021226800014br.gov.bcb.pix2558apipix-psti.sinqia.com.br/v2/pub/00204963/816b7b2a37fe418a52040000530398654040.015802BR5924ZEMOTESTE 123456Sao Paulo62070503***6304D677",
"qrcode": "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAAQMAAABmvDolAAAABlBMVEX///8AAABVwtN+AAADXUlEQVR42uyZMY7sLBCECxEQcoPhIiP7Wg4sYWkCX4uVL4JvQEhgUb+6PbO770V/8JZxsEQW/lbydkN1dQ9+1+/612skue0FlrnELQP2g6x2J9kuAwyAEyB+ZM9kCmJDidyLvuoEBK4JHjOAyIYaG3wd98LjWsC2F0cSgGGdh+CXu+kNJFO4DAGRlAf4iosBgJMsw1DSTVnPnW7A89hrANdvD3/fi7cCsuzOaj+yl5A6puB5/CkiPwwMocTDlBoT/EqWGj+ot9U92mWAkb5KNOWARWa5G5mLZSFTL2AIesAqDAsQCmaTy2Qz3OM6wJh9vcM7Mvs6ZlS5rfowD70Ak1UWZN8vMKXOJgPjXlRaLwIMQT7ea6rdIQIiZy8Zus90/zwAzxRKjcxcT8kPZZI/eX3kNYAFhlwkgIBHlI+/B77S3QMIfuWrED/VrEx3U2DTdQCUSWzVYnKB7EsA3ctR9AI8N9FPkhXw7pGCX4+bx1eo3w4AmMadoiRiSwmJpEs3X7+qUgfAcae+mxCKZlPS+srmFQAREBg6MVqTbSprfrnDw7ZegJREqYYxgWdpJstkpYVIlwEAv9jmuQAlan0ceZakfoDJ6vH4aOrh6Q7V/11q0GWAIVD+C8zmdMt6NxerRbwf4DWb2kdo+2BycRu/q/3bAUjcGuqs6QZIFRCp3a0bADLdvDvGjOluiNNoNbxc8RUAk33FDdVSHOkNckFY7Xcn9uPAsxmUrkoDyMPQL3b/uyF9M1Am27xolypJnUfpcUh3oBsQSuROPhqkdS6wTc3ep4hdATDaiBV3jCryxfHjjOSrdncAhoCoQpoCqx65AX7dmv8aWL0fULd889JNyL2Qrl5im32NrRtAbW+kYSe3nZD9CdBCeRkgnwdM9+83OBGQdWtwy9APQNxEv0wuMd20j5btcilAXko3MYTiUtB7wWob+Ei9AJGsQ9Q+naUZsxgty29TtfcDz6maW0aebnBG8NxExLoBOl1kUZGP267WheSX2bsCoJN/skaqtzl/AlA3GFM3QOfVYoZRnJi9hzRc9jnruxDwCmDV/ksuxybWpy/QtEc+Zx2L+of2RyTfDojRup1qvybpmlPQgeSnwfh54Hnsdai36tlL4DLu+lPIVYDf9bv+//ovAAD//9rJG/vRuReKAAAAAElFTkSuQmCC"
}
}
Observação
O cashin_id
retornado pode ser usado posteriormente para fazer buscas.
Caso use um external_id já usado na criação de outro Cashin, terá um erro.
Status Code: 422
{
"status": "duplicated",
"message": "External_id already requested",
"data": {
"br_code": "00020101021226800014br.gov.bcb.pix2558apipix-psti.sinqia.com.br/v2/pub/00204963/816b7b2a37fe418a52040000530398654040.015802BR5924ZEMOTESTE 123456Sao Paulo62070503***6304D677",
"cashin_id": "920c246eade54d63b48bc316a41b41ad",
"qrcode": "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAAQMAAABmvDolAAAABlBMVEX///8AAABVwtN+AAADXUlEQVR42uyZMY7sLBCECxEQcoPhIiP7Wg4sYW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DLu+lPIVYDf9bv+//ovAAD//9rJG/vRuReKAAAAAElFTkSuQmCC",
"cashin_status": "PAID",
"requested_at": "2023-06-16T09:41:29.913",
}
}
Observação
O valor do campo cashin_status
será de acordo com o valor do status atual do cashin existente.
Caso não passe algum dos campos obrigatórios, será retornado um erro com o campo que está inválido.
Status Code: 422
{
"status": "error",
"message": "invalid payload expiration"
}
Status Code: 403
{
"status": "error",
"message": "Not Authorized"
}
Eventos
Após o cashin ser criado, os seguintes eventos serão disparados.
- RECEIVED
- CREATING
- CREATED
- PAID
- ERROR_ON_CREATION
{
"amount": 5,
"cashin_id": "920c246eade54d63b48bc316a41b41ad",
"expiration": 3600,
"external_id": "71900d60-0ec6-4f48-a966-95c8a0318126",
"payer_document": "12345678910",
"payer_name": "ZEMOBANK",
"status": "RECEIVED",
"topic": "pix.cashin.received"
}
{
"amount": 5,
"cashin_id": "920c246eade54d63b48bc316a41b41ad",
"created_at": "2023-06-14T00:00:00.000",
"expiration": 3600,
"external_id": "71900d60-0ec6-4f48-a966-95c8a0318126",
"payer_document": "12345678910",
"payer_name": "ZEMOBANK",
"status": "CREATING",
"topic": "pix.cashin.creating"
}
{
"amount": 5,
"br_code": "00020101021226790014br.gov.bcb.pix2557brcode.starkinfra.com/v2/68cf46192ec34c67bdd5467cb3783fe75204000053039865802BR5925Zemo pay Tecnologia em Pa6009Sao Paulo62070503***630400AC",
"cashin_id": "920c246eade54d63b48bc316a41b41ad",
"created_at": "2023-06-14T00:00:00.000",
"expiration": 3600,
"external_id": "71900d60-0ec6-4f48-a966-95c8a0318126",
"payer_document": "12345678910",
"payer_name": "ZEMOBANK",
"provider": "starkbank",
"provider_id": "68cf46192ec34c67bdd5467cb3783fe7",
"status": "CREATED",
"topic": "pix.cashin.created",
"updated_at": "2023-06-16T09:41:29.913"
}
Estado final
Não haverá mais mudanças no status desse cashin.
{
"amount": 5,
"br_code": "00020101021226790014br.gov.bcb.pix2557brcode.starkinfra.com/v2/68cf46192ec34c67bdd5467cb3783fe75204000053039865802BR5925Zemo pay Tecnologia em Pa6009Sao Paulo62070503***630400AC",
"cashin_id": "920c246eade54d63b48bc316a41b41ad",
"created_at": "2023-06-14T00:00:00.000",
"end2end": "e18236120202302041249s0166b347c9",
"expiration": 3600,
"external_id": "71900d60-0ec6-4f48-a966-95c8a0318126",
"paid_at": "2023-03-22T18:59:43",
"paid_by_document": "12345678910",
"paid_by_name": "Zemo Bank",
"payer_document": "12345678910",
"payer_name": "ZEMOBANK",
"provider": "starkbank",
"provider_id": "68cf46192ec34c67bdd5467cb3783fe7",
"status": "PAID",
"topic": "pix.cashin.paid",
"updated_at": "2023-06-16T09:43:26.613"
}
Estado final
Não haverá mais mudanças no status desse cashin.
{
"amount": 5,
"cashin_id": "920c246eade54d63b48bc316a41b41ad",
"expiration": 3600,
"external_id": "71900d60-0ec6-4f48-a966-95c8a0318126",
"payer_document": "12345678910",
"payer_name": "ZEMOBANK",
"status": "ERROR_ON_CREATION",
"topic": "pix.cashin.error_on_creation",
"payload": {
"external_id": "71900d60-0ec6-4f48-a966-95c8a0318126",
"payer": {
"type": "J",
"name": "ZEMOBANK",
"document": "12345678910"
},
"value": 5,
"description": "Deposit teste",
"expiration": 360
},
"error_reason": "motivo do error"
}