Skip to main content

Set default payment method

POST 

/company/payment/default_payment_method/:id

Designate an existing payment method as the default for all future company payment operations.

Objective

Update payment_settings.default_payment_method in the company so that delivery payments are processed with that card.

Use Cases

  • Select the primary card after adding a new one
  • Change the default method after renewing a card
  • Designate an active method before processing a delivery

Validation Flow

flowchart TD
A[Receive Request - id] --> 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{stripe_customer exists?}
F -->|No| G[404 STRIPE_CUSTOMER_NOT_FOUND]
F -->|Yes| H{PM belongs to customer?}
H -->|No| I[401 PAYMENT_METHOD_NOT_FOUND]
H -->|Yes| J[Set as default_payment_method]
J --> K[Save company]
K --> L[200 success: true]

Notes

  • Requires JWT authentication (bearerAuth)
  • Only one method can be set as default at a time
  • The ownership validation verifies that the PM belongs to the company's stripe_customer
  • The change is immediate and applies to upcoming delivery payments

Request

Responses

Payment method set as default

Response Headers