-
I'm trying to make a subscription to the plan I created, but when calling PreApproval create I'm getting this error Does anyone know what it can be? import { MercadoPagoConfig, PreApproval } from 'mercadopago';
const client = new MercadoPagoConfig({
accessToken: functions.config().mercadopago.token,
options: { timeout: 5000, idempotencyKey: 'abc' },
});
const plan = new PreApproval(client);
const today = new Date();
const process = await plan.create({
body: {
preapproval_plan_id: '2c938084929566600192959970580012',
card_token_id: data.cardToken,
payer_email: data.email,
reason: `Compra do ${data.plan.name}`,
status: 'authorized',
back_url: 'https://www.mercadopago.com.ar',
auto_recurring: {
frequency: 1,
frequency_type: 'months',
start_date: new Date().toISOString(),
end_date: new Date(
today.getFullYear() + 10,
today.getMonth(),
today.getDate(),
).toISOString(),
currency_id: 'BRL',
transaction_amount: Number(data.plan.price),
},
},
}); |
Beta Was this translation helpful? Give feedback.
Answered by
LucasDshg
Oct 17, 2024
Replies: 2 comments
-
got same error by Postman |
Beta Was this translation helpful? Give feedback.
0 replies
-
The error occurs because of using a test card. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
LucasDshg
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The error occurs because of using a test card.