Skip to main content

Register company as Stripe customer

POST 

/company/payment/register_stripe

Create a Stripe customer for the authenticated user if one is not already registered, and return the customer ID.

Objective

Initialize the relationship between the company user and Stripe, 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_customer already exists, returns the existing ID
  • Operates on the company_user, not directly on the company
  • No body required

Request

Responses

Stripe customer successfully registered or already existing

Response Headers