Enable or disable Stripe payments
POST/company/payment/withStripe
Enable or disable Stripe payment integration for the authenticated user's company.
Objective
Give the company administrator full control over whether electronic payments are active, with automatic creation of the Stripe customer if activated for the first time.
Use Cases
- Activate Stripe for the first time to start receiving payments
- Temporarily disable electronic payments
- Reactivate payments after a period of inactivity
Validation Flow
flowchart TD
A[Receive Request - enabled] --> B{User authenticated?}
B -->|No| C[404 USER_NOT_FOUND]
B -->|Yes| D{Company found?}
D -->|No| E[401 CIA_NOT_FOUND]
D -->|Yes| F[Set withStripe = enabled]
F --> G{enabled=true AND no stripe_customer?}
G -->|Yes| H[Auto-create Stripe customer]
H --> I{Created OK?}
I -->|No| J[500 Error]
I -->|Yes| K[Save company]
G -->|No| K
K --> L[200 success: true]
Notes
- Requires JWT authentication (bearerAuth)
- If
enabled=trueand nostripe_customerexists, it is automatically created usinginvoice_data.email - If
enabled=false, it only disables without deleting the Stripe customer or payment methods
Request
Responses
- 200
- 401
- 404
- 500
Stripe configuration updated
Response Headers
Company not found
Response Headers
User not found
Response Headers
Error creating Stripe client or saving configuration