Register company as a customer in Stripe
POST/company/payment/register_stripe
Purpose
Create a Stripe customer for the authenticated user if they do not already have one registered, and return the customer ID.
Objective
Initialize the relationship between the company user and Stripe by obtaining the stripe_customer ID required for all subsequent payment operations.
Use Cases
- Initial registration before setting up payment methods
- Verify if the user is already registered in Stripe
- Prerequisite for subscriptions and payments
Validation Flow
flowchart TD
A[Receive Request] --> B{User authenticated?}
B -->|No| C[404 USER_NOT_FOUND]
B -->|Yes| D{User in DB?}
D -->|No| E[401 USER_NOT_FOUND]
D -->|Yes| F{stripe_customer exists?}
F -->|Yes| G[Return existing ID]
F -->|No| H[Create Stripe customer]
H --> I{Created OK?}
I -->|No| J[401 STRIPE_ACCOUNT_NOT_CREATED]
I -->|Yes| K[Save ID to user.payment_settings]
K --> L[200 success + stripe_customer]
G --> L
Notes
- Requires JWT authentication (bearerAuth)
- Idempotent: if
stripe_customeralready exists, returns the existing ID - Operates on the
company_user, not directly on the company - No request body required
Request
Responses
- 200
- 401
- 404
Stripe customer successfully registered or already existing.
Response Headers
User not found in DB or error creating account in Stripe
Response Headers
Authenticated user not found