Update PaymentController.php

This commit is contained in:
Anon Dev 2021-06-16 16:35:07 +02:00 committed by GitHub
parent c17ed5389f
commit e587c3a23b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,6 +60,7 @@ class PaymentController extends Controller
"purchase_units" => [ "purchase_units" => [
[ [
"reference_id" => uniqid(), "reference_id" => uniqid(),
"description" => $paypalProduct->display,
"amount" => [ "amount" => [
"value" => $paypalProduct->price, "value" => $paypalProduct->price,
"currency_code" => strtoupper($paypalProduct->currency_code) "currency_code" => strtoupper($paypalProduct->currency_code)
@ -69,7 +70,9 @@ class PaymentController extends Controller
"application_context" => [ "application_context" => [
"cancel_url" => route('payment.cancel'), "cancel_url" => route('payment.cancel'),
"return_url" => route('payment.success', ['product' => $paypalProduct->id]), "return_url" => route('payment.success', ['product' => $paypalProduct->id]),
'brand_name' => config('app.name', 'Laravel') , 'brand_name' => config('app.name', 'Laravel'),
'shipping_preference' => 'NO_SHIPPING',
'user_action' => 'PAY_NOW'
] ]
]; ];
@ -155,7 +158,7 @@ class PaymentController extends Controller
]); ]);
//redirect back to home //redirect back to home
return redirect()->route('home')->with('success', 'Credits have been increased!'); return redirect()->route('home')->with('success', 'Your credit balance has been increased!');
} }
// If call returns body in response, you can get the deserialized version from the result attribute of the response // If call returns body in response, you can get the deserialized version from the result attribute of the response
@ -183,6 +186,6 @@ class PaymentController extends Controller
*/ */
public function cancel(Request $request) public function cancel(Request $request)
{ {
return redirect()->route('store.index')->with('success', 'Payment Canceled'); return redirect()->route('store.index')->with('success', 'Payment was Cannceled');
} }
} }