Payin
For more details, access the open api
Url of the environments
- Sandbox: https://api.sandbox.wepayout.com.br
- Production: https://api.wepayout.com.br
Attention
To use these endpoints you need a API KEY.
Simple charge
endpoint: /v1/payin/payments/{chargeType}
The route parameter {chargeType} should be boleto or pix.
method: POST
Samples of payload and 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
}
Samples codes
- NodeJs
- Python
- Java
- PHP
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 = {
method: '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);
});
import requests
import json
url = "https://api.sandbox.wepayout.com.br/v1/payin/payments/pix"
payload = json.dumps({
"clientId": 15,
"customNumber": "dd30351a-e3ad-436f-8245-052b12a1c77d",
"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"
}
}
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_KEY'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
class ExempleClass {
public static void main(String args[]) {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"clientId\": 15,\n \"customNumber\": \"7c28d442-9562-4fa7-b602-de44690aff2a\",\n \"callbackUrl\": \"https://payin-test.requestcatcher.com/\",\n \"title\": {\n \"expireDate\": \"2022-07-25T16:20:00\",\n \"amountInCents\": 5000,\n \"instructions\": \"any bank\"\n },\n \"buyer\": {\n \"name\": \"Name\",\n \"document\": {\n \"number\": \"01234567890\",\n \"type\": \"CPF\"\n },\n \"address\": {\n \"street\": \"Rua da praça\",\n \"number\": \"500\",\n \"complement\": \"Conjunto comercial\",\n \"zipCode\": \"99999999\",\n \"city\": \"Barueri\",\n \"district\": \"ALPHAVILLE INDUSTRIAL\",\n \"stateCode\": \"SP\"\n }\n }\n}");
Request request = new Request.Builder()
.url("https://api.sandbox.wepayout.co/v1/payin/payments/pix")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer YOUR_KEY")
.build();
Response response = client.newCall(request).execute();
}
}
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.sandbox.wepayout.com.br/v1/payin/payments/pix',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"clientId": 15,
"customNumber": "37408675-f488-44f2-b79d-062daf6ebbe6",
"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"
}
}
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer YOUR_KEY'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Charge with split to recipients
endpoint: /v1/payin/payments/boleto
method: POST
Samples of payload and 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
}
Samples codes
- NodeJs
- Python
- Java
- PHP
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 = {
method: '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);
});
import requests
import json
url = "https://api.sandbox.wepayout.com.br/v1/payin/payments/boleto"
payload = json.dumps({
"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
}
]
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_KEY'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
class ExempleClass {
public static void main(String args[]) {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"clientId\": 104,\n\t\"customNumber\": \"1234\",\n \"callbackUrl\": \"https://payin-test.requestcatcher.com/\",\n\t\"title\": {\n\t\t\"expireDate\": \"2021-11-29\",\n\t\t\"amountInCents\": 15000,\n\t\t\"instructions\": \"PAGÁVEL DE QUALQUER BANCO COM QR CODE PIX\"\n\t},\n\t\"buyer\": {\n\t\t\"name\": \"NAME\",\n\t\t\"document\": {\n\t\t\t\"type\": \"CPF\",\n\t\t\t\"number\": \"1234567890\"\n\t\t},\n\t\t\"address\": {\n\t\t\t\"street\": \"Rua da praça\",\n\t\t\t\"number\": \"123\",\n\t\t\t\"complement\": \"Conjunto comercial\",\n\t\t\t\"zipCode\": \"06454000\",\n\t\t\t\"city\": \"Barueri\",\n\t\t\t\"district\": \"ALPHAVILLE INDUSTRIAL\",\n\t\t\t\"stateCode\": \"SP\"\n\t\t}\n\t},\n \"splits\" : [\n \t {\n \t \"walletUUID\":\"d953bf82-25a1-4665-807e-4398eb2ebf6b\",\n \"percent\": 50\n \t },\n \t {\n \t \"walletUUID\":\"c708f21c-3995-47bd-bbcd-b6c924455e55\",\n \"percent\": 50\n \t }\n ]\n}");
Request request = new Request.Builder()
.url("https://api.sandbox.wepayout.com.br/v1/payin/payments/boleto")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer YOUR_KEY")
.build();
Response response = client.newCall(request).execute();
}
}
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.sandbox.wepayout.co/v1/payin/payments/boleto',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"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
}
]
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer YOUR_KEY'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Webhook
Receive payin status updates.
When a charge has its status changed, a post request is fired to the url entered in the callbackUrl attribute of the charge creation.
All charges webhooks are signed with an sha256 hash provided in the x-webhook-wpo-signature
header.
The hash is sent as a Bearer token. eg.: Bearer {hash} To validate the signature you must concatenate the charge id, key, amountCents and your APIKey
used to create the charges and hash this string using the sha256 algorithm.
For example: 1KEY120APIKEY
- If you don't have a discount, don't send the discount key in the data;
- If you have discount.percent, then you must send discount.percent and discount.date;
- If you have discount.amountInCents, then you must send discount.amountInCents and discount.date;
- If you have discount.dailyAmountInCents, then you DON'T need to send the other fields percent, date and 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 | only when status rejected",
"status_detail_description": "string | only when status rejected"
}
}
],
"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
}