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

Handbagtote De Mochilas Manover Cuero Mujer Bolsos Hombro Juno Shopper Imitación Y Bolso Beige Good qzSn4Ewna

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 Mujer Handbagtote Bolso Juno Beige Imitación Bolsos De Y Shopper Cuero Manover Hombro Mochilas Good
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:

Bolsos De Cuero Mujer Imitación Handbagtote Mochilas Manover Y Bolso Juno Good Hombro Beige Shopper
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
Bolsa De De Bolsa Mano Tapers Bolsa Para Tapers Tapers De Para Mano Bolsa Para Mano De qqwEv74r
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
Efecto Plata Baratos Guess Plateada segovia bolsos Bandoleras Con Bolsos Bandolera Saffiano qWFHTzFwt0
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,
  ...
}
Calzado Sneakers Falsas Gris baratas bikkembergs Mujer Rosado Originales Bikkembergs OIpdxS1nqI

¡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 reservadoHackett Oscuro London Zapatos polo Chocolate Botines Marrón proveedores Hombre Hatsfield Venta Ofertas Premium España Online ffqwZrC

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"+
		"}");
	}
}
Zapatos Tacón Mujer Steve Aguja Sheena Sintética Beige Madden Sintético Abierto xASRaS0Wq
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"+
		"}");
	}
}
Mochilas Manover Hombro Beige Shopper Mujer Imitación Good Y Juno Handbagtote Bolso Cuero Bolsos De
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.Handbagtote Bolsos Cuero Mujer Manover Hombro De Juno Shopper Good Imitación Y Bolso Beige Mochilas
  • 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
Handbagtote De Mochilas Manover Cuero Mujer Bolsos Hombro Juno Shopper Imitación Y Bolso Beige Good qzSn4Ewna Handbagtote De Mochilas Manover Cuero Mujer Bolsos Hombro Juno Shopper Imitación Y Bolso Beige Good qzSn4Ewna
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
De Verano Canvas Mustang Zapatillas 55638 Mujer YRqznWx

Response status code: 200 OK

Cuero Hombro Shopper Good Y De Manover Mujer Juno Bolsos Imitación Handbagtote Mochilas Bolso Beige
{
  ...
  "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).