Skip to main content

Create a Pix Cash-In

Dedicated endpoint to create a charge (cash-in) using Pix as a payment method.

POST/v1/chash-in/pix

Request Body Params

All parameters listed below are mandatory, with the exception of those marked as optional.

AttributeTypeDescription
amountint32 || floatAmount to be charged. If the value contains cents, it must be passed in float format (Ex. 100.12 -> One hundred reais and twelve cents).
item_idstringCharge/Order ID on your platform.
customerobjectCliente object.
customer[name]stringCustomer name.
customer[email]stringCustomer email.
customer[document_number]stringCustomer document number (Brazilian CPF).
customer[phone_number]stringCustomer phone number.
customer[address]objectCustomer address object.
customer[address][zipcode]stringCEP (domestic customers - in Brazil) of the customer.
customer[address][country]stringCustomer's nationality, in country acronym format. Only the ISO 3166-1 alpha-2 (two-letter) format will be accepted

E.g.: BR, US, CA...
customer[address][state]stringState of the current customer address, in State acronym format, ISO 3166-1 alpha-2 (two-letter).

E.g.: TX, WY, MO...
customer[address][city]stringCity of the customer's address.
customer[address][neighborhood]stringNeighborhood of the customer's address.
customer[address][street]stringStreet of the customer's address.
customer[address][number]stringCustomer's address number.
customer[address][complement]stringOptional parameter of the complement of the customer's address.
soft_descriptorstringCharge payment description that will appear on the customer's bank statement.
simulate_statusstringOptional parameter to "simulate" some statuses during the development phase, since it is not possible to pay a Pix transaction in the Sandbox.

Accepted values: paid and failed.
webhook_urlstringOptional parameter to receive notifications about all status changes of a charge.
webhook_auth_tokenstringOptional parameter to authenticate the notifications sent to the webhook_url. If the parameter is not informed, the notifications will be sent without authentication.

Response Object

When a successful cash-in operation is created in our API, below is the payload of the response object.

PropertyTypeDescription
statusstringStatus to validate that the operation was successful and the pix is active.

Default value: active.
date_createddateTimeOperation creation date in ISODateTime format.
date_updateddateTimeOperation status updated date in ISODateTime format.
cash_in_idstringMarlim operation identifier number.
amountint32 || floatAmount to be charged to the paying customer.
paid_amountint32 || floatAmount paid by the paying customer.

Default value: 0.
customer_namestringPaying customer name.
customer_document_numberstringPaying customer document number.
pix_copy_pastestringString for the customer to copy and paste to make the payment in the bank application.
pix_image_base64stringString to create the QR Code in the UI of your application for the customer to make the payment in the bank application.

Webhooks

The entire process of changing the status of a cash-in operation is asynchronous. Therefore, it is important that you pass a webhook_url during the process of creating an operation so that your application receives all status changes. This url of your application can be opened to receive payloads from Marlim Servers (you can validate the payloads received by our application), or if this url requires authentication, you can pass a webhook_auth_token for Marlim to send the webhooks with authentication in the HEADER of the request.

ValueDescription
paidOperation paid and successfully captured.
failedThe bank reported a payment failure during capture.
cancelledFor some operational reason this cash-in ID was canceled and can no longer be paid.
expiredAfter 24 hours without completing the payment, this cash-in expires and can no longer be paid.

If no value is passed in webhook_url, you will be able to consult the current status of the operation in the future using the GET endpoint and filtering the cash-in, using the cash_in_id property.

Samples

Note

The values used in the examples below are for illustration purposes only and should not be used for testing requests. In a development or testing environment, use data that is closer to a real transaction (real data from a payer). If you use dummy values the API may not work as expected.

Request
curl -X POST "https://api.bet.marlim.co/v1/chash-in/pix" \
-H "Content-Type: application/json" \
-H "api_key: api_key_value" \
-d '{
"amount": 10,
"item_id": "123456789",
"customer": {
"name": "Luke Skywalker",
"email": "luke@jedimaster.sw",
"document_number": "00099988877",
"phone_number": "+5511988776655",
"address": {
"country": "BR",
"state": "SP",
"city": "São Paulo",
"neighborhood": "Some Neighborhood",
"street": "Some Street",
"number": "1234",
"zipcode": "05544001"
}
},
"soft_descriptor": "Star Wars Company"
}'
Response200
{
"status": "active",
"date_created": "2023-09-11T12:30:28.746Z",
"date_updated": "2023-09-11T12:30:28.746Z",
"cash_in_id": "os7WT0bCGbWxAjAv2eT6",
"amount": 10,
"paid_amount": 0,
"customer_name": "Luke Skywalker",
"customer_document_number": "00099988877",
"pix_copy_paste": "00020101021226930014 --- 6304B67D",
"pix_image_base64": "iVBORw0KGgoAAAANSUhE --- rkJggg=="
}