You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Card Payment Brick module for the card payment integration in my Laravel website but when I try to save the payment it returns {}. There is no error or anything else that can guide.
This is Js code that sends the form data to the controller.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am using Card Payment Brick module for the card payment integration in my Laravel website but when I try to save the payment it returns {}. There is no error or anything else that can guide.
This is Js code that sends the form data to the controller.
return new Promise((resolve, reject) => { fetch(paymentRoute, { method: "POST", headers: { "Content-Type": "application/json", "X-CSRF-Token": $('input[name="_token"]').val() }, body: JSON.stringify(cardFormData) }) .then((response) => { resolve(); }) .catch((error) => { reject(); }) });
This is PHP code from the controller that processes the data and saves the information.
SDK::setAccessToken(env('MERCADO_PAGO_ACCESS_TOKEN', config('services.mercado-pago.access-token')));
$payment = new Payment();
$payment->transaction_amount = session('trade-price');
$payment->token = $request['token'];
$payment->installments = $request['installments'];
$payment->payment_method_id = $request['payment_method_id'];
$payment->issuer_id = $request['issuer_id'];
$payer = new Payer();
$payer->email = $request['payer']['email'];
$payer->identification = array(
"type" => $request['payer']['identification']['type'],
"number" => $request['payer']['identification']['number']
);
$payment->payer = $payer;
$payment->save();
return json_encode($payment);
Beta Was this translation helpful? Give feedback.
All reactions