---
title: "Cancel Group Payment"
source_url: https://docs.rapyd.net/en/cancel-group-payment.html
lang: en
---

# 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](https://docs.rapyd.net/en/list-payment-methods-by-country.md "List Payment Methods by Country").

### Parameters

### Request Path Parameters

- - group_payment
  - ID of the group payment. String starting with **gp_**.

### Request Header Parameters

- - access_key
  - Unique access key provided by Rapyd for each authorized user.

    See [Developers](https://docs.rapyd.net/en/developers.md "Developers").
- - Content-Type
  - Indicates that the data appears in JSON format. Set to **application/json**.
- - salt
  - Random string. Recommended length: 8-16 characters.
- - signature
  - Signature calculated for each request individually.

    See [Request Signatures](https://docs.rapyd.net/en/request-signatures.md "Request Signatures").
- - timestamp
  - Timestamp for the request, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time") (seconds).

### Request Body Parameters

- - reason
  - Reason for cancellation of the group payment.

### Response Parameters

- - amount
  - Amount of the group payment, in units defined by `currency`.
- - amount_to_replace
  - Indicates the total amount of failed payments that have not been replaced.
- - cancel_reason
  - Reason for cancellation of the group payment.
- - country
  - Country where the payment methods are supported. Two-letter ISO 3166-1 ALPHA-2 code.
- - currency
  - Currency of the payments. Three-letter ISO 4217 code.
- - description
  - Description of the group payment.
- - expiration
  - End of the time allowed for customers to make this payment, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time").
- - id
  - ID of the 'group_payment' object. String starting with **gp_**.
- - merchant_reference_id
  - Identifier defined by the client for reference purposes. Limit: 45 characters.
- - metadata
  - A JSON object defined by the client. See [Metadata](https://docs.rapyd.net/en/metadata.md "Metadata").
- - payments
  - Array of 'payment' objects. All payments must have the same currency and must be supported in the same country. For details of the fields in the 'payment' object, see [Create Payment](https://docs.rapyd.net/en/create-payment.md "Create Payment").
- - reason
  - Reason for cancellation of the group payment.
- - status
  - Indicates the status of the group payment operation. One of the following values:

    - **active** - The group payment was created and one or more payments are still open.
    - **canceled** - The group payment was canceled.
    - **closed** - All payments in the group payment are complete.Response only.

### 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

    - ```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
      <?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

    - ```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
  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' \
  --data-raw '{
      "reason": "Cancel because all payments failed"
  }'
  ```
- ```json
  {
      "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": {}
              }
          ]
      }
  }
  ```
