Payment gateways

A payment gateway may be used by your end-users to pay invoice after the gateway is enabled and configured.

Configuration templates for payment gateway settings are present in the settings.py file. If nothing related to gateways is present in settings.py, you have probably initially installed an older version of Fleio and, you need to copy the settings template from settings.template file.

Enable and configure a payment gateway

In order to enable a payment gateway, edit the settings.py file and uncomment and edit the settings related to the payment gateway that you want to enable. After editing settings.py and accepting the Fleio restart (required after each settings.py edit), navigate to Billing / Gateways section in the staff panel. The newly configured payment gateway should be now be visible. Enable it.

For specific configuration parameters details for a payment gateway see instructions below:

  • Paypal - visit https://developer.paypal.com/developer/applications/ log-in with your account and generate credentials at Rest API Apps section then edit PAYPAL_SETTINGS in settings.py (you can generate credentials both for testing and live transactions)

    Note: Make sure you set the payment receiver account to accept all currencies configured in fleio

    Use https://fleio_url/backend/api/billing/gateway/paypal/callback for webhooks to get event notifications

  • Romcard - contact Romcard via https://romcard.ro to obtain your API credentials then edit ROMCARD_SETTINGS in settings.py

  • Stripe - login to http://stripe.com go to API menu and, you should find the API keys then edit STRIPE_SETTINGS in settings.py.

  • PayU - register at PayU for api credentials then edit PAYU_SETTINGS in settings.py.

  • PayURO - contact PayURO in order to obtain the api credentials then edit PAYURO_SETTINGS in settings.py.

  • iPay - contact https://btepos.ro/ in order to obtain the api credentials then edit IPAY_SETTINGS in settings.py.

Notes for Stripe:

  • to get the signing_secret key, create a Stripe webhook to https://fleio_url/backend/api/billing/gateway/stripe/callback on the stripe dashboard’s webhooks section

  • Stripe should listen to all events related to Payment Intents:
    • payment_intent.amount_capturable_updated

    • payment_intent.canceled

    • payment_intent.created

    • payment_intent.payment_failed

    • payment_intent.succeeded

  • Fleio latest version is tested with Stripe API version 2022-11-15

  • Before Fleio 2023.06.1 Fleio works with Stripe API version 2019-09-09

Warning

After you have enabled the gateway we will have to manually run the migrations in order to add the necessary fields in the database.

First of all, you should consider making a backup of your database before doing any kind of changes to the database.

After you configure the new payment gateway in settings.py, run the Django migrations (which will add the required database tables):

fleio django migrate

After the migration is completed, you must restart all fleio services.

Configuring a payment gateway

After a gateway is enabled you can configure it from Billing/Gateways. The following options are available for a gateway:

  • Enabled - when enabled is checked the payment gateway can be used by staff to add manual payments

  • Visible to user - when visible to user is checked the payment gateway will appear in the payment options available to end-users

  • Fixed fee & Percent fee - the fees used by the payment gateway for each transaction - these will be stored in journal entries related to transactions

Configuring a gateway for recurring payments

If you want to enable recurring payments for a gateway, you will have to first enable and configure the payment gateway as described above. You also have to enable the billing.recurring_payments feature toggle.

Some payment gateways require additional fields in the Fleio database, so you need to re-run the migrations as you did in the previous step when enabling the payment gateway.

Run this command:

fleio django migrate

After the migration is completed, restart all fleio services.

The next step will be to enable the recurring payments from frontend. Just log in as staff in Fleio, go to Billing -> Gateways, click on the desired gateway and check the box “Enable recurring payments”.

Lastly, if you want to enable recurring payments for Stripe/PayuRO, you will have to configure the notification URL in the Stripe/PayuRO panel. The notification URL should be the same as the callback URL that was configured previously (Enable and configure a payment gateway). Below you can find an example for Stripe and PayuRO.

../_images/stripe.png ../_images/payuro.png