Capture payments for less than the reserved amount
To capture an amount lower than the reserve, you need to submit the transaction_amount
attribute with the new value.
<?php
MercadoPago\SDK::setAccessToken("ENV_ACCESS_TOKEN");
$payment = MercadoPago\Payment::find_by_id($payment_id);
$payment->transaction_amount = 75;
$payment->capture = true;
$payment->update();
?>
MercadoPagoConfig.setAccessToken("ENV_ACCESS_TOKEN");
Long paymentId = 123456789L;
PaymentClient client = new PaymentClient();
client.capture(paymentId, new BigDecimal("75"));
var mercadopago = require('mercadopago');
mercadopago.configurations.setAccessToken(config.access_token);
let captureInfo = {id: 123, transaction_amount: 5}
mercadopago.payment.capturePartial(captureInfo, mercadopago, (error, response) => {
if (error){
console.log(error);
}else{
console.log(response)
}
});
require 'mercadopago'
sdk = Mercadopago::SDK.new('ENV_ACCESS_TOKEN')
request = {
transaction_amount: 75,
capture: true
}
payment_response = sdk.payment.update(payment_id, request)
payment = payment_response[:response]
using MercadoPago.Client.Payment;
using MercadoPago.Config;
using MercadoPago.Resource.Payment;
MercadoPagoConfig.AccessToken = "ENV_ACCESS_TOKEN";
var client = new PaymentClient();
Payment payment = await client.CaptureAsync(paymentId, 75);
import mercadopago
sdk = mercadopago.SDK("ENV_ACCESS_TOKEN")
payment_data = {
"transaction_amount": 75,
"capture": True
}
payment_response = sdk.payment().update(payment_id, payment_data)
payment = payment_response["response"]
curl -X PUT \
'https://api.mercadopago.com/v1/payments/PAYMENT_ID' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ENV_ACCESS_TOKEN' \
-d '{
"transaction_amount": 75,
"capture": true
}'
Response
json
{
...
"status": "approved",
"status_detail": "accredited",
...
"transaction_amount": 75,
...
"captured": true,
...
}