Actualizar suscripción - Suscripciones - Mercado Pago Developers
Actualizar suscripción

PUT

/preapproval/{id}
Renew the data of a subscription. Indicate the preapproval ID and send the body with the information you want to update. You can update reason, amount, payment method and status and more.
Parámetros para la solicitud
id

REQUERIDO

string
Localización: pathIdentificador único de suscripción que deseas modificar.
auto_recurring
object
Localización: bodyInformación de configuración para la recurrencia.
back_url
string
Localización: bodyURL de retorno exitosa. Use esta configuración para redirigir a tus clientes después de nuestro checkout a tu sitio.
card_token_id
number
Localización: bodyIdentificador único para recuperar datos de la tarjeta utilizada como medio de pago.
Parámetros de respuesta
id
string
Localización: bodyIdentificador único de suscripción.
version
number
Localización: bodyHow many times the subscription was modified
application_id
number
Localización: bodyID único que identifica tu aplicación/integración. Una de las claves del par que componen las credenciales que identifican una aplicación/integración en tu cuenta.
collector_id
number
Localización: bodyID único que identifica a tu usuario como vendedor. Este ID coincide con tu User ID en nuestro ecosistema.
Solicitud
curl
curl -X PUT \
      'https://api.mercadopago.com/preapproval/{id}' \
      -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
      -H 'Content-Type: application/json' \ 
      -d '{
  "reason": "Yoga classes.",
  "external_reference": 23546246234,
  "back_url": "https://www.mercadopago.com.ar",
  "auto_recurring": {
    "transaction_amount": 10,
    "currency_id": "ARS"
  },
  "card_token_id": 123123123,
  "status": "pending"
}'
Respuesta
json
{
  "id": "2c938084726fca480172750000000000",
  "version": 0,
  "application_id": 1234567812345678,
  "collector_id": 100200300,
  "preapproval_plan_id": "2c938084726fca480172750000000000",
  "reason": "Yoga classes.",
  "external_reference": 23546246234,
  "back_url": "https://www.mercadopago.com.ar",
  "init_point": "https://www.mercadopago.com.ar/subscriptions/checkout?preapproval_id=2c938084726fca480172750000000000",
  "auto_recurring": {
    "frequency": 1,
    "frequency_type": "months",
    "start_date": "2020-06-02T13:07:14.260Z",
    "end_date": "2022-07-20T15:59:52.581Z",
    "currency_id": "ARS",
    "transaction_amount": 10,
    "free_trial": {
      "frequency": 1,
      "frequency_type": "months"
    }
  },
  "first_invoice_offset": 7,
  "payer_id": 123123123,
  "card_id": 123123123,
  "payment_method_id": "account_money",
  "next_payment_date": "2022-01-01T11:12:25.892-04:00",
  "date_created": "2022-01-01T11:12:25.892-04:00",
  "last_modified": "2022-01-01T11:12:25.892-04:00",
  "summarized": {
    "quotas": 6,
    "charged_quantity": 3,
    "charged_amount": 1000,
    "pending_charge_quantity": 1,
    "pending_charge_amount": 200,
    "last_charged_date": "2022-01-01T11:12:25.892-04:00",
    "last_charged_amount": 100,
    "semaphore": "green"
  },
  "status": "pending"
}
Errores
400bad_request
400Invalid transition from cancelled to authorized
400You can not modify a cancelled preapproval.
400You can not modify a paused subscription.
400This preapproval can not be authorized with a credit card
400This preapproval can not disable account_money
400This preapproval can not be authorized only with account_money
400This preapproval require account_money to be authorized
400You must provide a card_id
400preapproval without another payment method
401bad_request
401Unauthorized access to resource
500bad_request
500Internal server error