Validate Coupon

This function is used to validate that a coupon can be applied to a specific plan. This lets you ensure the coupon is allowed to be used on a customer's subscription.

Request Parameters

planIdIntegerThis is the Fusebill generated ID value which uniquely identifies the Plan record in the Fusebill system. This is the ID of the Plan you want to apply the Coupon to.Yes
couponCodeStringThis is the Coupon Code which uniquely identifies the Coupon you want to apply to the Subscription.Yes
curl -X POST "" \
	-H "Content-Type: application/json" \
	-H "Authorization: Basic {APIKey}" \
	-d "{planId:{planId},couponCode:'{couponCode}'}"
//Json Payload
string jsonData = "{planId:{planId},couponCode:'{couponCode}'}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://");
//Add Content type
request.ContentType = "application/json";
//Add Api key authorization
request.Headers.Add(HttpRequestHeader.Authorization, "Basic "+apiKey);
//Set request method
request.Method = "POST";
//Add the json data to request
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
//Perform the request
var httpResponse = (HttpWebResponse)request.GetResponse();
//Record the response from our request
var result = "";
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
  result = streamReader.ReadToEnd();
#Import library JSON
import json
#Import library Requests
import requests
#Pass in a dictionary to the Headers parameter
headers = {'Authorization' : 'Basic {APIKey}', 'Content-Type' : 'application/json'}
#Pass in a dictionary to the Payload parameter
payload = {"planId":{id},"couponCode":'ApplyThis'}
#Pass in your URI, Payload and Headers
r ='', data=json.dumps(payload), headers=headers)
  "couponCode": "YD09",
  "planId": 212345
   "reason":"Coupon is valid"
    "valid": false,
    "reason": "Coupon not applicable to plan"