Improve the approval process
Why is a payment order rejected?
A payment can be rejected due to an error with a payment method or non-compliance with security requirements. I.e, if a card lacks enough funds, a data fails to upload properly or unusual account movements are detected.
In order to avoid any revenue loss with your business and to enhance your customers experience, we work with agents from each payment method and operate with the latest tools for fraud prevention and payment growth.
Bank rejected payments
When offering debit and credit card, the issuer can reject the charge due to several reasons. For instance, card may be expired, lack enough funds or have incorrect data.
You can see the payment status in the API response as rejected
and the reason for rejection in status_detail
.
json
{
"status": "rejected",
"status_detail": "cc_rejected_insufficient_amount",
"id": 47198050,
"payment_method_id": "master",
"payment_type_id": "credit_card",
...
}
Also, you can find more information about payment details on Mercado Pago activity section, where payments are being received.
Payments rejected due to fraud prevention
We track transactions in real time and perform security validations, to recognize payments that weren’t authorized by the card owner and also to avoid chargebacks.
When our fraud prevention system detects a suspicious payout, you'll be able to see the payment status in the API response as rejected
and the rejection reason as cc_rejected_high_risk
.
json
{
"status": "rejected",
"status_detail": "cc_rejected_high_risk",
"id": 47198050,
"payment_method_id": "master",
"payment_type_id": "credit_card",
...
}
Tips to improve the approval process
To prevent real payments being rejected by security non-compliance, you must add as much information as you can while performing an operation.
We can help you detect unusual client behaviour with our security code and Device ID, created to prevent fraud. And don’t worry, we take care of your customers data and we won't share it with anyone.
Add our security code into your website
It’s simple. Add the script, adjust the section of your website where you inserted it and that’s it! You’re all set and done. You just need to replace the view
value for the page name you want.
html
<script src="https://www.mercadopago.com/v2/security.js" view="home"></script>
VIEW Values
Value | Section |
home | Your website main page. |
search | Search page or product list page. |
item | Single product page with details for one product. |
Implement the Device ID in your site
To deploy the device on your website, you must add the following code:
html
<script src="https://www.mercadopago.com/v2/security.js" view="checkout"></script>
It’s important to send the device_id
generated by this code to your server. When creating a payment, add the following header to the request:
http
X-meli-session-id: device_id
You can obtain the Device ID in two ways:
- A global javascript variable is automatically created
MP_DEVICE_SESSION_ID
with the valuedevice_id
. If you prefer that we assign it to another variable, indicate the name by adding the attributeoutput
.
html
<script src="https://www.mercadopago.com/v2/security.js" view="checkout" output="deviceId"></script>
- If you want your own variable, you can add an HTML tag on your site with the identificator
id =" deviceId "
and the code will automatically assign the valuedevice_id
.
html
<input type="hidden" id="deviceId">
Implement the Device ID in your native mobile application
If you have a native application, you can capture the device information with our SDK and send it when creating the token. Follow these steps:
1. Add dependency
use_frameworks!
pod ‘MercadoPagoDevicesSDK’
Add the following code in the build.gradle file.
dependencies {
implementation 'com.mercadolibre.android.device:sdk:2.0.1'
}
2. Initialize module
We recommend initializing it in the didFinishLaunchingWithOptions event of the AppDelegate.
import MercadoPagoDevicesSDK
...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
MercadoPagoDevicesSDK.shared.execute()
...
}
We recommend initializing it in the didFinishLaunchingWithOptions event of the AppDelegate.
@import ‘MercadoPagoDevicesSDK’;
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
...
[[MercadoPagoDevicesSDK shared] execute];
...
}
We recommend initializing it in the MainApplication class.
import com.mercadolibre.android.device.sdk.DeviceSDK;
DeviceSDK.getInstance().execute(this);
3. Capture information
Execute one of these functions to obtain the information in the format that you prefer.
MercadoPagoDevicesSDK.shared.getInfo() // Returns a Codable Device Object
MercadoPagoDevicesSDK.shared.getInfoAsJson() // Returns a JSON Library Data Object
MercadoPagoDevicesSDK.shared.getInfoAsJsonString() // Returns a JSON String
MercadoPagoDevicesSDK.shared.getInfoAsDictionary() // Returns a Dictionary<String,Any>
[[[MercadoPagoDevicesSDK] shared] getInfoAsJson] // Returns a JSON Library Data Object
[[[MercadoPagoDevicesSDK] shared] getInfoAsJsonString] // Returns a JSON String
[[[MercadoPagoDevicesSDK] shared] getInfoAsDictionary] // Returns a Dictionary<String,Any>
Device device = DeviceSDK.getInstance().getInfo() // Returns a Serializable Device Object
Map deviceMap = DeviceSDK.getInstance().getInfoAsMap() // Returns a Map<String, Object>
String jsonString = DeviceSDK.getInstance().getInfoAsJsonString() // Returns a JSON String
4. Send information
Finally, send the information in the device
field when creating the card_token
.
plain
{
...,
"device":{
"fingerprint":{
"os":"iOS",
"system_version":"8.3",
"ram":18446744071562067968,
"disk_space":498876809216,
"model":"MacBookPro9,2",
"free_disk_space":328918237184,
"vendor_ids":[
{
"name":"vendor_id",
"value":"C2508642-79CF-44E4-A205-284A4F4DE04C"
},
{
"name":"uuid",
"value":"AB28738B-8DC2-4EC2-B514-3ACF330482B6"
}
],
"vendor_specific_attributes":{
"feature_flash":false,
"can_make_phone_calls":false,
"can_send_sms":false,
"video_camera_available":true,
"cpu_count":4,
"simulator":true,
"device_languaje":"en",
"device_idiom":"Phone",
"platform":"x86_64",
"device_name":"iPhone Simulator",
"device_family":4,
"retina_display_capable":true,
"feature_camera":false,
"device_model":"iPhone Simulator",
"feature_front_camera":false
},
"resolution":"375x667"
}
}
Include all payment information
In order to optimize payment security validation and avoid rejected payments, you can send us the customer and item data so we can analyze it. I.e., if you send us this information, we can detect if the buyer has made suspicious payments in the past.
Buyer Data
<?php
// ...
$payer = new MercadoPago\Payer();
$payer->name = "Charles";
$payer->surname = "Luevano";
$payer->email = "charles@hotmail.com";
$payer->date_created = "2018-06-02T12:58:41.425-04:00";
$payer->phone = array(
"area_code" => "",
"number" => "949 128 866"
);
$payer->identification = array(
"type" => "DNI",
"number" => "12345678"
);
$payer->address = array(
"street_name" => "Cuesta Miguel Armendáriz",
"street_number" => 1004,
"zip_code" => "11020"
);
// ...
?>
// ...
var payer = {
name: "Charles",
surname: "Luevano",
email: "charles@hotmail.com",
date_created: "2015-06-02T12:58:41.425-04:00",
phone: {
area_code: "",
number: "949 128 866"
},
identification: {
type: "DNI",
number: "12345678"
},
address: {
street_name: "Cuesta Miguel Armendáriz",
street_number: "1004",
zip_code: "11020"
}
}
// ...
// ...
Payer payer = new Payer();
payer.setName("Charles")
.setSurname("Luevano")
.setEmail("charles@hotmail.com")
.setDateCreated("2018-06-02T12:58:41.425-04:00")
.setPhone(new Phone()
.setAreaCode("")
.setPhoneNumber("949 128 866"))
.setIdentification(new Identification()
.setType("DNI")
.setNumber("12345678"))
.setAddress(new Address()
.setStreetName("Cuesta Miguel Armendáriz")
.setBuildingNumber("1004")
.setZipCode("11020"));
// ...
# ...
payer = {
name: "Charles",
surname: "Luevano",
email: "charles@hotmail.com",
date_created: Time.now,
identification: {
type: "DNI",
number: "12345678"
},
address: {
street_name: "Cuesta Miguel Armendáriz",
street_number: "1004",
zip_code: "11020"
}
}
# ...
using System.Collections.Generic;
using MercadoPago.Client.Common;
using MercadoPago.Client.Preference;
// ...
var payer = new PreferencePayerRequest
{
Name = "Charles",
Surname = "Luevano",
Email = "charles@hotmail.com",
Phone = new PhoneRequest
{
AreaCode = "",
Number = "949 128 866",
},
Identification = new IdentificationRequest
{
Type = "DNI",
Number = "12345678",
},
Address = new AddressRequest
{
StreetName = "Cuesta Miguel Armendáriz",
StreetNumber = "1004",
ZipCode = "11020",
},
};
// ...
# ...
payer_data = {
"name": "Charles",
"surname": "Luevano",
"email": "charles@hotmail.com",
"date_created": "2015-06-02T12:58:41.425-04:00",
"identification": {
"type": "DNI",
"number": "12345678"
},
"address": {
"street_name": "Cuesta Miguel Armendáriz",
"street_number": "1004",
"zip_code": "11020"
}
}
# ...
Item details
<?php
$item = new MercadoPago\Item();
$item->id = "1234";
$item->title = "Heavy Duty Plastic Table";
$item->quantity = 7;
$item->currency_id = "UYU";
$item->unit_price = 75.56;
// ...
?>
// ...
items: [
{
id: '1234',
title: 'Lightweight Paper Table',
quantity: 3,
currency_id: 'UYU',
unit_price: 55.41
}
]// ...
// ...
Item item = new Item();
item.setId("1234")
.setTitle("Lightweight Paper Table")
.setQuantity(3)
.setCurrencyId("UYU")
.setUnitPrice((float) 55.41);
// ...
# ...
item = {
id: "1234",
title: "Lightweight Paper Table",
quantity: 3,
currency_id: "UYU",
unit_price: 55.41
}# ...
// ...
var request = new PreferenceRequest
{
Items = new List<PreferenceItemRequest>
{
new PreferenceItemRequest
{
Id = "1234",
Title = "Lightweight Paper Table",
Quantity = 3,
CurrencyId = "UYU",
UnitPrice = 55.41m,
}
},
};
// ...
# ...
preference_data = {
"items": [
{
"id": '1234',
"title": 'Lightweight Paper Table',
"quantity": 3,
"currency_id": 'UYU',
"unit_price": 55.41
}
]
# ...
}
# ...
Learn all about these attributes in our API Reference.
Industry Data
Send data about your industry to improve your approval.
Help your clients with their rejected payments
It’s important to explain to your clients the reason for a payment rejection and how to fix it. Your customers will have all the information they need to be able to pay you without problems.
For instance, if a payment is rejected due to lack of funds, you can recommend trying again with a different payment method.
Add the following code in the Podfile file.