Canceling a Refund
Cancel a refund after it is complete. Sandbox only.
This operation is relevant to cards and is supported only by certain payment methods. See List Payment Methods by Country.
How
The procedure is made up of the following steps:
Create a Payment
Create a Refund
Cancel a Refund
Create a Payment
Create a payment as described in Create Payment, with the following settings:
payment_method- Specify an object that contains all the required fields for a card payment method, including thecvvfield.
Request
curl -X post 'https://sandboxapi.rapyd.net/v1/payments' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'idempotency: your-idempotency-parameter-here' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here' \ --data-raw '{ "amount": 103.00, "currency": "EUR", "payment_method": "card_b9548d9b53a565b2315fecdc6c87f158", "initiation_type": "customer_present" }'
Response
{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "319f0489-3fcc-4b52-9575-e6376049ed13" }, "data": { "id": "payment_4ba9943e70ad0cec64f98dff91a56277", "amount": 103, "original_amount": 103, "is_partial": false, "currency_code": "EUR", "country_code": "IL", "status": "CLO", "description": "", "merchant_reference_id": "", "customer_token": "cus_bafe65c5fce30f8a4fba5c536b6382fc", "payment_method": null, "payment_method_data": { "id": null, "type": "il_visa_shva_card", "category": "card", "metadata": null, "image": "", "webhook_url": "", "supporting_documentation": "", "next_action": "not_applicable", "is_default": false, "name": "John Doe", "last4": "1111", "acs_check": "unchecked", "cvv_check": "unchecked", "bin_details": { "type": "DEBIT", "brand": "VISA", "level": "CLASSIC", "issuer": "CONOTOXIA SP. Z O.O", "country": "PL", "bin_number": "411111" }, "expiration_year": "29", "expiration_month": "12", "fingerprint_token": "ocfp_e599f990674473ce6283b245e9ad2467", "network_reference_id": "123456", "payment_account_reference": "V0017HQKZH75T4G9GJLWZMS6YPJCU" }, "auth_code": null, "expiration": 1776002552, "captured": true, "refunded": false, "refunded_amount": 0, "receipt_email": "", "redirect_url": "", "complete_payment_url": "", "error_payment_url": "", "receipt_number": "", "flow_type": "", "address": null, "statement_descriptor": "Doc Team", "transaction_id": "", "created_at": 1775397752, "metadata": {}, "failure_code": "", "failure_message": "", "paid": true, "paid_at": 1775397752, "dispute": null, "refunds": null, "order": null, "outcome": null, "visual_codes": {}, "textual_codes": {}, "instructions": [ { "name": "instructions", "steps": [ { "step1": "" } ] } ], "ewallet_id": "ewallet_c1943cfeda5f98247ab117e5d2648861", "ewallets": [ { "ewallet_id": "ewallet_c1943cfeda5f98247ab117e5d2648861", "amount": 103, "percent": 100, "refunded_amount": 0 } ], "payment_method_options": {}, "payment_method_type": "il_visa_shva_card", "payment_method_type_category": "card", "fx_rate": 1, "merchant_requested_currency": null, "merchant_requested_amount": null, "fixed_side": "", "payment_fees": null, "invoice": "", "escrow": null, "group_payment": "", "cancel_reason": null, "initiation_type": "customer_present", "mid": "", "next_action": "not_applicable", "error_code": "", "remitter_information": {}, "save_payment_method": false, "merchant_advice_code": null, "merchant_advice_message": null, "enhanced_data": null, "transaction_link_id": null } }
The response shows:
In the
idfield: The payment ID.
Create a Refund
Create a refund as described in Create Refund, with the following settings:
payment- The ID of the payment.
Request
curl -X post 'https://sandboxapi.rapyd.net/v1/refunds' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'idempotency: your-idempotency-parameter-here' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here' \ --data-raw '{ "payment": "payment_4ba9943e70ad0cec64f98dff91a56277", "merchant_reference_id": "2026-04-05c", "reason": "Merchandise returned" }'
Response
{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "5396cf0e-4a5a-4c14-ab2f-af472466fffa" }, "data": { "id": "refund_cb135fddd580f6c85a20be3b117e741f", "amount": 103, "payment": "payment_4ba9943e70ad0cec64f98dff91a56277", "currency": "EUR", "failure_reason": "", "failure_code": "", "metadata": {}, "reason": "Merchandise returned", "status": "Completed", "receipt_number": 0, "created_at": 1775397775, "updated_at": 1775397775, "merchant_ewallet": null, "merchant_reference_id": "2026-04-05c", "payment_created_at": 1775397752, "payment_method_type": "il_visa_shva_card", "ewallets": [ { "ewallet": "ewallet_c1943cfeda5f98247ab117e5d2648861", "amount": 103 } ], "proportional_refund": true, "merchant_debited_amount": null, "merchant_debited_currency": null, "fx_rate": null, "fixed_side": null } }
The response shows:
In the
idfield: The refund ID.status: Completed.
Cancel a Refund
Cancel a refund as described in Cancel Refund:
Request
curl -X delete 'https://sandboxapi.rapyd.net/v1/refunds/refund_cb135fddd580f6c85a20be3b117e741f' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'idempotency: your-idempotency-parameter-here' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here'
Response
{ "id": "refund_cb135fddd580f6c85a20be3b117e741f", "amount": 103, "payment": "payment_4ba9943e70ad0cec64f98dff91a56277", "currency": "EUR", "failure_reason": "", "failure_code": "", "metadata": {}, "reason": "Direct Refund", "status": "Cancelled", "receipt_number": 0, "created_at": 1775397875, "updated_at": 1775397975, "merchant_ewallet": null, "merchant_reference_id": "", "payment_created_at": 1775397752, "payment_method_type": "il_visa_shva_card", "ewallets": [ { "ewallet": "ewallet_c1943cfeda5f98247ab117e5d2648861", "amount": 103 } ], "proportional_refund": true, "merchant_debited_amount": null, "merchant_debited_currency": null, "fx_rate": null, "fixed_side": null }