Refund payment

POST https://app.speybooks.com/api/v1/admin/orgs/{id}/refund

Issue a full or partial refund for an organisation's most recent Stripe charge.

Flow

  1. Look up organisation and stripe_customer_id
  2. Return 400 if no Stripe customer exists
  3. Fetch most recent charge via stripe.charges.list({ limit: 1 })
  4. Return 400 if no charges found
  5. Create refund via stripe.refunds.create() — partial if amount provided (in pence), full otherwise
  6. Write PAYMENT_REFUNDED audit log with charge ID, refund ID, amount, and currency

Request Body

  • amount — optional, pence. Omit for full refund
  • reason — minimum 5 characters, required for audit

Error responses:

  • 400 { code: "NO_CUSTOMER" } — no Stripe customer
  • 400 { code: "NO_CHARGES" } — no charges found
  • 404 { code: "NOT_FOUND" } — organisation not found

Path parameters

id string required
Organisation ID.

Body parameters

reason string required
Reason for refund (audit trail). Min 5 characters.
min length: 5
amount number optional
Refund amount in pence. Omit for full refund.

Response

200 Refund created. Returns Stripe refund ID, amount, and status.
Show response fields
amount integer
currency string
refundId string
status string

Error codes

400 No Stripe customer or no charges found.
404 Organisation not found.