---
title: "Delete Discount from Customer"
source_url: https://docs.rapyd.net/en/delete-discount-from-customer.html
lang: en
---

# Delete Discount from Customer

Delete the discount that has been assigned to a customer through a coupon.

This action does not affect the coupon that the discount was derived from.

This method triggers the **Customer Discount Deleted** webhook.

> **Note:**
>
> - The code samples include successful requests (200) and bad requests (400).
>
>   - For error messages that appear due to bad requests (400), see:
>
>     - [General Errors](https://docs.rapyd.net/en/general-errors.md "General Errors")
>     - [Customer Errors](https://docs.rapyd.net/en/customer-errors.md "Customer Errors")
>   - For information about unauthorized request (401) and other authentication errors, see [Troubleshooting Authentication and Authorization Errors](https://docs.rapyd.net/en/troubleshooting-authentication-and-authorization-errors.md "Troubleshooting Authentication and Authorization Errors").

### Parameters

### Request Path Parameters

- - - customer
    - ID of the customer profile. String starting with **cus_**.

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

### Response Parameters

- - id
  - The unique identifier (ID) of the discount object that was deleted. Starts with `dis_`.
- - deleted
  - A flag indicating the status of the request. Returns `true` if the discount was successfully removed from the customer profile.

### Code Samples

- - .NET

    - ```csharp
      using System;

      namespace RapydApiRequestSample
      {
          class Program
          {
              static void Main(string[] args)
              {
                  try
                  {
                      string customerId = "cus_217f61d6757465a9716666ccf4d3ec73";

                      string result = RapydApiRequestSample.Utilities.MakeRequest("DELETE", $"/v1/customers/{customerId}/discount");

                      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/customers/cus_217f61d6757465a9716666ccf4d3ec73/discount'
          );

          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/customers/cus_217f61d6757465a9716666ccf4d3ec73/discount");
          var_dump($object);
      } catch (Exception $e) {
          echo "Error: $e";
      }
      ?>
      ```
- - Python

    - ```python
      from pprint import pprint

      from utilities import make_request

      # Delete Discount from Customer
      result = make_request(method='delete', path='/v1/customers/cus_217f61d6757465a9716666ccf4d3ec73/discount')
      pprint(result)
      ```

- /v1/customers/:customer/discount

- Delete Discount from Customer
- ```curl
  curl -X delete 'https://sandboxapi.rapyd.net/v1/customers/cus_9f4965b9807bc1aeae67b47a0ae5b081/discount' \
  -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'
  ```
- ```json
  {
      "status": {
          "error_code": "",
          "status": "SUCCESS",
          "message": "",
          "response_code": "",
          "operation_id": "24d73cc4-c34d-43dc-8b91-8230375af712"
      },
      "data": {
          "id": "dis_d41d8cd98f00b204e9800998ecf8427e",
          "deleted": true
      }
  }
  ```

- Bad Request - Discount Not Found
- ```curl
  curl -X delete 'https://sandboxapi.rapyd.net/v1/customers/cus_e942934d553ca9c1215f4f5201f1fddd/discount' \
  -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'
  ```
- ```json
  {
      "status": {
          "error_code": "ERROR_DELETE_CUSTOMER_DISCOUNT",
          "status": "ERROR",
          "message": "The request tried to delete a discount from a customer, but the operation failed. Corrective action: Determine whether the discount was already deleted, and why there were multiple requests to delete it.",
          "response_code": "ERROR_DELETE_CUSTOMER_DISCOUNT",
          "operation_id": "e526ea22-03f9-4642-b21a-533189bb91f7"
      }
  }
  ```

- Bad Request - Customer Not Found
- ```curl
  curl -X delete 'https://sandboxapi.rapyd.net/v1/customers/cus_217f61d6757465a9716666ccf4d3ec73/discount' \
  -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'
  ```
- ```json
  {
      "status": {
          "error_code": "ERROR_GET_CUSTOMER",
          "status": "ERROR",
          "message": "The request attempted an operation that requires the ID of a customer, but the customer was not found. The request was rejected. Corrective action: Use the correct ID of the customer, a string starting with 'cus_'.",
          "response_code": "ERROR_GET_CUSTOMER",
          "operation_id": "1e04fad4-0969-46bf-a71e-1089736b27e8"
      }
  }
  ```

- Unauthorized
- ```curl
  curl -X delete 'https://sandboxapi.rapyd.net/v1/customers/cus_217f61d6757465a9716666ccf4d3ec73/discount' \
  -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'
  ```
- ```json
  {
      "status": {
          "error_code": "UNAUTHENTICATED_API_CALL",
          "status": "ERROR",
          "message": "The request was rejected due to an authentication issue. Corrective action: Check the status of your account in the 'Account Details' page of the Client Portal.",
          "response_code": "UNAUTHENTICATED_API_CALL",
          "operation_id": "7d6de716-13c1-4859-a437-61ca8abf2e37"
      }
  }
  ```
