Boleto
With Mercado Pago's Checkout Transparente, it is also possible to offer payments with boleto bancário.
With these payment methods, buyers will be able to make a deferred cash payment, always within the established deadline for its due date, and they will need to wait for it to be credited to consider the purchase completed.
If you already set up your environment and want to offer payments with boleto bancário, follow the steps below.
processing_mode parameter. For more information, visit the section Integration model.To be able to receive payments, you need to add a form in the frontend that securely captures the payer's information.
If you already have a development that includes your own payment form, make sure to include boleto among the payment options you want to offer, as indicated below, and continue to the next step.
zip_code, street_name, street_number, neighborhood, city and state fields are present in the payment form, and that the buyer fill them out correctly. If you have already made a configuration without these fields in it, you must update it to make sure your payments get processed correctly.
If you do not have a payment form, add the form below to your project, including the identifier for boleto bancário among the payment methods to be offered.| Payment method | payment_method_id |
| Boleto bancário | boleto |
html<form id="form-checkout" action="/process_payment" method="post"> <div> <h1>Payer Request</h1> <div> <label for="payerFirstName">Nome</label> <input id="form-checkout__payerFirstName" name="payerFirstName" type="text"> </div> <div> <label for="payerLastName">Sobrenome</label> <input id="form-checkout__payerLastName" name="payerLastName" type="text"> </div> <div> <label for="email">E-mail</label> <input id="form-checkout__email" name="email" type="text"> </div> <div> <label for="identificationType">Tipo de documento</label> <input id="form-checkout__identificationType" name="identificationType" type="text"></input> </div> <div> <label for="identificationNumber">Número do documento</label> <input id="form-checkout__identificationNumber" name="identificationNumber" type="text"> </div> <div> <label for="zip_code"> CEP: </label> <input id="form-checkout__zip_code" name="zip_code" type="text"> </div> <div> <label for="street_name"> Rua: </label> <input id="form-checkout__street_name" name="street_name" type="text"> </div> <div> <label for="street_number"> Número: </label> <input id="form-checkout__street_number" name="street_number" type="text"> </div> <div> <label for="neighborhood"> Bairro: </label> <input id="form-checkout__neighborhood" name="neighborhood" type="text"> </div> <div> <label for="city"> Cidade: </label> <input id="form-checkout__city" name="city" type="text"> </div> <div> <label for="federal_unit"> Estado: </label> <input id="form-checkout__federal_unit" name="federal_unit" type="text"> </div> </div> <div> <div> <input type="hidden" name="transactionAmount" id="transactionAmount" value="100"> <input type="hidden" name="description" id="description" value="Nome do Produto"> <br> <button type="submit">Pagar</button> </div> </div> </form>
To facilitate the correct entry of data in the payment form, it is necessary to obtain the possible document types to be accepted.
The function below will allow you to automatically populate the available options, thanks to the inclusion of the select element with the id: form-checkout__identificationType found in the form used as an example in the previous step.
If you already have a development that includes the retrieval of document types, as indicated below, proceed to Submit payment.
If you do not have this function, add the following to your project.
javascript(async function getIdentificationTypes() { try { const identificationTypes = await mp.getIdentificationTypes(); const identificationTypeElement = document.getElementById('form-checkout__identificationType'); createSelectOptions(identificationTypeElement, identificationTypes); } catch (e) { return console.error('Error getting identificationTypes: ', e); } })(); function createSelectOptions(elem, options, labelsAndKeys = { label: "name", value: "id" }) { const { label, value } = labelsAndKeys; elem.options.length = 0; const tempOptions = document.createDocumentFragment(); options.forEach(option => { const optValue = option[value]; const optLabel = option[label]; const opt = document.createElement('option'); opt.value = optValue; opt.textContent = optLabel; tempOptions.appendChild(opt); }); elem.appendChild(tempOptions); }
The payment submission must be made by creating an order that contains associated payment transactions.
To do this, send a request with your test Access TokenPrivate key linked to an application, used in the backend to authenticate operations in the test environment. You can find it in the application's Credentials section, within the test environment. It cannot process real payments, must never be exposed in the frontend, and starts with the `APP_USR` prefix. and the required parameters listed below to the endpoint /v1/ordersPOST.
processing_mode=manual) can have an expiration period defined in the expiration_time field. If the field is not sent, the default period is P1D (one day). When the period expires before the order reaches a final status, it is automatically closed, the associated pending payments are canceled, and the integrator is notified.curlcurl -X POST \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer {{YOUR_ACCESS_TOKEN}}' \ -H 'X-Idempotency-Key: {{SOME_UNIQUE_VALUE}}' \ 'https://api.mercadopago.com/v1/orders' \ -d '{ "type": "online", "external_reference": "ext_ref_1234", "processing_mode": "automatic", "total_amount": "50.00", "description": "some description", "payer": { "email": "test_payer@example.com", "first_name": "John", "last_name": "Doe", "identification": { "type": "CPF", "number": "99999999999" }, "address": { "street_name": "Av. das Nações Unidas", "street_number": "3003", "zip_code": "06233903", "neighborhood": "Bonfim", "state": "SP", "city": "Osasco" } }, "config": { "location": { "state_id": "BR-SP" } }, "transactions": { "payments": [ { "amount": "50.00", "payment_method": { "id": "boleto", "type": "ticket" } } ] } }'
429 Too Many Requests error, wait the time indicated in the Retry-After response header before retrying. See Possible errors for more details.See the table below for descriptions of the parameters that are mandatory in the request and those that, although optional, have some important particularity that should be highlighted.
| Parameter | Type | Description | Requirement |
Authorization | Header | Refers to your private key, the test Access TokenPrivate key linked to an application, used in the backend to authenticate operations in the test environment. You can find it in the application's Credentials section, within the test environment. It cannot process real payments, must never be exposed in the frontend, and starts with the `APP_USR` prefix.. | Required |
X-Idempotency-Key | Header | Idempotency key. It is used to ensure that each request is processed only once, avoiding duplications. Use a unique value in the header of your request, such as a UUID V4 or random strings. | Required |
processing_mode | Body. String | Processing mode of the order. The possible values are: - automatic: to create and process the order in automatic mode. - manual: to create the order and process it later. For more information, visit the section Integration model. | Required |
expiration_time | Body. String | When an order is created in manual mode (processing_mode=manual), this parameter lets you define its expiration time using the ISO 8601 duration format. The period starts at created_date and the maximum limit is 2920 hours. If not sent, the default value will be P1D (one day). This parameter must not be sent when creating an order in automatic mode (processing_mode=automatic). | Optional |
config.location | Body. Object | Information about the payer's location. | Optional |
config.location.state_id | Body. String | Code of the payer's state, province, or administrative region, formed by the two-letter country code, followed by a hyphen and the location code. See the accepted values.Acre (BR-AC); Alagoas (BR-AL); Amapá (BR-AP); Amazonas (BR-AM); Bahia (BR-BA); Ceará (BR-CE); Distrito Federal (BR-DF); Espírito Santo (BR-ES); Goiás (BR-GO); Maranhão (BR-MA); Mato Grosso (BR-MT); Mato Grosso do Sul (BR-MS); Minas Gerais (BR-MG); Pará (BR-PA); Paraíba (BR-PB); Paraná (BR-PR); Pernambuco (BR-PE); Piauí (BR-PI); Rio de Janeiro (BR-RJ); Rio Grande do Norte (BR-RN); Rio Grande do Sul (BR-RS); Rondônia (BR-RO); Roraima (BR-RR); Santa Catarina (BR-SC); São Paulo (BR-SP); Sergipe (BR-SE); Tocantins (BR-TO). | Optional |
total_amount | Body. String | Total amount for the transaction. | Required |
payer.email | Body. String | Buyer’s e-mail. | Required |
payer.identification.type | Body. String | Buyer’s identification type. | Required |
payer.identification.number | Body. String | Buyer’s identification number. | Required |
payer.address.street_name | Body. String | Payer's address street name. | Required |
payer.address.street_number | Body. String | Payer's address street number. If you do not have a number, send "N/A". | Required |
payer.address.zip_code | Body. String | Payer's address zip code. | Required |
payer.address.neighborhood | Body. String | Payer's address neighborhood. | Required |
payer.address.state | Body. String | State where the payer's address is located. For Brazil, this parameter only accepts two characters. Example: SP | Required |
payer.address.city | Body. String | City where the payer's address is located. | Required |
transaction.payments.payment_method.id | Body. String | Identifier of the payment method. In this case, the value should be boleto. | Required |
transaction.payments.payment_method.type | Body. String | Type of the payment method. In the case of payments with a slip, the value should be ticket. | Required |
transactions.payments.expiration_time | Body. String | Allows you to set the due date using the ISO 8601 duration format. By default, the due date of the boleto is 3 business days, but it can be changed through this parameter. If the calculated date falls on a weekend, it will automatically be adjusted to the next business day - this adjustment also applies to custom expiration_time values, not only to the default 3-day term. The date can be set between 1 and 30 days after the payment is created. We recommend setting a duration of at least 3 days (“P3D", as in the example) to avoid conflicts between the due date and the crediting of the payment, which can take up to 2 business hours from the moment it is made. In case the payment is made after the established expiration date, the amount will be refunded to the payer's Mercado Pago account. | Optional |
json{ "id": "ORD01J6TC8BYRR0T4ZKY0QR39WGYE", "processing_mode": "automatic", "external_reference": "ext_ref_1234", "marketplace": "NONE", "total_amount": "50.00", "country_code": "BRA", "user_id": "1245621468", "created_date": "2024-09-02T22:04:01.880469Z", "last_updated_date": "2024-09-02T22:04:04.429289Z", "type": "online", "status": "action_required", "status_detail": "waiting_payment", "capture_mode": "automatic", "integration_data": { "application_id": "4599991948843755" }, "transactions": { "payments": [ { "id": "PAY01J6TC8BYRR0T4ZKY0QRTZ0E24", "reference_id": "22dvqmsbq8c", "amount": "50.00", "status": "action_required", "status_detail": "waiting_payment", "payment_method": { "id": "boleto", "type": "ticket", "ticket_url": "https://www.mercadopago.com.ar/payments/86797024510/ticket?caller_id=1870026883&payment_method_id=rapipago&payment_id=86797024510&payment_method_reference_id=6004835002&hash=0331521a-9ddb-44a2-851c-65f77d8d394e", "barcode_content": "3335008800000000006004835002100020000242462010", "reference": "1234567890", "verification_code": "1234567890", "financial_institution": "boleto", "digitable_line": "23793380296060054351030006333303799140000020000" } } ] } }
Among the returned parameters, we have those indicated in the table below.
| Parameter | Type | Description |
transaction.payments.status | String | Returns the status of the transaction. In this case, it will return action_required to indicate the need for action to complete processing, that is, until the payment of the boleto is made. |
transaction.payments.status_detail | String | In this case, the obtained status_detail is waiting (waiting_payment) for the user to complete the payment process of the boleto with their bank. |
transaction.payments.payment_method.ticket_url | String | URL that contains the instructions for the buyer to complete the payment of the boleto, which you should redirect them to. |
transaction.payments.payment_method.barcode_content | String | Displays a barcode in EAN-13 format to be used for the payment of the boleto. |
transaction.payments.payment_method.financial_institution | String | Banking institution responsible for processing the boleto. |
transaction.payments.payment_method.digitable_line | String | Displays the digital line of the barcode, a way to pay for the boleto online and also in cases where the barcode is damaged. |
expiration_time | String | Expiration period (in ISO 8601 format) returned for an order created in manual mode (processing_mode=manual), counted from created_date. When omitted from the request, the returned default will be P1D (one day). This parameter will not be returned for an order created in automatic mode (processing_mode=automatic). |
If you wish, you can cancel a payment created, as long as it is pending or in process; that is, with status=action_required.
Additionally, we recommend canceling payments that were not made by the established due date to avoid billing and reconciliation issues.
For more information, please consult the Refunds and cancellations section.