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.
Code Samples
.NET
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
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 $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
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 -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'
{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "81659ca3-4cc1-4b4a-99c3-8886f02ab872" }, "data": { "id": "dis_d41d8cd98f00b204e9800998ecf8427e", "deleted": true } }