Pular para o conteúdo principal

Cobranças

Para mais informações, acessar a open api

Urls dos ambientes

Atenção

Para esses endpoints é necessário uma API KEY.

obtenha sua credencial

Cobrança Simples

endpoint: /v1/payin/payments/{chargeType}

O parâmetro de rota {chargeType} deve ser boleto ou pix.

método: POST

Exemplo de payload e response

Payload
{
"clientId": 15,
"customNumber": "123456",
"callbackUrl": "https://payin-test.requestcatcher.com/",
"title": {
"expireDate": "2022-07-25T16:20:00",
"amountInCents": 5000,
"instructions": "any bank"
},
"buyer": {
"name": "Name",
"document": {
"number": "01234567890",
"type": "CPF"
},
"address": {
"street": "Rua da praça",
"number": "123",
"complement": "conjunto comercial",
"zipCode": "99090900",
"city": "Curitiba",
"district": "Centro",
"stateCode": "PR"
}
}
}

Response
{
"key": "string",
"clientId": 0,
"clientName": "string",
"buyerName": "string",
"buyerDocument": "string",
"customNumber": "string",
"ourNumber": "string",
"digitableLine": "string",
"barCodeNumber": "string",
"status": {
"name": "string",
"id": "string"
},
"typePayin": "string",
"amountCents": 0,
"paidAmountCents": null,
"paidAt": null,
"expiresAt": "2019-08-24T14:15:22Z",
"createdAt": "2019-08-24T14:15:22Z",
"fine": null,
"discount": null,
"splits": [
{
"walletOwner": "string",
"walletUUID": "string",
"percent": 0,
"amountInCents": null
}
],
"statusHistory": [
{
"status": {
"id": 0,
"name": "string"
},
"updatedAt": "string"
}
],
"sender": {
"name": "string",
"document": "string",
"helpdesk": "string"
},
"payinRefunds": [
{
"id": 1,
"payinId": 1,
"statusId": 2,
"user": {
"id": 1,
"name": "Usuário de Teste"
},
"clientId": 1,
"amountCents": 100,
"statuses": [
{
"id": 1,
"statusId": 1,
"name": "Solicitado",
"notification": 1,
"createdAt": "2022-03-11T17:14:47.000000Z"
},
{
"id": 2,
"statusId": 2,
"name": "Pago",
"notification": 1,
"createdAt": "2022-03-11T17:14:49.000000Z"
}
],
"endToEndId": "string",
"reason": "strind",
"callbackUrl": "https://payin-refund.requestcatcher.com/",
"createdAt": "2022-03-11T17:31:03.000000Z",
"updatedAt": "2022-03-11T17:31:05.000000Z"
}
],
"refundAmountCents": 1000
}

Exemplos de código


var axios = require('axios');
var data = JSON.stringify({
"clientId": 15,
"customNumber": "258688a0-92ee-42a6-b84d-ea54c6aeaac3",
"callbackUrl": "https://enehias.requestcatcher.com/",
"title": {
"expireDate": "2022-07-25T16:20:00",
"amountInCents": 5000,
"instructions": "any bank"
},
"buyer": {
"name": "Name",
"document": {
"number": "01234567890",
"type": "CPF"
},
"address": {
"street": "Rua da praça",
"number": "123",
"complement": "conjunto comercial",
"zipCode": "99090900",
"city": "Curitiba",
"district": "Centro",
"stateCode": "PR"
}
}
});

var config = {
método: 'post',
url: 'https://api.sandbox.wepayout.co/v1/payin/payments/pix',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_KEY'
},
data : data
};

axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});

Cobrança com divisão aos destinatários

endpoint: /v1/payin/payments/boleto

método: POST

Exemplo de payload e response

Payload
{
"clientId": 104,
"customNumber": "1234",
"callbackUrl": "https://payin-test.requestcatcher.com/",
"title": {
"expireDate": "2021-11-29",
"amountInCents": 15000,
"instructions": "PAGÁVEL DE QUALQUER BANCO COM QR CODE PIX"
},
"buyer": {
"name": "NAME",
"document": {
"type": "CPF",
"number": "1234567890"
},
"address": {
"street": "Rua da praça",
"number": "123",
"complement": "conjunto comercial",
"zipCode": "99090900",
"city": "Curitiba",
"district": "Centro",
"stateCode": "PR"
}
},
"splits" : [
{
"walletUUID":"d953bf82-25a1-4665-807e-4398eb2ebf6b",
"percent": 50
},
{
"walletUUID":"c708f21c-3995-47bd-bbcd-b6c924455e55",
"percent": 50
}
]
}
Response
{
"key": "string",
"clientId": 0,
"clientName": "string",
"buyerName": "string",
"buyerDocument": "string",
"customNumber": "string",
"ourNumber": "string",
"digitableLine": "string",
"barCodeNumber": "string",
"status": {
"name": "string",
"id": "string"
},
"typePayin": "string",
"amountCents": 0,
"paidAmountCents": null,
"paidAt": null,
"expiresAt": "2019-08-24T14:15:22Z",
"createdAt": "2019-08-24T14:15:22Z",
"fine": null,
"discount": null,
"splits": [
{
"walletOwner": "string",
"walletUUID": "string",
"percent": 0,
"amountInCents": null
}
],
"statusHistory": [
{
"status": {
"id": 0,
"name": "string"
},
"updatedAt": "string"
}
],
"sender": {
"name": "string",
"document": "string",
"helpdesk": "string"
},
"payinRefunds": [
{
"id": 1,
"payinId": 1,
"statusId": 2,
"user": {
"id": 1,
"name": "Usuário de Teste"
},
"clientId": 1,
"amountCents": 100,
"statuses": [
{
"id": 1,
"statusId": 1,
"name": "Solicitado",
"notification": 1,
"createdAt": "2022-03-11T17:14:47.000000Z"
},
{
"id": 2,
"statusId": 2,
"name": "Pago",
"notification": 1,
"createdAt": "2022-03-11T17:14:49.000000Z"
}
],
"endToEndId": "string",
"reason": "strind",
"callbackUrl": "https://payin-refund.requestcatcher.com/",
"createdAt": "2022-03-11T17:31:03.000000Z",
"updatedAt": "2022-03-11T17:31:05.000000Z"
}
],
"refundAmountCents": 1000
}

Exemplos de código

var axios = require('axios');
var data = JSON.stringify({
"clientId": 104,
"customNumber": "1234",
"callbackUrl": "https://payin-test.requestcatcher.com/",
"title": {
"expireDate": "2021-11-29",
"amountInCents": 15000,
"instructions": "PAGÁVEL DE QUALQUER BANCO COM QR CODE PIX"
},
"buyer": {
"name": "NAME",
"document": {
"type": "CPF",
"number": "1234567890"
},
"address": {
"street": "Rua da praça",
"number": "123",
"complement": "conjunto comercial",
"zipCode": "99090900",
"city": "Curitiba",
"district": "Centro",
"stateCode": "PR"
}
},
"splits": [
{
"walletUUID": "d953bf82-25a1-4665-807e-4398eb2ebf6b",
"percent": 50
},
{
"walletUUID": "c708f21c-3995-47bd-bbcd-b6c924455e55",
"percent": 50
}
]
});

var config = {
método: 'post',
url: 'https://api.sandbox.wepayout.com.br/v1/payin/payments/boleto',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_KEY'
},
data : data
};

axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});

Webhook

Atualização da cobrança

Quando uma cobrança tem os status alterado, é disparado uma requisição post para a url informada no atributo callbackUrl da criação da cobrança.

Todos os webhooks de cobrança são assinados com um hash sha256 fornecido no cabeçalho x-webhook-wpo-signature. O hash é enviado como uma Bearer token, ex: Bearer {hash}. Para validar a assinatura você precisa concatenar os campos id, key e amountCents da cobrança com a APIKey usada para criar as cobranças, e fazer o hash dessa string usando o algoritmo sha256.

Por exemplo: 1KEY120APIKEY

  • Se você não tem desconto, não envie a chave discount no data;
  • Se você possui discount.percent, então você deve mandar discount.percent e o discount.date;
  • Se voce possui discount.amountInCents, então você deve mandar discount.amountInCents e o discount.date;
  • Se voce possui discount.dailyAmountInCents, então NÃO precisa enviar os outros campos de percent, date e amount;
Payload
{
"id": 0,
"key": "string",
"clientId": 0,
"clientName": "string",
"buyerName": "string",
"buyerDocument": "string",
"customNumber": "string",
"ourNumber": "string",
"digitableLine": "string",
"barCodeNumber": "string",
"status": "string",
"statusCode": 0,
"typePayin": "string",
"amountCents": 0,
"paidAmountCents": null,
"paidAt": null,
"expiresAt": "2019-08-24T14:15:22Z",
"createdAt": "2019-08-24T14:15:22Z",
"fine": null,
"discount": null,
"splits": [
{
"walletOwner": "string",
"walletUUID": "string",
"percent": 0,
"amountInCents": null
}
],
"statusHistory": [
{
"status": {
"id": 0,
"status": "string",
"statusCode": 0,
"updatedAt": "2022-03-11T17:14:47.000000Z",
"status_detail": "string | apenas para status rejeitado",
"status_detail_description": "string | apenas para status rejeitado"
}
}
],
"sender": {
"name": "string",
"document": "string",
"helpdesk": "string"
},
"payinRefunds": [
{
"id": 1,
"payinId": 1,
"statusId": 2,
"user": {
"id": 1,
"name": "Usuário de Teste"
},
"clientId": 1,
"amountCents": 100,
"statuses": [
{
"id": 1,
"statusId": 1,
"name": "Solicitado",
"notification": 1,
"createdAt": "2022-03-11T17:14:47.000000Z"
},
{
"id": 2,
"statusId": 2,
"name": "Pago",
"notification": 1,
"createdAt": "2022-03-11T17:14:49.000000Z"
}
],
"endToEndId": "EFASA321654987456ASAS123",
"reason": "Devolvendo valores de teste",
"callbackUrl": "https://payin-refund.requestcatcher.com/",
"createdAt": "2022-03-11T17:31:03.000000Z",
"updatedAt": "2022-03-11T17:31:05.000000Z"
}
],
"refundAmountCents": 1000
}