Canceling a Payment

If you want to cancel a payment that has a status of payment is ACT (Active), you can do so by using the Cancel Payment request.

Note: This is relevant to payment methods listed with is_cancelable = true You can check this capability to cancel in the response to List Payment Methods by Country.

You can cancel after a payment is made through the API, or the checkout page.

Once you make the Cancel Payment request this will trigger the Payment Canceled webhook. This webhook contains the same information as the response.
Note: If the status is already marked as CLO, use the Create Refund method.

Cancel Payment

Created a payment request, with a payment id of payment_ebb1ff323434fa8af1dd14125a5d8bb1

Request

DELETE https://sandboxapi.rapyd.net/v1/payments/payment


Payment: payment_ebb1ff323434fa8af1dd14125a5d8bb1 

Response

{
    "status": {
        "error_code": "",
        "status": "SUCCESS",
        "message": "",
        "response_code": "",
        "operation_id": "c0812778-a182-4422-95f5-b0275d32bdd3"
    },
    "data": {
        "id": "payment_ebb1ff323434fa8af1dd14125a5d8bb1",
        "amount": 0,
        "original_amount": 1000,
        "is_partial": false,
        "currency_code": "EUR",
        "country_code": "gb",
        "status": "CAN",
        "description": "Payment by bank transfer1",
        "merchant_reference_id": "",
        "customer_token": "cus_183225bd57e4bc4967bf8b4ddc9c6144",
        "payment_method": "other_1250610cd81c35ed0f087c2759bd282b",
        "payment_method_data": {},
        "auth_code": null,
        "expiration": 1687214991,
        "captured": true,
        "refunded": false,
        "refunded_amount": 0,
        "receipt_email": "",
        "redirect_url": "https://sandboxcheckout.rapyd.net/complete-bank-payment?token=payment_ebb1ff323434fa8af1dd14125a5d8bb1&complete_payment_url=&error_payment_url=",
        "complete_payment_url": "",
        "error_payment_url": "",
        "receipt_number": "",
        "flow_type": "",
        "address": null,
        "statement_descriptor": "********LLL",
        "transaction_id": "",
        "created_at": 1682030991,
        "metadata": {},
        "failure_code": "",
        "failure_message": "",
        "paid": false,
        "paid_at": 0,
        "dispute": null,
        "refunds": null,
        "order": null,
        "outcome": null,
        "visual_codes": {},
        "textual_codes": {},
        "instructions": {
            "name": "instructions",
            "steps": [
                {
                    "step1": "The URL can be used for redirecting the user or to forward it to the consumer for signing. This link expires in 60 days or after its first use, whichever comes first."
                }
            ]
        },
        "ewallet_id": "ewallet_db4ad4a76278f94c4a83dd9b28b483ed",
        "ewallets": [
            {
                "ewallet_id": "ewallet_db4ad4a76278f94c4a83dd9b28b483ed",
                "amount": 1000,
                "percent": 100,
                "refunded_amount": 0
            }
        ],
        "payment_method_options": {},
        "payment_method_type": "gb_sepadirectdebit_bank",
        "payment_method_type_category": "bank_redirect",
        "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": true
    }
}
2 Likes