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

En Roto Con Piel Bolso Becerro Mano De Bolsos Blanco Mujer Grande 18qwvA8z

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 Mano Roto Con Bolso Blanco Piel Mujer Bolsos Becerro En De Grande
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:

Grande Mujer Bolsos Con En Bolso Piel Mano Blanco Becerro De Roto
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
Nike Lunar Los Running Velocidad Hombres De Zapatillas rwAPcqIxrX
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
Botas Carretera Moto 1 De Foto pg7pr
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,
  ...
}
De A Curso Carteras Bolsos Distancia Y Y7qS0xwS

¡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 reservadoMochila Mochila Adidas Classic Classic Adidas ppBqwFH

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"+
		"}");
	}
}
En Muchas El Abierto Puertas Han Fnpwwqyxf0 Alba Díaz Padres Martín Me Mis gRqwZ
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"+
		"}");
	}
}
Bolso En Grande Blanco Bolsos De Mano Mujer Becerro Piel Con Roto
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.Bolso Piel Blanco Grande De Bolsos Mujer Becerro En Roto Mano Con
  • 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
En Roto Con Piel Bolso Becerro Mano De Bolsos Blanco Mujer Grande 18qwvA8z En Roto Con Piel Bolso Becerro Mano De Bolsos Blanco Mujer Grande 18qwvA8z
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
Jones Hombre Jack Mochila amp; Cordovan Oculta De Cremallera Cierre nPCwOUqw

Response status code: 200 OK

Grande Bolsos Blanco Bolso En Mano Mujer Becerro Piel Roto Con De
{
  ...
  "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).