Refund Subscription Payment
Refunds the latest payment for a subscription (or the specific payment provided) and records the refund with your PSP. Supports partial refunds and can optionally terminate the subscription after a successful refund. When an original invoice exists, a credit note or cancellation invoice is generated to mirror the refund.
Authorization
bearerAuth Use your secret API key as the bearer token
In: header
Path Parameters
Stable subscription ID (sub_*). Must belong to your merchant.
^sub_[A-Za-z0-9]{22}$Request Body
application/json
Payment ID (pay_*) to refund. Must belong to the same merchant as the subscription.
^pay_[A-Za-z0-9]{22}$Amount to refund in cents. If omitted, the remaining refundable balance is refunded.
1 <= valueOptional reason recorded for audit and credit note memo.
When true, cancels the subscription after a successful refund by ending it immediately.
Response Body
application/json
application/json
application/json
application/json
curl -X POST "https://api.getlumen.dev/v1/subscriptions/sub_5n3K2gVDt1xQ78kPq4LzYh/refunds" \ -H "Content-Type: application/json" \ -d '{ "paymentId": "pay_6MZtR1qX8bLC3Dgo5NsQ0u", "reason": "Customer requested cancellation within cooling-off period" }'{
"success": true,
"refund": {
"id": "re_3Op4p2Lkd6Y2L0M1",
"status": "succeeded",
"amountCents": 12900
},
"terminated": false,
"adjustmentInvoiceId": "inv_7N2fQy1YVPa4XoRDb3t6s"
}{
"error": "Nothing to refund or invalid refund amount"
}{
"error": "Subscription not found or access denied"
}{
"error": "Failed to issue refund"
}