Cancel a refund 

Core Resources
Refunds
Cancel a refund

Cancels a refund with a status of requires_action.

You can’t cancel refunds in other states. Only refunds for payment methods that require customer action can enter the requires_action state.

Parameters

No parameters.

Returns

Returns the refund object if the cancellation succeeds. This call raises an error if you can’t cancel the refund.

POST /v1/refunds/:id/cancel
Stripe.api_key = 'sk_test_BQokikJ...2HlWgH4olfQ2sk_test_BQokikJOvBiI2HlWgH4olfQ2'
refund = Stripe::Refund.cancel('re_1Nispe2eZvKYlo2Cd31jOCgZ')
Response
{
"id": "re_1Nispe2eZvKYlo2Cd31jOCgZ",
"object": "refund",
"amount": 1000,
"balance_transaction": "txn_1Nispe2eZvKYlo2CYezqFhEx",
"charge": "ch_1NirD82eZvKYlo2CIvbtLWuY",
"created": 1692942318,
"currency": "usd",
"failure_balance_transaction": "txn_3MmlLrLkdIwHu7ix0uke3Ezy",
"failure_reason": "merchant_request",
"metadata": {},
"payment_intent": "pi_1GszsK2eZvKYlo2CfhZyoZLp",
"reason": null,
"receipt_number": null,
"source_transfer_reversal": null,
"status": "canceled",
"transfer_reversal": null
}