estoy teniendo problemas para crear la pre-aprobación:
este es mi código:
$mp = new MP ("CLIENT_ID", "CLIENT_SECRET");
$data = array(
'order_frequency' => 1,
'order_frequency_type' => 'months',
'currency_code' => "ARS",
'customer_email' => '[email protected]',
'order_reference' => 'REF-2424',
'amount' => 5000
);
$preapproval_data = array(
'payer_email' => $data['customer_email'],
'back_url' => "http://www.my-sitesss.com",
'reason' =>"Monthly subscription to premium package",
'external_reference' => 'dsfdsfds',
"auto_recurring" => array(
"frecuency" => $data['order_frequency'],
"frequency_type" => $data['order_frequency_type'],
"transaction_amount" => $data['amount'],
"currency_id" => $data['currency_code']
)
);
$preapproval = $mp->create_preapproval_payment($preapproval_data);
ademas probé con el otro SDK:
\MercadoPago\Sdk::initialize();
$config = \MercadoPago\Sdk::config();
$config->set('ACCESS_TOKEN', '..........................');
$preapproval_data = new \MercadoPago\Preapproval();
$preapproval_data->payer_email = $data['customer_email'];
$preapproval_data->back_url = "http://www.my-site.com";
$preapproval_data->reason = "Monthly subscription to premium package";
$preapproval_data->external_reference = $data['order_reference'];
$preapproval_data->frecuency = $data['order_frequency'];
$preapproval_data->frequency_type = $data['order_frequency_type'];
$preapproval_data->transaction_amount = $data['amount'];
$preapproval_data->currency_id = $data['currency_code'];
$preapproval_data->auto_recurring = array(
"frecuency" => 1,
"frequency_type" => "months",
"transaction_amount" => 60,
"currency_id" => "ARS",
"start_date" => "2018-01-17T14:58:11.778-03:00",
"end_date" => "2020-06-17T14:58:11.778-03:00"
);
$preapproval_data->save();
y ambos me retornan:
The parameters frequency, frequency_type, transaction_amount and currency_id are required in the recurring payments scheme
incluso usando el ejemplo directo del SDK
https://github.com/mercadopago/dx-php/blob/master/samples/suscriptions/basic-suscription.php
gracias de antemano