Refund payment
POST
https://app.speybooks.com/api/v1/admin/orgs/{id}/refundIssue a full or partial refund for an organisation's most recent Stripe charge.
Flow
- Look up organisation and
stripe_customer_id - Return 400 if no Stripe customer exists
- Fetch most recent charge via
stripe.charges.list({ limit: 1 }) - Return 400 if no charges found
- Create refund via
stripe.refunds.create()— partial ifamountprovided (in pence), full otherwise - Write
PAYMENT_REFUNDEDaudit log with charge ID, refund ID, amount, and currency
Request Body
amount— optional, pence. Omit for full refundreason— minimum 5 characters, required for audit
Error responses:
400 { code: "NO_CUSTOMER" }— no Stripe customer400 { code: "NO_CHARGES" }— no charges found404 { code: "NOT_FOUND" }— organisation not found
Path parameters
id string requiredOrganisation ID.
Body parameters
reason string requiredReason for refund (audit trail). Min 5 characters.
amount number optionalRefund amount in pence. Omit for full refund.
Response
200 Refund created. Returns Stripe refund ID, amount, and status.
Show response fields
amount integercurrency stringrefundId stringstatus stringError codes
400 No Stripe customer or no charges found.
404 Organisation not found.