v4

latestOpenAPI 3.1.02026-08-03427198448.4 KB

Delete Payment With Invoice Update

Delete a payment and automatically update the related invoice's payment status.

This endpoint provides intelligent payment deletion that:

  1. Validates payment ownership and permissions
  2. Automatically recalculates and updates the invoice payment status
  3. Creates an audit trail in invoice events
  4. Maintains data consistency across the system

Business Rules:

  • Payment status is recalculated based on remaining payments
  • Invoice events are created for audit purposes
  • Only payments belonging to the authenticated organization can be deleted
  • Note: Deleting Stripe payments removes the record but does not refund through Stripe

Args: payment_id: UUID of the payment to delete user_id: ID of the authenticated user (from auth middleware) org_id: ID of the user's organization (from auth middleware)

Returns: dict: Success response with updated invoice information

Raises: HTTPException: 401 if unauthorized, 404 if not found, 400 if Stripe payment, 500 if server error

delete/payments/{payment_id}

Path parameters

payment_idstring required

The ID of the payment to delete

The ID of the payment to delete

Query parameters

bulk_operationboolean
user_idstring
org_idstring

Response

Successful Response

{"stackTrail":"paths:/payments/{payment_id}:delete:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}