• 1000 в строку
, когда я печатаю $ response, который я получаю:
array:3 [▼
"type" => "error"
"message" => ""
"paypal_link" => null
]
У меня есть пустой app_id, это может вызвать проблему. Мой код выглядит следующим образом:
Контроллер:
public function payment(Request $request)
{
.....
.....
$data['return_url'] = route('payment.success',$r_id);
$data['cancel_url'] = route('payment.cancel');
$data['total'] = $tot_amt
$provider = new ExpressCheckout;
$response = $provider->setExpressCheckout($data);
$response = $provider->setExpressCheckout($data, true);
return redirect($response['paypal_link']);
}
PayPal:
return [
'mode' => env('PAYPAL_MODE', 'live'),
'sandbox' => [
'username' => env('PAYPAL_SANDBOX_API_USERNAME', ''),
'password' => env('PAYPAL_SANDBOX_API_PASSWORD', ''),
'secret' => env('PAYPAL_SANDBOX_API_SECRET', ''),
'certificate' => env('PAYPAL_SANDBOX_API_CERTIFICATE', ''),
'app_id' => '', // Used for testing Adaptive Payments API in sandbox mode
],
'live' => [
'username' => env('PAYPAL_LIVE_API_USERNAME', ''),
'password' => env('PAYPAL_LIVE_API_PASSWORD', ''),
'secret' => env('PAYPAL_LIVE_API_SECRET', ''),
'certificate' => env('PAYPAL_LIVE_API_CERTIFICATE', ''),
'app_id' => '', // Used for Adaptive Payments API
],
'payment_action' => 'Sale', // Can only be 'Sale', 'Authorization' or 'Order'
'currency' => env('PAYPAL_CURRENCY', 'USD'),
'billing_type' => 'MerchantInitiatedBilling',
'notify_url' => '', // Change this accordingly for your application.
'locale' => '', // force gateway language i.e. it_IT, es_ES, en_US ... (for express checkout only)
'validate_ssl' => true, // Validate SSL when creating api client.
];
.env
PAYPAL_LIVE_API_USERNAME='XXXXXXXXXX'
PAYPAL_LIVE_API_PASSWORD='XXXXXXXX'
PAYPAL_LIVE_API_SECRET='XXXXXXXXXXXXXXX'
PAYPAL_CURRENCY=USD
PAYPAL_LIVE_API_CERTIFICATE='XXXXXXXXXXXXXXXXXX'