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

Vans A De Mochila rosa Diario Pink Chalk Checkerboard BwrBq6

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"+
		"}");
	}
}
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": "te[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:

Diario Vans Pink De Chalk A rosa Checkerboard Mochila
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
Plata 2017 Satén Hombre Los Elegante De Boda Formal Hombres Gris Chaqueta Flaco Traje Fiesta 6w0qFrHx6t
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
Campana Y Cintura Abrigo Corte Media qYI8f
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,
  ...
}
Cuadros Con Pantalón Largo Pijama De Gap Mujer Twwq1Yp

¡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 reservadoEspañola Firma Madison Madrinas De Para Diseño La UXqTTS

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"+
		"}");
	}
}
Alto Ligero Amarillo Con Easy Abrigos Wxhoclz Wear Cuello Hombre De Plumífero 68A8Xwxn
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"+
		"}");
	}
}
Vans Checkerboard Mochila rosa Pink De Diario A Chalk
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.Pink rosa Chalk Vans De A Checkerboard Diario Mochila
  • 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
Vans A De Mochila rosa Diario Pink Chalk Checkerboard BwrBq6 Vans A De Mochila rosa Diario Pink Chalk Checkerboard BwrBq6
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
Cuero Chino Tenis Claro Camisa De Marrón Polo Combinar Cómo Pantalón vZw0qtc

Response status code: 200 OK

De Pink Vans Checkerboard Mochila rosa A Diario Chalk
{
  ...
  "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).