# MD for: https://www.mercadopago.com.br/developers/pt/docs/checkout-api-orders/payment-integration/boleto.md \# 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\](https://www.mercadopago.com.br/developers/en/docs/checkout-api-orders/development-environment) and want to offer payments with boleto bancário, follow the steps below. > NOTE > > Remember: before setting up the payment methods, choose the way you will process your transactions. The processing mode, whether \*\*manual or automatic\*\*, will be defined at the time of order creation, using the \`processing\_mode\` parameter. For more information, visit the section \[Integration model\](https://www.mercadopago.com.br/developers/en/docs/checkout-api-orders/integration-model). :::AccordionComponent{title="Add payment form" pill="client-side"} 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. > RED\_MESSAGE > > When setting up payments with boleto bancário, it is mandatory that the \`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 # Payer Request Nome Sobrenome E-mail Tipo de documento Número do documento CEP: Rua: Número: Bairro: Cidade: Estado: Pagar \`\`\` ::: :::AccordionComponent{title="Get document types" pill="client-side"} 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\](https://www.mercadopago.com.br/developers/en/docs/checkout-api-orders/payment-integration/boleto#:\~:text=server%2Dside-,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); } \`\`\` ::: :::AccordionComponent{title="Submit payment" pill="server-side"} The payment submission must be made by creating an order that contains associated payment transactions. > NOTE > > The creation of a payment can occur asynchronously in an order. In this scenario, the order remains in a processing state and without information. We recommend setting up \[Order topic notifications\](https://www.mercadopago.com.br/developers/en/docs/checkout-api-orders/notifications) to receive updates on the status change, including the updated order data. Alternatively, you can choose to send a \*\*GET\*\* request to the \[/v1/orders/{id}\](https://www.mercadopago.com.br/developers/en/reference/online-payments/checkout-api/get-order/get) endpoint to retrieve that updated information. To do this, send a \*\*POST\*\* with your :toolTipComponent\[test Access Token\]{content="Private key of the application created in Mercado Pago, that must be used in the backend. You can access it through \*Your integrations > Integration data > Tests > Test credentials\*. The test Access Token starts with the prefix \`APP\_USR\`."} and the required parameters listed below to the endpoint :TagComponent{tag="API" text="/v1/orders" href="/developers/en/reference/online-payments/checkout-api/create-order/post"} and execute the request. \`\`\`curl curl -X POST \\ -H 'accept: application/json' \\ -H 'Content-Type: application/json' \\ -H 'Authorization: Bearer ' \\ -H 'X-Idempotency-Key: ' \\ '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\_user\_br@testuser.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" } }, "transactions": { "payments": \[ { "amount": "50.00", "payment\_method": { "id": "boleto", "type": "ticket" } } \] } }' \`\`\` 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. | Atribute | Type | Description | Requirement | |---------------------------------------------------|-----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------| | \`Authorization\` | \_Header\_ | Refers to your private key, the :toolTipComponent\[test Access Token\]{content="Private key of the application created in Mercado Pago, that must be used in the backend. You can access it through \*Your integrations > Integration data > Tests > Test credentials\*. The test Access Token starts with the prefix \`APP\_USR\`."}. | 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\](https://www.mercadopago.com.br/developers/en/docs/checkout-api-orders/integration-model). | Required | | \`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.adress.street\_name\` | \_Body. String\_ | Payer's address street name. | Required | | \`payer.adress.street\_number\` | \_Body. String\_ | NPayer's address street number. If you do not have a number, send "N/A". | Required | | \`payer.adress.zip\_code\` | \_Body. String\_ | Payer's address zip code. | Required | | \`payer.adress.neighborhood\` | \_Body. String\_ | Payer's address neighborhood. | Required | | \`payer.adress.state\` | \_Body. String\_ | State where the payer's address is located. For Brazil, this parameter only \*\*accepts two characters\*\*. Example: SP | Required | | \`payer.adress.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. 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 | > SUCCESS\_MESSAGE > > To learn in detail about all the parameters sent and returned in this request, please refer to our \[API Reference\](https://www.mercadopago.com.br/developers/en/reference/online-payments/checkout-api/create-order/post). Additionally, if you receive an error when submitting the payment, you can consult our \[list of errors\](https://www.mercadopago.com.br/developers/en/docs/checkout-api-orders/payment-management/integration-errors). After sending the payment request, the response will include the following information: \`\`\`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. | Atribute | 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. | > WARNING > > If you have created the order in manual mode, remember that processing the payment requires an additional step, which is calling the :TagComponent{tag="API" text="Process order" href="/developers/en/reference/online-payments/checkout-api/process-order/post"}. ::: :::AccordionComponent{title="Cancel payment" pill="server-side"} 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. > WARNING > > If 30 days pass after the established due date for a payment and it has not been made, Mercado Pago will consider it expired. In these cases, it is not possible to perform a manual cancellation, and the payment status will change to canceled or expired. For more information, please consult the \[Refunds and cancellations\](https://www.mercadopago.com.br/developers/en/docs/checkout-api-payments/payment-management/refunds-cancellations) section. :::