Я использую этот пакет:
https://github.com/barryvdh/laravel-omnipay
В моем контроллере я добавил:
$params = [
'amount' => '10',
'issuer' => 22,
'description' => 'desc',
'returnUrl' => URL::action('PurchaseController@returnApi', [43]),
];
$response = Omnipay::purchase($params)->send();
if ($response->isSuccessful()) {
// payment was successful: update database
print_r($response);
} elseif ($response->isRedirect()) {
// redirect to offsite payment gateway
return $response->getRedirectResponse();
} else {
// payment failed: display message to customer
echo $response->getMessage();
}
Вот мой файл конфигурации omnipay.php:
<?php
return array(
/** The default gateway name */
'gateway' => 'PayPal_Express',
/** The default settings, applied to all gateways */
'defaults' => array(
'testMode' => true,
),
/** Gateway specific parameters */
'gateways' => array(
'PayPal_Express' => array(
'username' => '',
'landingPage' => array('billing', 'login'),
),
),
);
Но получите эту ошибку:
call_user_func_array() ожидает, что параметр 1 будет допустимым обратным вызовом, класс «Omnipay\Common\GatewayFactory» не имеет метода «покупка»
Кто-нибудь может помочь мне установить это? Я создал приложение в PayPal, и у меня есть подробности о нем, но я не знаю, как установить его с помощью этого API...