Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

afoysal's avatar

PayPal SandBox

My SandBox settings are like below

error

My .env code is like below

PAYPAL_SANDBOX_CLIENT_ID=Afr4Ig_nu8QUTt3uPBJW-VLEQoBTdS_OjGqZIXtM4FLWZpLNamAEo6NtTbHeB-_WWwESBdioqQNZW1Kw
PAYPAL_SANDBOX_SECRET=EMHy-4TQ5C6O8qA8ZittO-XhdJ-xM-PUuHR2f6oRBlVqR9MB26WDYtkjdR4ejhQpKPyLZpGmwxMTSXSA

I am trying to access them like below in one of my controller

if(config('paypal.settings.mode') == 'live'){
            $this->client_id = config('paypal.live_client_id');
            $this->secret = config('paypal.live_secret');
        } else {
            $this->client_id = config('paypal.sandbox_client_id');
            $this->secret = config('paypal.sandbox_secret');
        }

        echo $this->client_id;

        die();

But I am getting blank white screen.

0 likes
5 replies
automica's avatar

@afoysal if you aren't getting the value immediately through from your .env you may need to clear your config cache

php artisan config:cache
1 like
afoysal's avatar

Thanks @automica . I cleared config cache. But result is same like before. I couldn't find out where I am doing mistake. Thanks.

afoysal's avatar

Thanks @automica . I am using this package composer require paypal/rest-api-sdk-php. Thanks.

Please or to participate in this conversation.