# Boleto Bancário
source: https://developer.mastercard.com/mastercard-gateway/documentation/payment-methods/alt-pay-methods/a2a/boleto-bancario/index.md

Boleto Bancário is an e-commerce payment system used in Brazil that allows payers to purchase using either cash payments or through online banking payments. When the payer selects Boleto Bancário on the checkout page and proceeds with a cash payment, the payment details are displayed on screen and can be printed. The payer can then pay the amount required for the purchase at a Boleto Bacário location. For online banking payments, the payer enters the Boleto Bancário details, and reviews and authorizes the payment. In both cases, once the payment is made, you will be notified and the goods may be released to be shipped to the payer.

Boleto Bancário is a supported browser payment method in the Mastercard Gateway. This page describes integration details specific to Boleto Bancário. It is recommended that you read the [integration guidelines for browser payments](https://developer.mastercard.com/mastercard-gateway/documentation/payment-methods/imp-brow-pay-int/index.md) before building a Boleto Bancário integration.

Boleto Bancário browser payments are only supported for transactions in the USD currency.
Warning:   

* Due to security reasons, the Boleto can only be accessed on the Mastercard Gateway for 48 hours or a maximum of five times, after which Boleto will no longer be available. The Boleto payment will expire as per your configuration.
* Boletos are always generated as PDF files. If you require these files to be available to payers for an extended period of time, you must save copies of them on your local server.

## Prerequisites {#prerequisites}

To offer Boleto Bancário as a payment method through the Mastercard Gateway:

* Be registered with your browser payments service provider.
* Your merchant profile on the gateway must be configured using the details of your account with the browser payments service provider.
* You must have a bank account in one of the supported currencies registered against your merchant account at your browser payments service provider.

## Boleto Bancário Integration {#boleto-bancário-integration}

### Boleto Bancário through Hosted Checkout {#boleto-bancário-through-hosted-checkout}

Boleto Bancário through Hosted Checkout will be available soon. Contact your payment service provider for further information.

### Boleto Bancário through Direct Payment {#boleto-bancário-through-direct-payment}

Direct Payment integration allows you to offer Boleto Bancário payment method on your own checkout page.

Alert: Boleto Bancário is supported from Mastercard Gateway API version 50 and later.

<br />

In addition to the [standard fields](https://developer.mastercard.com/mastercard-gateway/documentation/payment-methods/imp-brow-pay-int/index.md#browser-payments-through-direct-payment-integration) required in a browser payment request, provide the following fields in the Initiate Browser Payment request:

* `sourceOfFunds.type` = BOLETO_BANCARIO
* `browserPayment.operation` = PAY (the Authorize operation is not supported by Boleto Bancário)
* `billing.address.*`: Details of the payer's billing address.
* `customer.email`: The email address of the payer.
* `customer.account.id`: Your identifier for the payer's account with you.
* `customer.nationalId`: An identifier for the payer assigned by a government authority.
* `sourceOfFunds.provided.boletoBancario.bankAccountHolder`: The name of the bank account holder for the payer's bank account.

##### Preferred Language {#preferred-language}

You can set the language that you prefer Boleto Bancário to use for pages that are displayed to the payer by providing the `browserPayment.preferredLanguage` field in the Initiate Browser Payment request. However, the language will be used only if Boleto Bancário supports it.

#### Sample Code to Initiate Boleto Bancário Payment {#sample-code-to-initiate-boleto-bancário-payment}

```json
{
  "apiOperation": "INITIATE_BROWSER_PAYMENT",
  "billing": {
    "address": {
      "street": "10 Upper Bank Street",
      "postcodeZip": "E14 5NP",
      "city": "London",
      "country": "GBR"
    }
  },
  "browserPayment": {
    "operation": "PAY",
    "returnUrl": "<your_merchant_URL>"
  },
  "customer": {
    "email": "john.smith@example.com",
    "account": {
      "id": "1234567890"
    },
    "nationalId": "1234567890"
  },
  "order": {
    "amount": "10.00",
    "currency": "USD"
  },
  "sourceOfFunds": {
    "type": "BOLETO_BANCARIO",
    "provided": {
      "boletoBancario": {
        "bankAccountHolder": "John Smith"
      }
    }
  }
}
```

## How to Interpret the Transaction Result {#how-to-interpret-the-transaction-result}

The table below shows the transaction Response Codes for the possible scenarios that you may encounter after initiating a Boleto Bancário payment.

|                      Initiate Browser Payment Response                      |                                                                                                                  What This Means...                                                                                                                  |
|-----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `response.gatewayCode=SUBMITTED` `result=SUCCESS`                           | Redirect the payer using the URL provided in the response.                                                                                                                                                                                           |
| **Retrieve Transaction/Retrieve Order Response**                            | **What This Means...**                                                                                                                                                                                                                               |
| `response.gatewayCode=APPROVED` `result=SUCCESS`                            | The payment is successful.                                                                                                                                                                                                                           |
| `response.gatewayCode=PENDING` `result=PENDING`                             | The Mastercard Gateway is waiting for a notification from the acquirer about the payment result. Try `RETRIEVE_TRANSACTION` again later or listen to notifications from the Mastercard Gateway.                                                      |
| `response.gatewayCode=CANCELLED` `result=FAILURE`                           | The payer has canceled the interaction for this payment. Offer the payer the option to try another payment method.                                                                                                                                   |
| `response.gatewayCode=DECLINED` or `ACQUIRER_SYSTEM_ERROR` `result=FAILURE` | The payment was declined. Offer the payer the option to try another payment method. In the case of an `ACQUIRER_SYSTEM_ERROR` you may want to inquire with the acquirer the reason for payment failure, or you can try `RETRIEVE_TRANSACTION` again. |
| `response.gatewayCode=TIMED_OUT` `result=FAILURE`                           | Treat this as a declined payment. The Mastercard Gateway will attempt to ensure that the transaction is not successful or will revert the transaction.                                                                                               |

## Testing your Integration {#testing-your-integration}

The Mastercard Gateway provides a browser payments emulator that allows you to \[test your Boleto Bancário integration\].
