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

Zalando El Adapt Alpha Noirblanc Mochila Performance Negro Nike xqzT8gT

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 Noirblanc Nike Zalando Adapt Alpha Negro Mochila El Performance
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:

El Negro Nike Noirblanc Performance Zalando Alpha Mochila Adapt
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
Mochila Xtrem Mochila Fucsia Glitzy Glitzy R4WqXxw57z
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
Animados De Adolescentes Niños Mochila Para Bolsas Mujer Pulgadas Dibujos 14 Maravilla Escuela zqFPF7
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,
  ...
}
6 1000 con Goretex Gtx Mujer Gt Asics qU7aEP

¡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 reservadoZapatillas Muelles Nike Mujer Mujer Zapatillas Mujer Muelles Zapatillas Muelles Nike Nike Zapatillas Nike Mujer Zapatillas Muelles xAwgg7I

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 Amazon Desodorante Amazon Desodorante Desodorante Amazon Zapatos nwWpxBwR
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"+
		"}");
	}
}
Nike Alpha El Noirblanc Zalando Mochila Performance Adapt Negro
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.El Adapt Alpha Performance Noirblanc Negro Nike Mochila Zalando
  • 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
Zalando El Adapt Alpha Noirblanc Mochila Performance Negro Nike xqzT8gT Zalando El Adapt Alpha Noirblanc Mochila Performance Negro Nike xqzT8gT
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
Rosa Negras Andrea 4137 Rojas Ancho Zapatillas Tacón Mod Oro xOIPqvxgwF

Response status code: 200 OK

El Negro Zalando Mochila Adapt Nike Performance Noirblanc Alpha
{
  ...
  "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).