Skip to main content

Documentation

Cancel Group Payment

Cancel a group payment.

All payments in the group payment must be cancelable, and they must all have status = ERR or ACT. To determine whether a payment method is cancelable, see the response to List Payment Methods by Country.

    • group_payment

    • ID of the group payment. String starting with gp_.

    • reason

    • Reason for cancellation of the group payment.

Code Samples
    • .NET core

      • using System;
        using System.Text.Json;
        
        namespace RapydApiRequestSample
        {
            class Program
            {
                static void Main(string[] args)
                {
                    try
                    {
                        string payment = "gp_7e2b7abee522ba5089eb98c7482991ea";
        
                        string result = RapydApiRequestSample.Utilities.MakeRequest("DELETE", $"/v1/payments/group_payments/{payment}");
        
                        Console.WriteLine(result);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Error completing request: " + e.Message);
                    }
                }
            }
        }
    • JavaScript

      • const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest;
        
        async function main() {
          try {
            const result = await makeRequest(
              'DELETE',
              '/v1/payments/group_payments/gp_b2eb53a2624345dc3701d59ccac2facd?reason=failed'
            );
        
            console.log(result);
          } catch (error) {
            console.error('Error completing request', error);
          }
        }
    • PHP

      • <?php
        $path = $_SERVER['DOCUMENT_ROOT'];
        $path .= "/<path-to-your-utility-file>/utilities.php";
        include($path);
        try {
            $object = make_request('delete', '/v1/payments/group_payments/gp_64abd30667647f83395945ddc24c70b3');
            var_dump($object);
        } catch(Exception $e) {
            echo "Error: $e";
        }
        ?>
    • Python

      • from pprint import pprint
        
        from utilities import make_request
        
        group_payment = "gp_22c833729a6a442b13ae2a3b4f745907"
        response = make_request(method='delete',
                                path=f'/v1/payments/group_payments/{group_payment}')
        
        pprint(response)
  • /v1/payments/group_payments/:group_payment

  • Cancel Group Payment

  • curl -X delete
    https://sandboxapi.rapyd.net/v1/payments/group_payments/gp_89ff631f266f9219324017cbd12ce531
    -H 'access_key: your-access-key-here'
    -H 'Content-Type: application/json'
    -H 'salt: your-random-string-here'
    -H 'signature: your-calculated-signature-here'
    -H 'timestamp: your-unix-timestamp-here'
    -d '{
        "reason": "Cancel because all payments failed"
    }
    '
    
  • {
        "status": {
            "error_code": "",
            "status": "SUCCESS",
            "message": "",
            "response_code": "",
            "operation_id": "32877762-b275-4ee8-99e7-b60d917f22d0"
        },
        "data": {
            "id": "gp_89ff631f266f9219324017cbd12ce531",
            "amount": 2100,
            "amount_to_replace": 0,
            "status": "canceled",
            "currency": "GBP",
            "country": "GB",
            "merchant_reference_id": "12345-69089",
            "description": "",
            "metadata": {
                "merchant_defined": true
            },
            "expiration": null,
            "cancel_reason": "Cancel for reason ref# 32-23-Ac",
            "payments": [
                {
                    "id": "payment_c942ae97b645cc745821186ac6a51431",
                    "amount": 0,
                    "original_amount": 1075,
                    "is_partial": false,
                    "currency_code": "GBP",
                    "country_code": "GB",
                    "status": "CAN",
                    "description": "",
                    "merchant_reference_id": "",
                    "customer_token": "cus_ed048155f1540eba33c471722f8bc878",
                    "payment_method": "card_76f2c4bce86ae6910be38b087858bc4a",
                    "payment_method_data": {
                        "id": "card_76f2c4bce86ae6910be38b087858bc4a",
                        "type": "gb_visa_card",
                        "category": "card",
                        "metadata": null,
                        "image": "",
                        "webhook_url": "",
                        "supporting_documentation": "",
                        "next_action": "3d_verification",
                        "name": "Tim Doe",
                        "last4": "0000",
                        "acs_check": "unchecked",
                        "cvv_check": "unchecked",
                        "bin_details": {
                            "type": null,
                            "brand": null,
                            "country": null,
                            "bin_number": "446203"
                        },
                        "expiration_year": "25",
                        "expiration_month": "11",
                        "fingerprint_token": "ocfp_1476e28831f830fb85356e3b61a1ed84"
                    },
                    "expiration": 1641894732,
                    "captured": true,
                    "refunded": false,
                    "refunded_amount": 0,
                    "receipt_email": "",
                    "redirect_url": "https://sandboxcheckout.rapyd.net/3ds-payment?token=payment_c942ae97b645cc745821186ac6a51431",
                    "complete_payment_url": "https://complete.example.net",
                    "error_payment_url": "https://error.example.net",
                    "receipt_number": "",
                    "flow_type": "",
                    "address": null,
                    "statement_descriptor": "Rapyd",
                    "transaction_id": "",
                    "created_at": 1641289933,
                    "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_c1943cfeda5f98247ab117e5d2648861",
                    "ewallets": [
                        {
                            "ewallet_id": "ewallet_c1943cfeda5f98247ab117e5d2648861",
                            "amount": 1075,
                            "percent": 100,
                            "refunded_amount": 0
                        }
                    ],
                    "payment_method_options": {},
                    "payment_method_type": "gb_visa_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": "gp_89ff631f266f9219324017cbd12ce531",
                    "cancel_reason": "Cancel for reason ref# 32-23-Ac",
                    "initiation_type": "customer_present",
                    "mid": "",
                    "next_action": "not_applicable",
                    "error_code": "",
                    "remitter_information": {}
                },
                {
                    "id": "payment_ae18c880a69dfc463280033b13fcc4bd",
                    "amount": 0,
                    "original_amount": 1025,
                    "is_partial": false,
                    "currency_code": "GBP",
                    "country_code": "GB",
                    "status": "CAN",
                    "description": "",
                    "merchant_reference_id": "",
                    "customer_token": "cus_0640dacf298e4c8e865efa8654a22604",
                    "payment_method": "card_9d89593ebd18522a8ff0bb0483af5720",
                    "payment_method_data": {
                        "id": "card_9d89593ebd18522a8ff0bb0483af5720",
                        "type": "gb_visa_card",
                        "category": "card",
                        "metadata": null,
                        "image": "",
                        "webhook_url": "",
                        "supporting_documentation": "",
                        "next_action": "3d_verification",
                        "name": "Jim Doe",
                        "last4": "1111",
                        "acs_check": "unchecked",
                        "cvv_check": "unchecked",
                        "bin_details": {
                            "type": null,
                            "brand": null,
                            "country": null,
                            "bin_number": "411111"
                        },
                        "expiration_year": "25",
                        "expiration_month": "11",
                        "fingerprint_token": "ocfp_e599f990674473ce6283b245e9ad2467"
                    },
                    "expiration": 1641894732,
                    "captured": true,
                    "refunded": false,
                    "refunded_amount": 0,
                    "receipt_email": "",
                    "redirect_url": "https://sandboxcheckout.rapyd.net/3ds-payment?token=payment_ae18c880a69dfc463280033b13fcc4bd",
                    "complete_payment_url": "https://complete.example.net",
                    "error_payment_url": "https://error.example.net",
                    "receipt_number": "",
                    "flow_type": "",
                    "address": null,
                    "statement_descriptor": "Rapyd",
                    "transaction_id": "",
                    "created_at": 1641289933,
                    "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_c1943cfeda5f98247ab117e5d2648861",
                    "ewallets": [
                        {
                            "ewallet_id": "ewallet_c1943cfeda5f98247ab117e5d2648861",
                            "amount": 1025,
                            "percent": 100,
                            "refunded_amount": 0
                        }
                    ],
                    "payment_method_options": {},
                    "payment_method_type": "gb_visa_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": "gp_89ff631f266f9219324017cbd12ce531",
                    "cancel_reason": "Cancel for reason ref# 32-23-Ac",
                    "initiation_type": "customer_present",
                    "mid": "",
                    "next_action": "not_applicable",
                    "error_code": "",
                    "remitter_information": {}
                }
            ]
        }
    }