Код: Выделить всё
[2024-12-05 14:45:32] local.INFO: PayPal response:
{"name":"AUTHENTICATION_FAILURE","message":"Authentication failed due to invalid
authentication credentials or a missing Authorization header.","links":
Код: Выделить всё
public function generatePaypalPaymentByTransaction(Transaction $transaction) {
try {
$gateway = Omnipay::create('PayPal_Rest');
$gateway->setClientId(env('PAYPAL_CLIENT_ID'));
$gateway->setSecret(env('PAYPAL_SECRET'));
$gateway->setTestMode(false);
$urlHost = env('URL_HOST');
$response = $gateway->purchase([
'amount' => $transaction->amount,
'currency' => env('PAYPAL_CURRENCY'),
'returnUrl' => $returnUrl,
'cancelUrl' => $cancel_url,
])->send();
Log::info('PayPal response: ' . json_encode($response->getData()));
if($response->isRedirect()) {
$response->redirect();
} else {
return $response->getMessage();
}
} catch (Throwable $e){
return $e->getMessage();
}
Подробнее здесь: https://stackoverflow.com/questions/792 ... pplication
Мобильная версия