Setup
Database Setup
FastAPI Payments requires a database to store payment data. The library will automatically create the necessary database tables when initialized.
For production use, you should use Alembic for migrations:
# Install alembic
pip install alembic
# Initialize alembic
alembic init migrations
# Create a migration
alembic revision --autogenerate -m "Initial payment tables"
# Run the migration
alembic upgrade head
RabbitMQ Setup
While not required for basic functionality, FastAPI Payments leverages RabbitMQ for event-driven operations. You can:
Install RabbitMQ locally:
# Debian/Ubuntu sudo apt-get install rabbitmq-server # macOS brew install rabbitmq # Start the service sudo service rabbitmq-server start
Use Docker:
docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management
Use a cloud service like CloudAMQP
Configure the URL in your settings.
Provider Accounts
You’ll need to create accounts with the payment providers you intend to use:
Stripe
Create a Stripe account at https://stripe.com
Get your API keys from the Developer Dashboard
Configure webhooks for your environment
PayPal
Create a PayPal Developer account at https://developer.paypal.com
Create an application to get your client ID and secret
Configure webhooks for your environment
Adyen
Create an Adyen account at https://www.adyen.com
Get your API key and merchant account
Configure webhooks for your environment