PayPal Setup - itinerare/Aldebaran GitHub Wiki
If you don't already have one, you'll need to make a PayPal business account (required to manage live apps) and complete relevant setup there first!
Once you have your account set up, you will need to sign in to the developer dashboard.
API and Webhook Setup
In order to connect Aldebaran to your PayPal account, you will need to create a REST API app.
Navigate to Apps & Credentials (or click here). Ensure you are in live and not sandbox mode!
- Click "Create App" under the REST API apps header
- Enter a relevant name for your app
- Click "Create App"
You will now be taken to the edit page for your app. You can view the API credentials here and edit various properties of the app. For the purposes of connecting to Aldebaran, you will need your app's client ID and secret, listed under "Live API Credentials".
You will also need to create a webhook; this will allow PayPal to inform Aldebaran when invoices are paid. You can do this via your app's page. The "Live Webhooks" section should be at or near the bottom of the page.
- Click "Add Webhook"
- For "Endpoint URL", provide
https://site-name.com/admin/webhooks/paypal, substituing in your own domain name
- Scroll down through the list of available events until you see "Invoicing invoice paid" and check it
- Click the "Save" button below the list available events
You should see a "Webhook added successfully" message, and information about your new webhook should be displayed in the list of webhooks for your app. In order to allow Aldebaran to verify that incoming requests to this webhook are coming from PayPal, you'll need to get the Webhook ID here.
Add the following to your live site's .env file, substituting in your app's client ID, client secret, and webhook ID:
PAYPAL_MODE=live PAYPAL_CLIENT_ID= PAYPAL_CLIENT_SECRET= PAYPAL_WEBHOOK_ID=
Note that unless testing locally, you should not change the
PAYPAL_MODE value from live!
To finish enabling PayPal integration features, find the entry for PayPal in
config/aldebaran/commissions.php, under "Payment Processors". Ensure that PayPal is enabled as a payment processor overall, and enable the integration features under
integration. If desired, set a business name to be applied to sent invoices here as well.
As with inital setup, commit the config file changes in your Git client and push them to your server. If the hooks have been set up correctly, you should see the effects on the live site after it's done. If not, and there were no errors, you may need to run
php artisan optimize once or twice in your SSH client.
In your site's admin panel, if you have pre-existing commission classes, ensure that you supply at minimum a product name and category to be used on outgoing invoices. You can also customize this per commission category, type, and individual commission if you so desire, but as the class' information is used if none of those are set, it's required to do so here. You may also set a product description if desired.
You should also set a logo image under Site Images if desired. Note that you may need to hard refresh for it to appear due to browser caching.
From there, you should be able to send invoices for payments for any commissions using PayPal as their payment processor via Aldebaran, and PayPal should in turn inform it when those invoices are paid!