Delete Discount from Subscription
Delete the discount that was assigned to a subscription.
This method does not affect the coupon that the discount was derived from.
subscription
ID of the subscription. String starting with sub_.
Code Samples
.NET
using System; using System.Text.Json; namespace RapydApiRequestSample { class Program { static void Main(string[] args) { try { string subscription = "sub_4802e0187b3c0acdd3ed8d0c00f85610"; string result = RapydApiRequestSample.Utilities.MakeRequest("DELETE", $"/v1/payments/subscriptions/{subscription}/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/payments/subscriptions/sub_4802e0187b3c0acdd3ed8d0c00f85610/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/payments/subscriptions/sub_4802e0187b3c0acdd3ed8d0c00f85610/discount'); var_dump($object); } catch(Exception $e) { echo "Error: $e"; } ?>
Python
from pprint import pprint from utilities import make_request result = make_request(method='delete', path='/v1/payments/subscriptions/sub_4802e0187b3c0acdd3ed8d0c00f85610/discount') pprint(result)
/v1/payments/subscriptions/:subscription/discount
Delete Discount from Subscription
curl -X delete https://sandboxapi.rapyd.net/v1/payments/subscriptions/sub_4802e0187b3c0acdd3ed8d0c00f85610/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": "64fc61d1-7b02-45b4-9130-ef4683d1b912" }, "data": { "id": "dis_4802e0187b3c0acdd3ed8d0c00f85610", "deleted": true } }