PayPal

Junker uses PayPal REST API to process all transactions.

Before creating any billing plan (or subscriptions) you’ll need to set you PayPal credentials. To do this, open the .env file located on the root directory on your project directory and add the following:

PAYPAL_MODE=sandbox or live
PAYPAL_ID=your-paypal-id
PAYPAL_SECRET=your-paypal-secret-key

You can find these credentials on your PayPal Developer Account.

PAYPAL_MODE must match your PayPal Application status. New apps on your PayPal Developer Account will have mode set to “sandbox” by default. To make sure you have the correct mode, go to your PayPal Developer Account > My Apps & Credentials > [select application], look for “sandbox” and “live” buttons, the blue button means the selected status.

Warning

All non-free plans needs to be sent to PayPal in order to create the billing agreement, if your configuration isn’t correct, plans won’t be sent to PayPal and therefore, fail to create the billing agreement when subscribing to a paid plan using the PayPal payment method.

Note

It’s recommended to test all the subscription process before going live.

PayPal Webhooks

Create a webhook for all events types that points to https://example.com/api/paypal/webhook. For security reasons the URL must be https.

You can change this address on app/Http/Routes/api.php file, look for paypal.webhook.

Debugging PayPal Errors

If you are experiencing errors during the payment flow, creation of non-free plans etc, the log file can help you. By default logging is disabled for paypal.

To enable PayPal logging, open the .env file and add the following

PAYPAL_LOG=true
PAYPAL_LOG_LEVEL=ERROR

On PAYPAL_LOG_LEVEL you can add DEBUG, INFO, WARN or ERROR. If you are using the API with mode set to live, the DEBUG value cannot be used.

All PayPal logs are stored on storage/logs/paypal.log. You can change this by adding PAYPAL_LOG_FILE=path/to/file.log on the .env file.