Boleto

Overview

Introduction

Boleto is a payment method which allows to process payments in Brazilian reals and US dollars by using vouchers in Brazil. This method supports purchases.

This article provides information about working with the Boleto method: general insights are presented in the Overview section, while information about the actions required to process payments and perform other actions is presented in the sections that follow.

General information

Payment method type point of sale payments
Payment instruments vouchers
Countries and regions BR
Payment currencies BRL, USD
Currency conversion
One-time purchases +
Credential-on-file purchases
Full refunds
Partial refunds
Payouts
Chargebacks
Notes
  • depending on the payment processing provider, the validity period of the payment voucher can be one of the following:
    • 8 days, but a customer has 30 days to complete the payment by contacting the bank
    • 3 days
  • depending on the payment processing provider, payment amounts can be integer; refer to your ecommpay key account manager for more information
Onboarding and access fee refer to your ecommpay key account manager, additional information available in the ecommpay shop

Interaction diagram

Payment processing by using the Boleto method involves the merchant's web service, one of ecommpay interfaces, the ecommpay payment platform, and technical facilities of the Boleto service.



Operations support

Various platform interfaces can be used to process payments and perform operations using the Boleto method. Purchases can be processed by using Payment Page, Gate and Dashboard (using payment links).

Processing scenarios

To perform a purchase by using the Boleto method, you need to redirect the customer to the Boleto service.

Purchases by using Payment Page

General information

To process a purchase through Payment Page by using the Boleto method, the merchant's web service is required to send a request with all required parameters and signature to the ecommpay URL and receive a callback with the result. The full sequence and special aspects of purchase processing are provided below.



Figure: Purchase processing by using Payment Page: step-by-step description

  1. A customer initiates a purchase in the web service.
  2. The web service sends the request for opening Payment Page to the specified ecommpay URL.
  3. The request for opening Payment Page is sent to the payment platform.
  4. The payment platform receives the request and validates the required parameters and signature.
  5. Payment Page is generated based on the project and request parameters.
  6. Payment Page is displayed to the customer.
  7. The customer selects the Boleto method.
  8. The requested payment form is displayed to the customer on Payment Page.
  9. The customer enters necessary personal data.
  10. Payment Page redirects the request to the payment platform for further processing.
  11. The payment platform processes the request and sends it to the Boleto service.
  12. The request is processed on the Boleto service side.
  13. The Boleto service generates a voucher for payment in kiosks or the redirection to the Boleto service data and sends it to the payment platform. Depending on the payment processing provider, the validity period of the payment voucher can either be 8 days (but a customer has 30 days to complete the payment by contacting to the bank) or 3 days.
  14. The voucher or redirection data is sent to the Payment Page.
  15. The voucher and the instructions are displayed to the customer on Payment Page or on the Boleto side after redirection. The payment status awaiting customer action or awaiting redirect result (depending on the payment processing provider) remains until the customer completes the payment.
  16. The customer completes all the payment steps required in one of the payment kiosks using the received voucher.
  17. The payment is processed in the kiosks service side.
  18. The kiosks service sends the payment result notification to the Boleto service.
  19. The Boleto service sends a notification about the result to the payment platform.
  20. The payment platform sends the payment result callback to the web service.
  21. The customer receives the payment result information from the web service.

Information about the formats of requests and callbacks used for processing payments by using the Boleto method via Payment Page is presented further in this section; general information about working with the Payment Page API is presented in Interaction concepts.

Request format

There are several things you need to consider when using the Boleto method:

  1. The following parameters required for any payment must be specified:
    • project_id—project identifier obtained from ecommpay during integration
    • payment_id—payment identifier unique within the project
    • payment_currency—payment currency code in the ISO-4217 alpha-3 format
    • payment_amount—payment amount in the smallest currency unit
    • customer_id—customer identifier unique within the project
  2. The following parameters required for any payment must be specified: project_id, payment_id, payment_currency, payment_amount, customer_id.
  3. The currency of payment can be BRL or USD.
  4. Additionally, the following customer information should be specified:
    • customer_first_name and customer_last_name—first and last names of the customer
    • customer_email—customer email address
    • customer_address—customer post address
    • customer_zip—customer post code
    • identify_doc_number—number of the customer's identity document, should consist of 11 or 14 digits.
  5. If you need to have the payment form displayed with the Boleto method selected, set the force_payment_method parameter to boleto.
  6. Additionally, any other parameters available for working with Payment Page can be used (details).
  7. After all target parameters are specified, generate a signature (details).

Thus, a correct request for opening the payment form using the Boleto method must contain the project identifier, basic payment information (identifier, amount, and currency code), customer information and signature.

{
   "project_id": 120,
   "payment_id": "580",
   "payment_amount": 10000,
   "payment_currency": "BRL",
   "customer_id": "customer1",
   "customer_first_name": "Paul",
   "customer_last_name": "Marques",
   "customer_email": "customer@example.com",
   "customer_address": "Avenida das Nações",
   "customer_zip": "123456",
   "identify_doc_number": "84887177100",
   "signature": "kUi2x9dKHAVNU0FYldOcZzUCwX6R\/ekpZhkIQg=="
}

Figure: Example of sufficient data in a purchase request

{
   "project_id": 120,
   "payment_id": "580",
   "payment_amount": 10000,
   "payment_currency": "BRL",
   "customer_id": "customer1",
   "customer_first_name": "Paul",
   "customer_last_name": "Marques",
   "customer_email": "customer@example.com",
   "customer_address": "Avenida das Nações",
   "customer_zip": "123456",
   "identify_doc_number": "84887177100",
   "signature": "kUi2x9dKHAVNU0FYldOcZzUCwX6R\/ekpZhkIQg=="
}

Callback format

The Boleto method uses the standard format for callbacks to deliver purchase results. For more information, see Callbacks.

The following is the example of a callback with information about a 100,00 BRL purchase made in the 198 project.

Figure: Example of callback data indicating that the purchase has been processed

 {
        "project_id": 198,
        "payment": {
            "id": "tet_boleto_2555",
            "type": "purchase",
            "status": "decline",
            "date": "2018-12-17T13:49:02+0000",
            "method": "boleto",
            "sum": {
                "amount": 100,
                "currency": "BRL"
            },
            "description": ""
        },
        "account": {
            "number": "20342583281"
        },
        "customer": {
            "id": "1"
            "phone": "0123849512"
        },
        "operation": {
            "id": 10785000002264,
            "type": "sale",
            "status": "decline",
            "date": "2018-12-17T13:49:02+0000",
            "created_date": "2018-12-17T13:48:58+0000",
            "request_id": "2da6493b62a13152562f465ecac9b2c893367f80f",
            "sum_initial": {
                "amount": 100,
                "currency": "BRL"
            },
            "sum_converted": {
                "amount": 100,
                "currency": "BRL"
            },
            "provider": {
                "id": 1166,
                "payment_id": "321",
                "date": "2018-12-17T13:49:01+0000",
                "auth_code": ""
            },
            "code": "0",
            "message": "Success"
        },
        "signature": "p3HCoH1BL6LhKzH5NAlALKfzTodkwHYkSuP77c4caVo5fw=="
    }

The following is the example of a callback with information about a declined purchase.

Figure: Example of callback data indicating that the purchase has been declined

 {
        "project_id": 198,
        "payment": {
            "id": "TEST_1545",
            "type": "purchase",
            "status": "decline",
            "date": "2018-12-18T08:47:45+0000",
            "method": "boleto",
            "sum": {
                "amount": 10000,
                "currency": "ARS"
            },
            "description": "ECT_TEST_1545121924660"
        },
        "account": {
            "number": "44444444444"
        },
        "customer": {
            "id": "1"
        },
        "errors": [
            {
                "code": "2284",
                "message": "Currency rate not found",
                "description": "fatal: RATE_NOT_FOUND"
            }
                ],
        "operation": {
            "id": 18399000002318,
            "type": "sale",
            "status": "decline",
            "date": "2018-12-18T08:47:45+0000",
            "created_date": "2018-12-18T08:47:44+0000",
            "request_id": "42dd4e6c84a3ddb95b1f8966efa986b1b0bbda",
            "sum_initial": {
                "amount": 50000,
                "currency": "ARS"
            },
            "sum_converted": {
                "amount": 50000,
                "currency": "ARS"
            },
            "provider": {
                "id": 1166,
                "payment_id": ""
            },
            "code": "2284",
            "message": "Currency rate not found"
        },
        "signature": "hR0GFnmCqVp5/6hm+oYUyoiNht4HVTkWtMevKrjVw=="
    }

Useful links

The following articles can be useful when implementing purchases via Payment Page:

Purchase by using Gate

General information

To process a purchase through Gate by using the Boleto method, the merchant's web service is required to do the following:

  1. Send a request with all the required parameters and signature to the ecommpay URL.
  2. Receive an intermediate callback with the payment data and pass it to the customer as payment instructions or use it to redirect the customer to the Boleto service (depending on the payment processing provider).
  3. Receive the final callback from the payment platform.

The full sequence and special aspects of purchase processing are provided below.



Figure: Purchase processing by using Gate: step-by-step description

  1. A customer initiates a purchase by using the Boleto method in the web service.
  2. The web service sends the request for processing the purchase by using Gate to the specified ecommpay URL.
  3. The payment platform receives the request.
  4. The payment platform validates the required parameters and signature in the request.
  5. The payment platform sends the response to the web service with information about the receipt of the request and its validity (details).
  6. The payment platform performs further processing of the request (with parameter consistency check) and sends it to the Boleto service.
  7. The request is processed on the Boleto service side.
  8. The Boleto service generates a voucher for payment in kiosks or the redirection to the Boleto service data and sends it to the payment platform. Depending on the payment processing provider, the validity period of the payment voucher can either be 8 days (but a customer has 30 days to complete the payment by contacting to the bank) or 3 days.
  9. The voucher or redirection data is sent to the web service.
  10. The voucher and the instructions are displayed to the customer in the web service or on the Boleto side after redirection. The payment status awaiting customer action or awaiting redirect result (depending on the payment processing provider) remains until the customer completes the payment.
  11. The customer completes all the payment steps required in one of the payment kiosks using the received voucher.
  12. The payment is processed in the kiosks service side.
  13. The kiosks service sends the payment result notification to the Boleto service.
  14. The Boleto service sends the payment result notification to the payment platform.
  15. The payment platform sends the payment result callback to the web service.
  16. The customer receives the payment result information from the web service.

Information about the formats of requests and callbacks used for processing payments by using the Boleto method via Gate is presented further in this section. General information about working with the Gate API is presented in Interaction concepts.

Request format

There are several things you need to consider when sending purchase requests by using the Boleto method:

  1. To initiate each purchase, send a separate POST request to the /v2/payment/voucher/boleto/sale endpoint. This endpoint belongs to the group /v2/payment/voucher/{payment_method}/sale.
  2. Each request must include the following objects and parameters:
    • Object general—general purchase information:
      • project_id—project identifier obtained from ecommpay during integration
      • payment_id—payment identifier unique within the project
      • signature—request signature generated after all required parameters are specified (details—in the Signature generation and verification) (details)
    • Object payment—payment information:
      • amount—payment amount in the smallest currency unit
      • currency—payment currency code in the ISO-4217 alpha-3 format
    • Object customer—customer information:
      • id—customer identifier unique within the project
      • ip_address—customer IP address relevant for the initiated payment
      • first_name—customer first name
      • last_name—customer last name
      • email—customer email address
      • address—customer post address
      • zip—customer post code
      • Object identify—information about the document which establishes identity:
        • doc_number—number of the customer's identity document, should consist of 11 or 14 digits
    • Object return_url—URL for customer returning from the bank site:
      • success—site URL for redirection after a processed payment
  3. The currency of payment can be BRL or USD.
  4. Additionally, any other parameters included in the specification can be used.

Thus, a correct purchase request by using the Boleto method must contain the project identifier, basic payment information (identifier, amount, and currency code), customer information, URL for redirection, as well as signature.

{
    "general": {
        "project_id": 580,
        "payment_id": "38202000002316",
        "signature": "h4ZxUifBNaLuvlYXyvBuqG/K0B9CjMCc2DbkDrk3qhLg=="
    },
    "payment": {
        "amount": 10000,
        "currency": "USD",
        "description": "38202000002316"
    },
    "customer": {
        "id": "589256",
        "email": "paul@mail.com",
        "first_name": "Paul",
        "last_name": "Marques",
        "address": "The street,23",
        "zip": "123456",
        "identify": {
            "doc_number": "84887177100"
        },
        "ip_address": "192.0.2.0"
    },
    "return_url": {
        "success": "example.com/success"
    }
}

Figure: Example of sufficient data in a purchase request

{
    "general": {
        "project_id": 580,
        "payment_id": "38202000002316",
        "signature": "h4ZxUifBNaLuvlYXyvBuqG/K0B9CjMCc2DbkDrk3qhLg=="
    },
    "payment": {
        "amount": 10000,
        "currency": "USD",
        "description": "38202000002316"
    },
    "customer": {
        "id": "589256",
        "email": "paul@mail.com",
        "first_name": "Paul",
        "last_name": "Marques",
        "address": "The street,23",
        "zip": "123456",
        "identify": {
            "doc_number": "84887177100"
        },
        "ip_address": "192.0.2.0"
    },
    "return_url": {
        "success": "example.com/success"
    }
}

Formats of intermediate callbacks for customer redirection

Depending on the payment processing provider, it may be necessary to display instructions to customers or redirect them to the Boleto service. Information for displaying instructions and generating payment codes is contained in the callback from the payment platform in the provider_extra_fields object, so before displaying the instruction and generating codes, you must receive and process the callback:

  • ticket_barcode—code for inclusion in the barcode
  • ticket_company_name—payee company name
  • ticket_expiration_date—expiry date and time of the voucher
  • ticket_id—voucher identifier
  • ticket_number—numeric voucher code
  • ticket_provider_name—name of the bank that issues the voucher
  • ticket_type—voucher type, can be numeric, barcode or custom
  • image_url — URL of the full version of the voucher

Figure: provider_extra_fields example

"provider_extra_fields" : {
	"doc_number" : "1234567812",
	"ticket_barcode" : "1000010009136517000100040000626788",
	"ticket_company_name" : "BRASIL LTDA",
	"ticket_expiration_date" : "2019-06-20T08:13:39+00:00",
	"ticket_id" : "344.775",
	"ticket_number" : "104991365817006267884978590000001000",
	"ticket_provider_name" : "caixa",
       "ticket_type" : "NUMERIC",
	"image_url": "http://example.com/payments/e7fdb20-5ac7-8583-00971"
	}

To redirect a customer it is necessary to receive an intermediate callback from the payment platform and use the information included in the redirect_data object. The format of such callbacks is standard (details), and the following objects and parameters are included in the redirect_data object:

  • body—object with data to be sent in the request body
  • method—parameter specifying the HTTP method for sending the request (GET or POST)
  • url—parameter containing a link for redirection

Figure: redirect_data example

  "redirect_data": {
    "body": {},
    "method": "GET",
    "url": "https://www.example.com/pay"
  }

Callback format

The Boleto method uses the standard format for callbacks to deliver purchase results. For more information, see Callbacks.

The following is the example of a callback with information about a 100,00 USD purchase made in the 842 project.

Figure: Example of callback data indicating that the purchase has been processed

{
        "project_id": 842,
        "payment": {
            "id": "EP8a3e-3e96",
            "type": "purchase",
            "status": "success",
            "date": "2019-06-03T12:09:38+0000",
            "method": "boleto",
            "sum": {
                "amount": 10000,
                "currency": "USD"
            },
            "description": ""
        },
        "operation": {
            "id": 1001313740,
            "type": "sale",
            "status": "success",
            "date": "2019-06-03T12:09:38+0000",
            "created_date": "2019-06-03T12:08:52+0000",
            "request_id": "46b8b94eabf",
            "sum_initial": {
                "amount": 10000,
                "currency": "USD"
            },
            "sum_converted": {
                "amount": 10000,
                "currency": "USD"
            },
            "provider": {
                "id": 1414,
                "payment_id": "9d7e3e16b6a5",
                "auth_code": ""
            },
            "code": "0",
            "message": "Success"
        },
        "signature": "hTnUho5lgWxu+wgKzmhLdjawf5d8PwovSQGtyFSH7OBlJ8bQ=="
    }

The following is the example of a callback with information about a declined purchase.

Figure: Example of callback data indicating that the purchase has been declined

 {
        "project_id": 842,
        "payment": {
            "id": "EP2ea6-f489",
            "type": "purchase",
            "status": "decline",
            "date": "2019-06-03T12:14:18+0000",
            "method": "boleto",
            "sum": {
                "amount": 1000,
                "currency": "EUR"
            },
            "description": ""
        },
        "operation": {
            "id": 2001313740,
            "type": "sale",
            "status": "decline",
            "date": "2019-06-03T12:14:18+0000",
            "created_date": "2019-06-03T12:13:38+0000",
            "request_id": "d5978bf20bae024",
            "sum_initial": {
                "amount": 1000,
                "currency": "EUR"
            },
            "sum_converted": {
                "amount": 1000,
                "currency": "EUR"
            },
            "provider": {
                "id": 1414,
                "payment_id": "D-30006-7729dab9-3782-4c0a-8192-840622f63f08",
                "auth_code": ""
            },
            "code": "20000",
            "message": "General decline"
        },
        "signature": "eL+OigWVAgeT85JjOOUKYy+MkG9SCynp47KzdImN3tAy0kA=="
    }

Useful links

The following articles can be useful when implementing purchases via Gate:

Analysis of payments results

To analyse information about payments made with the Boleto method and other methods, you can use:

  • Dashboard interface toolkit with various lists and analytic panels.
  • Reports in CSV file format, available via the Reports section (one-time and periodically).
  • Data in JSON format, sent by program requests to a specified URL available by using the Data API interface.

If you have any questions, refer to the documentation (Dashboard and Using Data API) and ecommpay technical support.