Pular para o conteúdo principal

API Externa

O tipo customizado permite que você integre uma API Externa, da sua empresa ou de um terceiro que a Paketa não oferece suporte nativo. A autenticação deve ser feita através de headers.

curl --request POST \
--url https://api.base39.io/v1/settings \
--user 'bs_sandbox_65592feb50584d6838855f12' \
--data '
{
"disbursements": {
"disbursementCustom": {
"type": "custom",
"credentials": {
"headers": {
"Authorization": "value"
},
"url": "https://api.example.com"
}
}
}
}
'

Dados enviados

O fluxo de desembolso faz uma requisição POST para a API configurada com o body abaixo. Os arquivos podem ser baixados pelo API de Links de arquivo

Separamos em duas abas para facilitar a visualização. A aba "completo" mostra todos os campos dentro de employment, customer, company e offer.

{
"id": "loan_5f92f01728e009f403d8502e",
"externalId": "4eeb7525-40c6-45fe-8236-2b731d740fad",
"employment": {...}, // consulte a aba "completo"
"customer": {...}, // consulte a aba "completo"
"company": {...}, // consulte a aba "completo"
"status": "open",
"contractNumber": "AB123456789",
"offer": {
"fund": {...}, // consulte a aba "completo"
"product": {...}, // consulte a aba "completo"
...
}, // consulte a aba "completo"
"cashout": [
{
"amount": 0,
"paymentMethod": "string",
"type": "payment_method"
},
{
"amount": 0,
"typeableLine": "string",
"dueDate": "2023-07-28",
"beneficiary": {
"name": "string",
"document": "string"
},
"type": "boleto"
},
{
"amount": 0,
"invoice": "string",
"type": "invoice"
},
{
"amount": 0,
"loan": "string",
"type": "loan",
"dueDate": "2023-07-28"
}
],
"transactions": [
{
"amount": 0,
"description": "string",
"createdAt": "2023-07-28",
"metadata": {}
}
],
"attachments": [
{
"file": "file_6307b6c39f5d3d917009b631",
"linkedAt": "2023-07-28T16:19:15.649Z"
}
],
"context": {
"ip": "string",
"headers": {},
"fingerprint": "string",
"geolocation": [
"string"
]
},
"history": [
{
"description": "string",
"createdAt": "2023-07-28",
"status": "open",
"metadata": {}
}
],
"signatures": [
{
"signer": "string",
"context": {
"ip": "string",
"headers": {},
"fingerprint": "string",
"geolocation": [
"string"
],
"metadata": {},
"signedAt": "2023-07-28",
"id": "sign_5f92f01728e009f403d8502e"
}
}
],
"metadata": {},
"createdAt": "2023-07-28T16:19:15.649Z",
"updatedAt": "2023-07-28T16:19:15.649Z"
}
{
"id": "loan_5f92f01728e009f403d8502e",
"externalId": "4eeb7525-40c6-45fe-8236-2b731d740fad",
"employment": {
"id": "empl_62d9889bd3985729e5a048ef",
"status": "working",
"grossSalary": 0,
"netSalary": 0,
"hiredAt": "2023-07-28",
"limitPerInstallment": 0,
"limitPerLoan": 0,
"customer": {
"document": "string",
"name": "string",
"email": "string",
"phone": "string",
"birthDate": "string",
"externalId": "string"
},
"company": "comp_62d9889bd3985729e5a048ef",
"role": "Desenvolvedor",
"description": "string",
"date": "2023-07-28",
"severancePayment": 0,
"transferredTo": "comp_62d9889bd3985729e5a048ef",
"transferredFrom": "comp_62d9889bd3985729e5a048ef",
"metadata": {},
"createdAt": "2023-07-28T16:19:15.649Z",
"updatedAt": "2023-07-28T16:19:15.649Z",
"deleted": false,
"expiredAt": "2023-07-28T16:19:15.649Z"
},
"customer": {
"id": "cust_62d9889bd3985729e5a048ef",
"document": "string",
"name": "string",
"email": "string",
"phone": "string",
"username": "string",
"address": {
"city": "string",
"country": "string",
"line1": "string",
"line2": "string",
"postalCode": "string",
"state": "string",
"number": "string",
"neighborhood": "string"
},
"birthDate": "2023-07-28",
"birthPlace": "string",
"nationality": "string",
"gender": "string",
"publicPerson": true,
"maritalStatus": "single",
"motherName": "string",
"additionalDocuments": [
{
"type": "string",
"number": "string",
"issuer": "string",
"state": "string"
}
],
"attachments": [
{
"file": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"linkedAt": "2023-07-28T16:19:15.649Z"
}
],
"metadata": {},
"createdAt": "2023-07-28T16:19:15.649Z",
"updatedAt": "2023-07-28T16:19:15.649Z",
"deleted": false
},
"company": {
"id": "comp_5f92f01728e009f403d8502e",
"status": "active",
"document": "string",
"name": "string",
"friendlyName": "string",
"group": "cgrp_5f92f01728e009f403d8502e",
"address": {
"city": "string",
"country": "string",
"line1": "string",
"line2": "string",
"postalCode": "string",
"state": "string",
"number": "string",
"neighborhood": "string"
},
"metadata": {},
"createdAt": "2023-07-28T16:19:15.649Z",
"updatedAt": "2023-07-28T16:19:15.649Z",
"deleted": true
},
"status": "open",
"contractNumber": "AB123456789",
"offer": {
"disbursementAmount": 0,
"installmentAmount": 0,
"totalAmount": 0,
"iofAmount": 0,
"monthlyCET": 0,
"yearlyCET": 0,
"monthlyFee": 0,
"yearlyFee": 0,
"insurance": {
"amount": 0,
"fee": 0,
"type": "required",
"number": "string",
"insurer": "string"
},
"interestType": "string",
"creditOperationType": "string",
"expectedDisbursementDate": "2023-07-28",
"interestGracePeriod": 0,
"principalGracePeriod": 0,
"numberOfInstallments": 0,
"firstDueDate": "2023-07-28",
"fund": {
"id": "fund_5f92f01728e009f403d8502e",
"status": "active",
"name": "FIDIC 01",
"document": "string",
"address": {
"city": "string",
"country": "string",
"line1": "string",
"line2": "string",
"postalCode": "string",
"state": "string",
"number": "string",
"neighborhood": "string"
},
"metadata": {},
"createdAt": "2023-07-28T18:10:13.162Z",
"updatedAt": "2023-07-28T18:10:13.162Z",
"deleted": false
},
"product": {
"id": "prod_6352a35384c95868100e226c",
"slug": "consignado",
"status": "active",
"name": "Empréstimo consignado",
"description": "string",
"metadata": {},
"createdAt": "2023-07-28T18:10:13.162Z",
"updatedAt": "2023-07-28T18:10:13.162Z"
},
"description": "string",
"rebates": [
{
"feeType": "tac",
"amountType": "absolute",
"amount": 200,
"description": "string"
}
],
"fine": {
"fineRate": 0,
"interestBase": "workdays",
"monthlyRate": 0.02
},
"metadata": {}
},
"cashout": [
{
"amount": 0,
"paymentMethod": "string",
"type": "payment_method"
},
{
"amount": 0,
"typeableLine": "string",
"dueDate": "2023-07-28",
"beneficiary": {
"name": "string",
"document": "string"
},
"type": "boleto"
},
{
"amount": 0,
"invoice": "string",
"type": "invoice"
},
{
"amount": 0,
"loan": "string",
"type": "loan",
"dueDate": "2023-07-28"
}
],
"transactions": [
{
"amount": 0,
"description": "string",
"createdAt": "2023-07-28",
"metadata": {}
}
],
"attachments": [
{
"file": "file_6307b6c39f5d3d917009b631",
"linkedAt": "2023-07-28T16:19:15.649Z"
}
],
"context": {
"ip": "string",
"headers": {},
"fingerprint": "string",
"geolocation": [
"string"
]
},
"history": [
{
"description": "string",
"createdAt": "2023-07-28",
"status": "open",
"metadata": {}
}
],
"signatures": [
{
"signer": "string",
"context": {
"ip": "string",
"headers": {},
"fingerprint": "string",
"geolocation": [
"string"
],
"metadata": {},
"signedAt": "2023-07-28",
"id": "sign_5f92f01728e009f403d8502e"
}
}
],
"metadata": {},
"createdAt": "2023-07-28T16:19:15.649Z",
"updatedAt": "2023-07-28T16:19:15.649Z"
}

Retorno de status

Existem duas APIs disponíveis para registrar o status do desembolso.

Transações

As transações são semelhantes aos itens em um extrato bancário. Elas são utilizadas para rastrear todas as movimentações financeiras ocorridas durante o processo de desembolso.

O status do empréstimo será atualizado para desembolsado (disbursed) quando a soma total das transações for equivalente ao valor solicitado (loan.offer.disbursementAmount).

Utilizando o Criar uma transação, é possível adicionar comentários sobre o progresso do desembolso com o valor zero (amount: 0). Estes comentários são exibidos no backoffice, auxiliando o operador a acompanhar com maior precisão o processo de desembolso.

Pendências

Adicionalmente, além dos comentários em forma de transação, você tem a opção de alterar o status do empréstimo para pendente (pending) através do Marcar um empréstimo como pendente. Isso indica que o operador ou o cliente precisam realizar algum ajuste nos dados fornecidos. Após as devidas correções, a proposta será reencaminhada para o processo de desembolso.