Payment Integration
Stripe Calls
To process payments with Stripe, you need a Stripe merchant account. Create one.
Create a great Stripe profile—especially if you are from countries outside the USA or EU. Ensure all documentation and information are supplied. Otherwise, it is highly likely your account will be suspended.
After logging in to Stripe, type "API" in the search bar, and navigate to Developers → API Keys.
Retrieve your Secret Key and add it to the environment variables under STRIPE_API_KEY
.
This enables the app to make calls to the Stripe API for creating customers, checkouts, etc. All Stripe API calls are handled by the StripeProvider
class in the Payment app.
Webhooks
Stripe sends webhooks to your API with data about system events. There are two different configurations depending on local or server deployment.
Go to Developers → API, select the Webhooks tab, and click Add Endpoint. Choose Add an Endpoint or Test in Local Environment.
Deploy Endpoints
When configuring a production endpoint, remember to add the full URL and specify all events you want to handle. The minimum event list includes:
After this, you will receive an endpoint secret, which must be added to the environment variables under STRIPE_ENDPOINT_SECRET
.
Taxation
Due to European Union regulations, taxes must be specified for your product and country. To set up taxes:
- Navigate to Product Catalog → Tax Rates Tab and click Create Tax Rate.
- Specify the type of tax, rate, and click Add Tax Rate.
- Collect the
tax_rate_id
of this tax and provide it inSTRIPE_COUNTRY_VAT_TAXATION_ID
.
This tax will be applied to any product, either exclusively or inclusively.
VAT VIES
This project is configured to support VAT VIES regulations, which determine VAT tax based on the following:
- Same country as the app owner: Full VAT.
- Country from the EU: Full VAT.
- Country outside the EU: 0 VAT.
You can adjust this during the creation of a customer in the create_user_billing_info
method within the PaymentInteractor
.