Skip to main content

Documentation

Reverse a Card Payment

This API endpoint reverses a card payment when a communications failure prevents a terminal from receiving Rapyd's REST response. This action is also known as a "technical reversal", which prevents a duplicate charge to the customer's card.

After the original transation has been reversed, the terminal can repeat the card transaction. This process must be initiated within 15 minutes of the original payment transaction.

The action is as follows:

  • If the original card payment was completed, Rapyd creates a refund.

  • If the original card payment was completed and there is a pending refund, Rapyd cancels the refund. Rapyd sends Refund Rejected Webhook.

  • If the original payment failed or remains pending, Rapyd cancels the payment. Rapyd sends Payment Canceled Webhook.

  • If the original payment was completed and a refund was successful, this process returns SUCCESS without any other action.

Note

Sandbox only.

    • device_id

    • ID of the payment device.

    • ewallet_id

    • ID of the merchant's Rapyd Wallet.

    • merchant_reference_id

    • Identifier defined by the merchant. Must be the same as the merchant_reference_id parameter in the original card transaction.

    • payment

    • Full information about the payment. Relevant when the original payment failed or remains pending. Empty array when not relevant.

    • refund

    • Full information about the refund. Relevant when the original card payment was completed and a refund was created or canceled. Empty array when not relevant.

  • /v1/payment-device/technical_reversal

  • Reversal When Original Payment Succeeded and not Refunded

  • curl -X post 'https://sandboxapi.rapyd.net/v1/payment-device/technical_reversal' \
    -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 '{
        merchant_reference_id: '51001******9',
        device_id: '0880196',
        ewallet_id: 'ewallet_8818c1e4c2185f4137822ea58f952e2a'
    }'
  • {
        "status": {
            "error_code": "",
            "status": "SUCCESS",
            "message": "",
            "response_code": "",
            "operation_id": "bc5321ff-204b-4fb6-87cb-bf964fadd00a"
        },
        "data": {
            "payment": [],
            "refund": [
                {
                    "id": "refund_6aa701483abbb9c16bfa8e7513f1e484",
                    "amount": 1.02,
                    "payment": "payment_f125433e92e49f9d5c097e8d111018b4",
                    "currency": "ILS",
                    "failure_reason": "",
                    "failure_code": "",
                    "metadata": {},
                    "reason": "technical_reversal",
                    "status": "Pending",
                    "receipt_number": 0,
                    "created_at": 1776346809,
                    "updated_at": 1776346809,
                    "merchant_ewallet": null,
                    "merchant_reference_id": "51001009",
                    "payment_created_at": 1776346517,
                    "payment_method_type": "il_visa_shva_pos",
                    "ewallets": [
                        {
                            "ewallet": "ewallet_8818c1e4c2185f4137822ea58f952e2a",
                            "amount": 1.02
                        }
                    ],
                    "proportional_refund": true,
                    "merchant_debited_amount": null,
                    "merchant_debited_currency": null,
                    "fx_rate": null,
                    "fixed_side": null
                }
            ]
        }
    }
  • Reversal When Original Payment Remains Pending

  • curl -X post 'https://sandboxapi.rapyd.net/v1/payment-device/technical_reversal' \
    -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 '{
        merchant_reference_id: '51001******0',
        device_id: '0880196',
        ewallet_id: 'ewallet_8818c1e4c2185f4137822ea58f952e2a'
    }'
  • {
        "status": {
            "error_code": "",
            "status": "SUCCESS",
            "message": "",
            "response_code": "",
            "operation_id": "536d6f54-4901-4ba1-a058-a194469fc6ed"
        },
        "data": {
            "payment": [
                {
                    "id": "payment_c9196845903d1f2f529dfb2682234aba",
                    "amount": 0,
                    "original_amount": 1.03,
                    "is_partial": false,
                    "currency_code": "ILS",
                    "country_code": "IL",
                    "status": "CAN",
                    "description": "",
                    "merchant_reference_id": "51001******0",
                    "customer_token": "cus_e4ab0229f97252532993a9d10414cfb1",
                    "payment_method": "card_513cf5b509f80f711ab22c90646e0450",
                    "payment_method_data": {
                        "cvv_check": "unchecked",
                        "acs_check": "unchecked"
                    },
                    "auth_code": " 03153",
                    "expiration": 1776900,
                    "captured": false,
                    "refunded": false,
                    "refunded_amount": 0,
                    "receipt_email": "",
                    "redirect_url": "",
                    "complete_payment_url": "",
                    "error_payment_url": "",
                    "receipt_number": "",
                    "flow_type": "",
                    "address": null,
                    "statement_descriptor": "Shva Integration Merch",
                    "transaction_id": "",
                    "created_at": 1776395,
                    "metadata": {},
                    "failure_code": "",
                    "failure_message": "",
                    "paid": false,
                    "paid_at": 0,
                    "dispute": null,
                    "refunds": null,
                    "order": null,
                    "outcome": null,
                    "visual_codes": {},
                    "textual_codes": {},
                    "instructions": [],
                    "ewallet_id": "ewallet_8818c1e4c2185f4137822ea58f952e2a",
                    "ewallets": [
                        {
                            "ewallet_id": "ewallet_8818c1e4c2185f4137822ea58f952e2a",
                            "amount": 1.03,
                            "percent": 100,
                            "refunded_amount": 0
                        }
                    ],
                    "payment_method_options": {},
                    "payment_method_type": "il_visa_shva_pos",
                    "payment_method_type_category": "pos",
                    "fx_rate": 1,
                    "merchant_requested_currency": null,
                    "merchant_requested_amount": null,
                    "fixed_side": "",
                    "payment_fees": null,
                    "invoice": "",
                    "escrow": null,
                    "group_payment": "",
                    "cancel_reason": "technical_reversal",
                    "initiation_type": "card_present",
                    "mid": "mid_aed21e6c30927c6a3d702ea5a3a19a9d",
                    "next_action": "not_applicable",
                    "error_code": "",
                    "remitter_information": {},
                    "save_payment_method": false,
                    "merchant_advice_code": null,
                    "merchant_advice_message": null,
                    "enhanced_data": null,
                    "payment_request_id": "payment_req_46979bd94555ade68079b2c236ec3f67",
                    "transaction_link_id": null
                }
            ],
            "refund": []
        }
    }
  • Reversal When Original Payment Refunded and Refund is Pending

  • curl -X post 'https://sandboxapi.rapyd.net/v1/payment-device/technical_reversal' \
    -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 '{
        merchant_reference_id: '52001******2',
        device_id: '0880196',
        ewallet_id: 'ewallet_8818c1e4c2185f4137822ea58f952e2a'
    }'
  • {
        "status": {
            "error_code": "",
            "status": "SUCCESS",
            "message": "",
            "response_code": "",
            "operation_id": "b692c457-ada0-4708-9cdb-917a5d6c1608"
        },
        "data": {
            "payment": [],
            "refund": [
                {
                    "id": "refund_d8745853911f8a3412932a676b4007c8",
                    "amount": 1.45,
                    "payment": "payment_45c1e105b7c0559b2944223f50de2b74",
                    "currency": "ILS",
                    "failure_reason": "",
                    "failure_code": "",
                    "metadata": {},
                    "reason": "Direct Refund",
                    "status": "Cancelled",
                    "receipt_number": 0,
                    "created_at": 1776936,
                    "updated_at": 1776949,
                    "merchant_ewallet": null,
                    "merchant_reference_id": "52001******2",
                    "payment_created_at": 1776935,
                    "payment_method_type": "il_visa_shva_pos",
                    "ewallets": [
                        {
                            "ewallet": "ewallet_8818c1e4c2185f4137822ea58f952e2a",
                            "amount": 1.45
                        }
                    ],
                    "proportional_refund": true,
                    "merchant_debited_amount": null,
                    "merchant_debited_currency": null,
                    "fx_rate": null,
                    "fixed_side": null
                }
            ]
        }
    }