Skip to content
Advertisement

i tried implementing “srmklive/paypal”: “~1.0”, into my laravel project locally, while testing the implementation, i got an error below

Undefined index: secret lluminateFoundationBootstrapHandleExceptions::handleError C:wamp64wwwchefruntownvendorsrmklivepaypalsrcTraitsPayPalRequest.php:329

private function setApiProviderConfiguration($credentials){
    // Setting PayPal API Credentials

    collect($credentials[$this->mode])->map(function ($value, $key) {

        $this->config[$key] = $value;

    });


    // Setup PayPal API Signature value to use.

    $this->config['signature'] = empty($this->config['certificate']) ?

    $this->config['secret'] : $this->config['certificate'];

    $this->paymentAction = $credentials['payment_action'];

    $this->locale = $credentials['locale'];

    $this->certificate = $this->config['certificate'];

    $this->validateSSL = $credentials['validate_ssl'];

    $this->setApiProvider($credentials);
}

Advertisement

Answer

I updated the paypal.php file found in my config folder with this

<?php
/**
 * PayPal Setting & API Credentials
 * Created by Raza Mehdi <srmk@outlook.com>.
 */

return [
    'mode'    => env('PAYPAL_MODE', 'sandbox'), // Can only be 'sandbox' Or 'live'. If empty or invalid, 'live' will be used.
    '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'      => 'APP-80W284485P519543T', // 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.
];
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement