Integrate other payment methods
With Checkout API of Mercado Pago, you can add alternative payment methods for your customers to make their payments.
How does it work?
To receive other payment methods, you should take into account two aspects:
- First, you need a frontend to collect customer's e-mail and document, amount and payment method.
- Then, you need a backend that takes the payment data and can confirm and make the payment.
Both for frontend and backend, we recommend our libraries to collect user sensitive data securely.
Check the available payment methods
Payment Methods
In addition to cards, you can offer other payment choices on your website.
Type of payment method | Payment method |
---|---|
ticket | OXXO |
atm | Citibanamex |
atm | Santander |
atm | BBVA Bancomer |
prepaid_card | Mercado Pago Card |
Obtain the available payment methods
You can check the available payment methods whenever you need.
<?php
MercadoPago\SDK::setAccessToken("ENV_ACCESS_TOKEN");
$payment_methods = MercadoPago::get("/v1/payment_methods");
?>
var mercadopago = require('mercadopago');
mercadopago.configurations.setAccessToken(config.access_token);
payment_methods = mercadopago.get("/v1/payment_methods");
import com.mercadopago.*;
MercadoPago.SDK.configure("ENV_ACCESS_TOKEN");
payment_methods = MercadoPago.SDK.get("/v1/payment_methods");
require 'mercadopago'
MercadoPago::SDK.configure(ACCESS_TOKEN: ENV_ACCESS_TOKEN)
payment_methods = MercadoPago::SDK.get("/v1/payment_methods")
using MercadoPago;
MercadoPago.SDK.SetAccessToken = "ENV_ACCESS_TOKEN";
payment_methods = MercadoPago.SDK.get("/v1/payment_methods");
curl -X GET \
-H 'accept: application/json' \
-H 'content-type: application/json' \
-H 'Authorization: Bearer ENV_ACCESS_TOKEN' \
'https://api.mercadopago.com/v1/payment_methods' \
The result will be a list of payment methods and their features. For example, payment_type_id
payment methods with ticket
as value refer to cash payment method.
Keep in mind that the answer will return all the payments methods. For this reason, you have to filter the options you want to offer according to the list of available payment methods.
json
[
{
"id": "oxxo",
"name": "OXXO",
"payment_type_id": "ticket",
"status": "active",
"secure_thumbnail": "https://www.mercadopago.com/org-img/MP3/API/logos/oxxo.gif",
"thumbnail": "http://img.mlstatic.com/org-img/MP3/API/logos/oxxo.gif",
"deferred_capture": "does_not_apply",
"settings": [],
"additional_info_needed": [],
"min_allowed_amount": 5,
"max_allowed_amount": 10000,
"accreditation_time": 2880,
"financial_institutions": [],
"processing_modes": [
"aggregator"
]
},
{
"id": "banamex",
"name": "Citibanamex",
"payment_type_id": "atm",
"status": "active",
"secure_thumbnail": "https://www.mercadopago.com/org-img/MP3/API/logos/banamex.gif",
"thumbnail": "http://img.mlstatic.com/org-img/MP3/API/logos/banamex.gif",
"deferred_capture": "does_not_apply",
"settings": [],
"additional_info_needed": [],
"min_allowed_amount": 5,
"max_allowed_amount": 40000,
"accreditation_time": 60,
"financial_institutions": [],
"processing_modes": [
"aggregator"
]
},
{
"id": "serfin",
"name": "Santander",
"payment_type_id": "atm",
"status": "active",
"secure_thumbnail": "https://www.mercadopago.com/org-img/MP3/API/logos/serfin.gif",
"thumbnail": "http://img.mlstatic.com/org-img/MP3/API/logos/serfin.gif",
"deferred_capture": "does_not_apply",
"settings": [],
"additional_info_needed": [],
"min_allowed_amount": 5,
"max_allowed_amount": 40000,
"accreditation_time": 60,
"financial_institutions": [],
"processing_modes": [
"aggregator"
]
},
{
"id": "bancomer",
"name": "BBVA Bancomer",
"payment_type_id": "atm",
"status": "active",
"secure_thumbnail": "https://www.mercadopago.com/org-img/MP3/API/logos/bancomer.gif",
"thumbnail": "http://img.mlstatic.com/org-img/MP3/API/logos/bancomer.gif",
"deferred_capture": "does_not_apply",
"settings": [],
"additional_info_needed": [],
"min_allowed_amount": 10,
"max_allowed_amount": 40000,
"accreditation_time": 60,
"financial_institutions": [],
"processing_modes": [
"aggregator"
]
},
{
"id": "mercadopagocard",
"name": "Tarjeta MercadoPago",
"payment_type_id": "prepaid_card",
"status": "active",
"secure_thumbnail": "https://www.mercadopago.com/org-img/MP3/API/logos/mercadopagocard.gif",
"thumbnail": "http://img.mlstatic.com/org-img/MP3/API/logos/mercadopagocard.gif",
"deferred_capture": "supported",
"settings": [
{
"card_number": {
"validation": "standard",
"length": 16
},
"bin": {
"pattern": "^539978",
"installments_pattern": "^539978",
"exclusion_pattern": null
},
"security_code": {
"length": 3,
"card_location": "back",
"mode": "mandatory"
}
}
],
"additional_info_needed": [
"cardholder_name"
],
"min_allowed_amount": 5,
"max_allowed_amount": 300000,
"accreditation_time": 1440,
"financial_institutions": [],
"processing_modes": [
"aggregator"
]
},
]
Data capture for payment
Client-Side
1. Use MercadoPago.js library
Remember to use our official library to access Mercado Pago API from your application and collect data securely.
html
<script src="https://secure.mlstatic.com/sdk/javascript/v1/mercadopago.js"></script>
2. Add payment form
To capture sensitive data from your customer, please use our form with the corresponding attributes, which ensures information security.
You can easily include anything you need and add your own style.
Use the list you consulted in Obtain the available payment methods to create the payment options you want to offer.
html
<form action="/process_payment" method="post" id="paymentForm">
<h3>Payment method</h3>
<div>
<select class="form-control" id="paymentMethod" name="paymentMethod">
<option>Select a payment form</option>
<!-- Create an option for each payment method with their name and complete the ID in the attribute 'value'. -->
<option value="--PaymentTypeId--">--PaymentTypeName--</option>
</select>
</div>
<h3>Buyer Details</h3>
<div>
<div>
<label for="payerFirstName">Name</label>
<input id="payerFirstName" name="payerFirstName" type="text" value="Nome"></select>
</div>
<div>
<label for="payerLastName">Surname</label>
<input id="payerLastName" name="payerLastName" type="text" value="Sobrenome"></select>
</div>
<div>
<label for="payerEmail">E-mail</label>
<input id="payerEmail" name="payerEmail" type="text" value="test@test.com"></select>
</div>
<div>
<label for="docType">Document Type</label>
<select id="docType" name="docType" data-checkout="docType" type="text"></select>
</div>
<div>
<label for="docNumber">Document Number</label>
<input id="docNumber" name="docNumber" data-checkout="docNumber" type="text"/>
</div>
</div>
<div>
<div>
<input type="hidden" name="transactionAmount" id="transactionAmount" value="100" />
<input type="hidden" name="productDescription" id="productDescription" value="Product name" />
<br>
<button type="submit">Pay</button>
<br>
</div>
</div>
</form>
3. Configure your public key
Add your public key like this:
javascript
window.Mercadopago.setPublishableKey("YOUR_PUBLIC_KEY");
Payment submission to Mercado Pago
Server-Side
To receive cash payments, just send your customer's e-mail and document, amount and payment method.
Once the request –with all the collected information– is in your backend, it should be submitted to Mercado Pago through our APIs.
For this to work, you should configure your private key.
<?php
MercadoPago\SDK::setAccessToken("ENV_ACCESS_TOKEN");
$payment = new MercadoPago\Payment();
$payment->transaction_amount = 100;
$payment->description = "Product Title";
$payment->payment_method_id = "oxxo";
$payment->payer = array(
"email" => "test_user_82045343@testuser.com"
);
$payment->save();
?>
var mercadopago = require('mercadopago');
mercadopago.configurations.setAccessToken(config.access_token);
var payment_data = {
transaction_amount: 100,
description: 'Product Title',
payment_method_id: 'oxxo',
payer: {
email: 'test_user_82045343@testuser.com'
}
};
mercadopago.payment.create(payment_data).then(function (data) {
}).catch(function (error) {
});
import com.mercadopago.*;
MercadoPago.SDK.configure("ENV_ACCESS_TOKEN");
Payment payment = new Payment();
payment.setTransactionAmount(100f)
.setDescription('Product Title')
.setPaymentMethodId("oxxo")
.setPayer(new Payer("test_user_82045343@testuser.com"));
payment.save();
require 'mercadopago'
MercadoPago::SDK.configure(ACCESS_TOKEN: ENV_ACCESS_TOKEN)
payment = MercadoPago::Payment.new()
payment.transaction_amount = 100
payment.description = 'Product Title'
payment.payment_method_id = "oxxo"
payment.payer = {
email: "test_user_82045343@testuser.com"
}
payment.save()
using MercadoPago;
using MercadoPago.DataStructures.Payment;
using MercadoPago.Resources;
MercadoPago.SDK.SetAccessToken("ENV_ACCESS_TOKEN");
Payment payment = new Payment()
{
TransactionAmount = float.Parse("100"),
Description = "Product Title",
PaymentMethodId = "oxxo",
Payer = new Payer(){
Email = "test_user_82045343@testuser.com"
}
};
payment.Save();
curl -X POST \
'https://api.mercadopago.com/v1/payments' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ENV_ACCESS_TOKEN' \
-d '{
transaction_amount: 100,
description: "Product Title",
payment_method_id: "oxxo",
payer: { email: "test_user_82045343@testuser.com" }
}'
The response will show pending status until the buyer makes the payment. The payment voucher ID is the same as the Mercado Pago transaction ID.
json
[
{
...,
"id": 5466310457,
"status": "pending",
"status_detail": "pending_waiting_payment",
...,
"transaction_details": {
"payment_method_reference_id": "24304329",
"verification_code": "882430432923032000100001",
"net_received_amount": 0,
"total_paid_amount": 100,
"overpaid_amount": 0,
"external_resource_url": "https://www.mercadopago.com/mlm/payments/sandbox/ticket/helper?payment_id=1234&payment_method_reference_id=12345678&caller_id=1234&hash=aaaaaa-bbb-cccc-dddd-eeeeeeee",
"installment_amount": 0,
"financial_institution": "",
"payable_deferral_period": null,
}
}
]
In the external_resource_url
field you will find an address with payment instructions for your buyer. You can redirect or send him/her the link.
Cancel payments
To avoid collection issues, you need to cancel expired payments. Cash payments should be paid within 3 to 5 business days, based on their relevant term.
Take into account that you can only cancel payments in process or pending status. If a payment expires after 30 days, the cancellation is automatic and the final status will be cancelled or expired.
For more information, check the Refunds and Cancellations section.
Payment credit times
Each payment method has its own credit times; it is immediate in some cases, while in others, it may take up to 3 business days.
Check credit times by payment method whenever you need to.
Inform customer payment points
Finally, you should share information about the different places where your customers can pay.
Payment method | Available stores |
---|---|
OXXO | OXXO |
BBVA Bancomer | 7-Eleven |
BBVA Bancomer | K |
BBVA Bancomer | Farmacias del Ahorro |
BBVA Bancomer | Casa Ley |
BBVA Bancomer | BBVA Bancomer |
Citibanamex | Chedraui |
Citibanamex | Telecomm |
Citibanamex | Citibanamex |