No, you misunderstand the PayPal payment process. Here is the correct thread:
Omnipay:: create(), $gateway- > initialize() $gateway- > authorize() , , . returnUrl URL- , cancelUrl. , http://localhost:8000/return ( - URL).
$gateway- > authorize() RedirectResponse. :
//
$transaction = $gateway->authorize(array(
'returnUrl'=> env('PAYMENT_SANDBOX_PAYPAL_URL'),
'cancelUrl' => 'http://localhost:8000/cancel',
'amount' => '10.00',
'currency' => 'AUD',
'description' => 'This is a test authorize transaction.',
));
$response = $transaction->send();
if ($response->isRedirect()) {
$redirectUrl = $response->getRedirectUrl();
}
. - PayPal, , PayPal, , , , .
, , , PayPal -, redirectUrl, authorize(). . completeAuthorize, , :
$transaction = $gateway->completePurchase(array(
'payerId' => $request->PayerID,
'transactionReference' => $authResponse
));
$finalResponse = $transaction->send();
dd($finalResponse);
if ($finalResponse->getData()) {
echo "Transaction was successful!\n";
$results = $finalResponse->getTransactionReference();
dd($results);
}else{
dd($finalResponse->getData());
}
, returnUrl.
cancelUrl, PayPal URL- cancelUrl -.
, , - PayPal, url. - , - , , " " PayPal . - omnipay-paypal fetchPurchase() listPurchase().