{"openapi":"3.1.0","info":{"title":"POST /api/v1/delayed-charges","version":"1.0.0","description":"Create delayed charge"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/delayed-charges":{"post":{"tags":["delayed-charges"],"summary":"Create delayed charge","description":"Create a new delayed charge or credit in pending status.","operationId":"create_delayed_charge_api_v1_delayed_charges_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DelayedChargeCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DelayedChargeResponse"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"detail":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"example":{"detail":"Not authenticated"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"detail":"Not enough permissions"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"detail":"Resource not found"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"DelayedChargeCreate":{"properties":{"type":{"type":"string","title":"Type","description":"Type: 'charge' or 'credit'","default":"charge"},"customer_id":{"type":"string","title":"Customer Id","description":"Customer to charge"},"amount":{"type":"integer","exclusiveMinimum":0.0,"title":"Amount","description":"Amount in cents"},"description":{"type":"string","minLength":1,"title":"Description","description":"Description"},"line_items":{"anyOf":[{"items":{"$ref":"#/components/schemas/DelayedChargeLineItem"},"type":"array"},{"type":"null"}],"title":"Line Items","description":"Optional line items"},"service_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Service Date","description":"Date service was performed (YYYY-MM-DD)"},"internal_notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Internal Notes","description":"Internal notes"},"currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Currency","description":"Currency code","default":"USD"}},"type":"object","required":["customer_id","amount","description"],"title":"DelayedChargeCreate","description":"Request schema for creating a delayed charge."},"DelayedChargeLineItem":{"properties":{"variant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Variant Id","description":"Product variant ID or null for custom"},"description":{"type":"string","title":"Description","description":"Line item description"},"quantity":{"type":"integer","minimum":1.0,"title":"Quantity","description":"Quantity","default":1},"unit_price":{"type":"integer","title":"Unit Price","description":"Unit price in cents"},"amount":{"type":"integer","title":"Amount","description":"Total amount in cents (qty * unit_price)"}},"type":"object","required":["description","unit_price","amount"],"title":"DelayedChargeLineItem","description":"Line item for a delayed charge."},"DelayedChargeResponse":{"properties":{"id":{"type":"string","title":"Id"},"business_id":{"type":"string","title":"Business Id"},"customer_id":{"type":"string","title":"Customer Id"},"type":{"type":"string","title":"Type"},"status":{"type":"string","title":"Status"},"currency":{"type":"string","title":"Currency"},"amount":{"type":"integer","title":"Amount"},"amount_in_dollars":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Amount In Dollars"},"description":{"type":"string","title":"Description"},"internal_notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Internal Notes"},"line_items":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Line Items"},"service_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Service Date"},"invoiced_invoice_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoiced Invoice Id"},"invoiced_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Invoiced At"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Name"},"can_be_updated":{"type":"boolean","title":"Can Be Updated","default":false},"can_be_deleted":{"type":"boolean","title":"Can Be Deleted","default":false},"can_be_invoiced":{"type":"boolean","title":"Can Be Invoiced","default":false}},"type":"object","required":["id","business_id","customer_id","type","status","currency","amount","amount_in_dollars","description","created_at","updated_at"],"title":"DelayedChargeResponse","description":"Response schema for a delayed charge."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}