PaymentService
Key Features
- Subscription Management: Create, update, and synchronize subscriptions with external providers.
- Billing Integration: Manage customer billing data and synchronize it with external systems.
- Payment Processing: Support for both one-time payments and subscription checkout sessions.
- Product and Pricing Synchronization: Maintain consistency between internal and external product/pricing data.
- Webhook Handling: Process external provider events to synchronize the internal system.
Methods
- Checkout Management:
checkout_subscription: Initiates a subscription checkout session with Stripe.checkout: Handles one-time payment sessions.
- Billing and Customer Synchronization:
synchronize_customer: Synchronizes customer data with Stripe, creating or updating records.create_external_customer: Links internal customers with external provider accounts.synchronize_customers: Synchronizes multiple customers with external systems.
- Subscription Management:
create_external_subscription: Creates a subscription record in the external provider.get_subscription: Retrieves a subscription using its external ID.get_external_subscription: Fetches subscription data from the external provider.
- Product and Pricing Synchronization:
synchronize_products: Ensures product and pricing data align with external providers.get_pricing: Fetches pricing details from external systems.
- Webhook Handling:
handle_webhook: Decodes and processes webhook events from external providers.
- Tax and VIES Validation:
is_country_from_eu: Checks if a country is an EU member.verify_vies_number: Validates VAT numbers using the VIES API.
- Stripe-Specific Operations:
create_stripe_customer_portal_link: Generates a customer management portal link in Stripe.get_customer: Retrieves customer details linked to an external provider.
Example Workflow
- Initiate Subscription Checkout
- Synchronize Products
- Validate VAT Number
Dependencies
-
Repositories
-
ExternalCustomerRepository: Manages customer records with external providers. -
ExternalProductRepository: Handles product synchronization with external systems. -
ExternalPricingRepository: Tracks external pricing data. -
ExternalSubscriptionRepository: Manages external subscription records. -
Services
-
StripeProvider: Integrates with Stripe for managing customers, subscriptions, and payments.
Purpose
This service provides a centralized abstraction for payment processing and external integrations, ensuring reliable coordination between the internal system and external payment providers.