Sólo para Argentina, Brasil y Perú

Autorización y captura

Puedes congelar el dinero en la tarjeta de tu cliente en un primer momento, y concretar o cancelar el cobro más tarde.

Índice de contenido

Realiza una reserva de fondos

Para hacer una reserva (autorización o pre-autorización) a la tarjeta de tu cliente, simplemente realiza un pago, pero agrega el atributo capture=false para especificar que aún no debe capturarse:

curl -X POST \
        -H 'accept: application/json' \
        -H 'content-type: application/json' \
        'https://api.mercadopago.com/v1/payments?access_token=ACCESS_TOKEN' \
        -d '{
                "transaction_amount": 100,
                "token": "ff8080814c11e237014c1ff593b57b4d",
                "description": "Title of what you are paying for",
                "installments": 1,
                "payment_method_id": "visa",
                "payer": {
                        "email": "[email protected]"
                },
                "capture": false
        }'
Ver

Ajustable Mano Bolso De Militar Molle Cintura Bolsa Hebillas Con Táctico Hombro Correa YXx81Bwx

using mercadopago;
using System.Collections;

public class MyClass {
	public static void Main () {
		MP mp = new MP("ACCESS_TOKEN");

		Hashtable payment = mp.post("/v1/payments", "{"+
			"\"transaction_amount\": 100,"+
			"\"token\": \"ff8080814c11e237014c1ff593b57b4d\","+
			"\"description\": \"Title of what you are paying for\","+
			"\"installments\": 1,"+
			"\"payment_method_id\": \"visa\","+
			"\"payer\": {"+
				"\"email\": \"[email protected]\""+
			"},"+
			"\"capture\": false"+
		"}");
	}
}
Camisas Fit Camisas Slim Camisas Fit Slim Hombre Hombre Hombre Slim Hombre Fit Camisas UwqInxUCSr Hombro Molle Hebillas De Con Bolso Bolsa Militar Correa Táctico Mano Cintura Ajustable
import com.mercadopago.MP;
import org.codehaus.jettison.json.JSONObject;

public class MyClass {
	public static void main (String args[]) {
		MP mp = new MP("ACCESS_TOKEN");

		JSONObject payment = mp.post("/v1/payments", "{"+
			"'transaction_amount': 100,"+
			"'token': 'ff8080814c11e237014c1ff593b57b4d',"+
			"'description': 'Title of what you are paying for',"+
			"'installments': 1,"+
			"'payment_method_id': 'visa',"+
			"'payer': {"+
				"'email': '[email protected]'"+
			"},"+
			"'capture': false"+
		"}");
	}
}
Ver
var MP = require ("mercadopago");

var mp = new MP ("ACCESS_TOKEN");

var doReserve = mp.post ("/v1/payments",
	{
		"transaction_amount": 100,
		"token": "ff8080814c11e237014c1ff593b57b4d",
		"description": "Title of what you are paying for",
		"installments": 1,
		"payment_method_id": "visa",
		"payer": {
			"email": "[email protected]"
		},
		"capture": false
	});

doReserve.then (
	function (payment) {
		console.log (payment);
	},
	function (error){
		console.log (error);
	});
Ver
<?php
require_once ('mercadopago.php');

$mp = new MP('ACCESS_TOKEN');

$payment_data = array(
	"transaction_amount" => 100,
	"token" => "ff8080814c11e237014c1ff593b57b4d",
	"description" => "Title of what you are paying for",
	"installments" => 1,
	"payment_method_id" => "visa",
	"payer" => array (
		"email" => "[email protected]"
	),
	"capture" => false
);

$payment = $mp->post("/v1/payments", $payment_data);
import mercadopago
import json

mp = mercadopago.MP("ACCESS_TOKEN")

payment = mp.post("/v1/payments", {
        "transaction_amount": 100,
        "token": "ff8080814c11e237014c1ff593b57b4d",
        "description": "Title of what you are paying for",
        "installments": 1,
        "payment_method_id": "visa",
        "payer": {
            "email": "[email protected]"
        },
        "capture": False
    });

print(json.dumps(payment, indent=4))
require 'mercadopago.rb'

$mp = MercadoPago.new('ACCESS_TOKEN')

paymentData = Hash[
		"transaction_amount" => 100,
		"token" => "ff8080814c11e237014c1ff593b57b4d",
		"description" => "Title of what you are paying for",
		"installments" => 1,
		"payment_method_id" => "visa",
		"payer" => Hash[
			"email" => "[email protected]"
		],
		"capture" => false
	]

payment = $mp.post("/v1/payments", paymentData);

puts payment

Response status code: 201 Created

{
  "id": PAYMENT_ID,
  ...
  "status": "authorized",
  "status_detail": "pending_capture",
  ...
  "captured": false,
  ...
}

En este momento el pago se encuentra autorizado, a la espera de que decidas capturarlo o cancelarlo.

Consideraciones

  • La reserva tendrá una validez de 7 días. Si no la capturas hasta ese momento será cancelada.
  • La reserva también puede resultar rechazada, como cualquier otro pago normal.

Ten presente que el dinero quedará congelado en la tarjeta de tu usuario hasta que decidas capturarlo. Intenta que sea un período breve, porque no podrá disponer de ese dinero para realizar otras compras mientras esté reservado.

Rivas nike Hombres Roshe Run Blancas Barato 12 Descuento Negras nike Gran aclamado Outlet Alvonge5 Roadster Shox Plata Nike Zapatillas ZYWHOPRealiza la captura del pago

Cuando estés listo para capturar el pago, realiza lo siguiente:

Hombro De Cintura Hebillas Correa Bolso Militar Molle Mano Con Bolsa Táctico Ajustable
curl -X PUT \
        -H 'accept: application/json' \
        -H 'content-type: application/json' \
        'https://api.mercadopago.com/v1/payments/PAYMENT_ID?access_token=ACCESS_TOKEN' \
        -d '{
                "capture": true
        }'
Ver
using mercadopago;
using System.Collections;

public class MyClass {
	public static void Main () {
		MP mp = new MP("ACCESS_TOKEN");

		Hashtable payment = mp.put("/v1/payments/PAYMENT_ID", "{"+
			"\"capture\": true"+
		"}");
	}
}
Ver
Swift Variedad 100 Colores Zapatillas Adidas Originales Run RTw5C5Bqx
import com.mercadopago.MP;
import org.codehaus.jettison.json.JSONObject;

public class MyClass {
	public static void main (String args[]) {
		MP mp = new MP("ACCESS_TOKEN");

		JSONObject payment = mp.put("/v1/payments/PAYMENT_ID", "{"+
			"'capture': true"+
		"}");
	}
}
Ver
Ff2956 Negro Boxeo Fight Fox Para Cuero Hombre De Zapatillas aqFw58vx
var MP = require ("mercadopago");

var mp = new MP ("ACCESS_TOKEN");

var doCapture = mp.put ("/v1/payments/PAYMENT_ID",
	{
		"capture": true
	});

doCapture.then (
	function (payment) {
		console.log (payment);
	},
	function (error){
		console.log (error);
	});
Ver
<?php
require_once ('mercadopago.php');

$mp = new MP('ACCESS_TOKEN');

$payment_data = array(
	"capture" => true
);

$payment = $mp->put("/v1/payments/PAYMENT_ID", $payment_data);
import mercadopago
import json

mp = mercadopago.MP("ACCESS_TOKEN")

payment = mp.put("/v1/payments/PAYMENT_ID", {
        "capture": True
    });

print(json.dumps(payment, indent=4))
require 'mercadopago.rb'

$mp = MercadoPago.new('ACCESS_TOKEN')

paymentData = Hash[
		"capture" => true
	]

payment = $mp.put("/v1/payments/PAYMENT_ID", paymentData);

puts payment

Response status code: 200 OK

{
  ...
  "status": "approved",
  "status_detail": "accredited",
  ...
  "captured": true,
  ...
}
Diseñador Redondo Top Zapatos Más Marca Oro Hombre Zapatillas CBxwxznq6S

¡Listo! El pago ya está acreditado en tu cuenta. Si la reserva había sido exitosa, la operación de captura siempre será exitosa también.

Captura un monto menor al reservadoPure Hombre Lauren Cantor Zapatos Polo Zapatillas De Ralph Blanco qxgq0Uw

Si decides que finalmente necesitas cobrar un monto distinto al reservado originalmente, puedes especificarlo al momento de realizar la captura:

curl -X PUT \
        -H 'accept: application/json' \
        -H 'content-type: application/json' \
        'https://api.mercadopago.com/v1/payments/PAYMENT_ID?access_token=ACCESS_TOKEN' \
        -d '{
                "transaction_amount": 75,
                "capture": true
        }'
Ver
using mercadopago;
using System.Collections;

public class MyClass {
	public static void Main () {
		MP mp = new MP("ACCESS_TOKEN");

		Hashtable payment = mp.put("/v1/payments/PAYMENT_ID", "{"+
			"\"transaction_amount\": 75,"+
			"\"capture\": true"+
		"}");
	}
}
Calzado Timberland Marrón Zapatos Trail Naples Hombre Oxford qXx1XzA
Ver
import com.mercadopago.MP;
import org.codehaus.jettison.json.JSONObject;

public class MyClass {
	public static void main (String args[]) {
		MP mp = new MP("ACCESS_TOKEN");

		JSONObject payment = mp.put("/v1/payments/PAYMENT_ID", "{"+
			"'transaction_amount': 75,"+
			"'capture': true"+
		"}");
	}
}
Mano Táctico Cintura Hebillas Hombro Bolsa Militar Molle Con De Ajustable Bolso Correa
var MP = require ("mercadopago");

var mp = new MP ("ACCESS_TOKEN");

var doCapture = mp.put ("/v1/payments/PAYMENT_ID",
	{
		"transaction_amount": 75,
		"capture": true
	});

doCapture.then (
	function (payment) {
		console.log (payment);
	},
	function (error){
		console.log (error);
	});
Ver
<?php
require_once ('mercadopago.php');

$mp = new MP('ACCESS_TOKEN');

$payment_data = array(
	"transaction_amount" => 75,
	"capture" => true
);

$payment = $mp->put("/v1/payments/PAYMENT_ID", $payment_data);
Ver
import mercadopago
import json

mp = mercadopago.MP("ACCESS_TOKEN")

payment = mp.put("/v1/payments/PAYMENT_ID", {
        "transaction_amount": 75,
        "capture": True
    });

print(json.dumps(payment, indent=4))
Ver
require 'mercadopago.rb'

$mp = MercadoPago.new('ACCESS_TOKEN')

paymentData = Hash[
		"transaction_amount" => 75,
		"capture" => true
	]

payment = $mp.put("/v1/payments/PAYMENT_ID", paymentData);

puts payment
Ver

Response status code: 200 OK

{
  ...
  "status": "approved",
  "status_detail": "accredited",
  ...
  "transaction_amount": 75,
  ...
  "captured": true,
  ...
}

Consideraciones

  • El monto especificado no puede ser mayor al reservado originalmente.De Bolso Bolsa Correa Militar Cintura Ajustable Con Hombro Molle Táctico Mano Hebillas
  • Si no especificas el monto, se capturará todo el dinero reservado.
  • Sólo puedes realizar una captura parcial a un pago. El dinero restante ya no podrá ser capturado y será devuelto al saldo de la tarjeta.
  • En Argentina sólo disponible para tarjetas Visa y American Express.

Cancela una reserva

Si no vas a capturar el pago, puedes cancelar la reserva del siguiente modo, para que el dinero congelado sea restituído a la tarjeta:

curl -X PUT \
        -H 'accept: application/json' \
        -H 'content-type: application/json' \
        'https://api.mercadopago.com/v1/payments/PAYMENT_ID?access_token=ACCESS_TOKEN' \
        -d '{
                "status": "cancelled"
        }'
Ver
using mercadopago;
using System.Collections;

public class MyClass {
	public static void Main () {
		MP mp = new MP("ACCESS_TOKEN");

		Hashtable payment = mp.put("/v1/payments/PAYMENT_ID", "{"+
			"\"status\": \"cancelled\""+
		"}");
	}
}
Ver
import com.mercadopago.MP;
import org.codehaus.jettison.json.JSONObject;

public class MyClass {
	public static void main (String args[]) {
		MP mp = new MP("ACCESS_TOKEN");

		JSONObject payment = mp.put("/v1/payments/PAYMENT_ID", "{"+
			"'status': 'cancelled'"+
		"}");
	}
}
Ver
Ajustable Mano Bolso De Militar Molle Cintura Bolsa Hebillas Con Táctico Hombro Correa YXx81Bwx Ajustable Mano Bolso De Militar Molle Cintura Bolsa Hebillas Con Táctico Hombro Correa YXx81Bwx
var MP = require ("mercadopago");

var mp = new MP ("ACCESS_TOKEN");

var doCapture = mp.put ("/v1/payments/PAYMENT_ID",
	{
		"status": "cancelled"
	});

doCapture.then (
	function (payment) {
		console.log (payment);
	},
	function (error){
		console.log (error);
	});
Ver
<?php
require_once ('mercadopago.php');

$mp = new MP('ACCESS_TOKEN');

$payment_data = array(
	"status" => "cancelled"
);

$payment = $mp->put("/v1/payments/PAYMENT_ID", $payment_data);
Ver
import mercadopago
import json

mp = mercadopago.MP("ACCESS_TOKEN")

payment = mp.put("/v1/payments/PAYMENT_ID", {
        "status": "cancelled"
    });

print(json.dumps(payment, indent=4))
Ver
require 'mercadopago.rb'

$mp = MercadoPago.new('ACCESS_TOKEN')

paymentData = Hash[
		"status" => "cancelled"
	]

payment = $mp.put("/v1/payments/PAYMENT_ID", paymentData);

puts payment
Ver
Snake Megan Pepe negro Smith P505595 Tenis Stan Salones Jeans Mujer 76xxnR

Response status code: 200 OK

Molle Bolsa Militar Táctico De Con Hombro Cintura Ajustable Correa Mano Bolso Hebillas
{
  ...
  "status": "cancelled",
  "status_detail": "by_collector",
  ...
  "captured": false,
  ...
}

Las reservas que no hayan sido capturadas dentro del plazo mencionado, serán automáticamente canceladas. Serás notificado vía Webhooks del cambio de estado del pago.

Recuerda que también puedes devolver pagos ya acreditados (o capturados).