Criar transação com SDK #526
Closed
Rodcommerce
started this conversation in
General
Replies: 1 comment
-
Oi, @Rodcommerce |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Estou utilizando o SDK, conforme explica o README.
LOG:
{
"error": "Api error. Check response for details",
"idempotencyKey": "b4ab17f6-8b17-4e6a-985f-4b234758232e",
"data_sent": {
"transaction_amount": 100,
"token": "704694f06557208abeb4154d926f2aae",
"description": "description",
"installments": 1,
"payment_method_id": "visa",
"payer": {
"email": "[email protected]"
}
},
"response": {
"message": "internal_error",
"error": null,
"status": 500,
"cause": []
}
}
Para gerar o CardToken ->
const mercadopago = new MercadoPago(publicKey);
const cardForm = {
cardNumber: cardNumber,
cardholderName: self.checkoutData.user.nomeFantasia,
cardExpirationMonth: expirationMonth,
cardExpirationYear: expirationYear,
securityCode: cvv,
};
mercadopago.createCardToken(cardForm).then(response => {
resolve(response.id);
}).catch(error => {
console.log({error});
reject(error);
});
$idempotencyKey = Uuid::uuid4()->toString();
$createRequest = [
"transaction_amount" => 100,
"token" => $credit_card_data['credit_card_token'],
"description" => "description",
"installments" => 1,
"payment_method_id" => "visa",
"payer" => [
"email" => "[email protected]",
]
];
$request_options = new RequestOptions();
$request_options->setCustomHeaders(["X-Idempotency-Key: $idempotencyKey"]);
$payment = $client->create($createRequest, $request_options);
Já tentei de varias formas, direto por cURL, e sempre retorna internal_error.
Beta Was this translation helpful? Give feedback.
All reactions