Loading...
NAV Navbar
Shell HTTP JavaScript Node.JS Python Ruby Java

AppBilling API Reference

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

AppDirect Billing Service gives you access to all the powerful functionality that drives the sales of more than 800 products serving 150,000 customers worldwide, in 120 countries. This same platform powers the marketplaces of Fortune 500 companies including Comcast, IBM, AT&T, and Deutsche Telekom. With our simple and elegant APIs you can power your own sales with all the functionality that has been enabling the AppDirect Network for years.

Use the following URL format to send API calls:

https://{marketplaceURL}/api/{endpoint}

For example:

https://myMarketplace.com/api/billing/v1/subscriptions

Generated on 2018-11-07 11:12:11 EST

Discounts

List all discounts

Example request


curl -X get https://{marketplaceURL}/api/channel/v1/discounts \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/channel/v1/discounts HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/channel/v1/discounts',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/channel/v1/discounts',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/channel/v1/discounts',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/channel/v1/discounts',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/channel/v1/discounts");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

Headers:
  X-Total-Count: 1
[
  {
    "applicationId": null,
    "applicationName": null,
    "autoApply": true,
    "basePartnerSharePercentage": null,
    "billingCycles": null,
    "code": null,
    "createdOn": 1480969138028,
    "description": "SOMEDESCRIPTION",
    "editionId": null,
    "expirationDate": null,
    "id": 4,
    "industryId": null,
    "maxRedemptions": null,
    "maxUnits": 0,
    "minUnits": 0,
    "partnerSharePercentage": null,
    "paymentPlanId": null,
    "percentage": 70,
    "price": null,
    "redemptionRestriction": "NONE",
    "redemptions": 0,
    "resellerCompanyId": null,
    "retainable": false,
    "startDate": null,
    "type": "PERCENTAGE",
    "unit": "USER",
    "vendorSharePercentage": null
  }
]

GET /channel/v1/discounts

List all available discounts. The parameters may optionally be used to filter the discounts read.

Parameters

Parameter Type Data Type Default Description
code query string Discount code
count query integer 250 Number of results to fetch. Used for paging.
sortField query string of enum:
APPLICATION
CHANNEL
CODE
CREATED_ON
END_DATE
REDEMPTIONS
RESELLER_COMPANY
START_DATE
CREATED_ON Sort field. Default value is created on date.
sortOrder query string of enum:
ASC
DESC
ASC Sort order. Default value is ascending.
start query integer First result index. Used for paging.

Responses

Status Meaning Description Definition
200 OK OK Discount
404 Not Found Not Found

Retrieve a discount

Example request


curl -X get https://{marketplaceURL}/api/channel/v1/discounts/{discountId} \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/channel/v1/discounts/{discountId} HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/channel/v1/discounts/{discountId}',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/channel/v1/discounts/{discountId}',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/channel/v1/discounts/{discountId}',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/channel/v1/discounts/{discountId}',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/channel/v1/discounts/{discountId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

{
  "applicationId": null,
  "applicationName": null,
  "autoApply": true,
  "basePartnerSharePercentage": null,
  "billingCycles": null,
  "code": null,
  "createdOn": 1480969138028,
  "description": "SOMEDESCRIPTION",
  "editionId": null,
  "expirationDate": null,
  "id": 4,
  "industryId": null,
  "maxRedemptions": null,
  "maxUnits": 0,
  "minUnits": 0,
  "partnerSharePercentage": null,
  "paymentPlanId": null,
  "percentage": 70,
  "price": null,
  "redemptionRestriction": "NONE",
  "redemptions": 0,
  "resellerCompanyId": null,
  "retainable": false,
  "startDate": null,
  "type": "PERCENTAGE",
  "unit": "USER",
  "vendorSharePercentage": null
}

GET /channel/v1/discounts/{discountId}

Retrieve the discount for the given discount ID.

Parameters

Parameter Type Data Type Default Description
*discountId path integer Discount ID

Responses

Status Meaning Description Definition
200 OK OK Discount
404 Not Found Not Found

Create a discount

Example request


curl -X post \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data-binary @- https://{marketplaceURL}/api/channel/v1/discounts <<EOF
{
  "applicationId": null,
  "applicationName": null,
  "autoApply": true,
  "basePartnerSharePercentage": 25,
  "billingCycles": null,
  "code": null,
  "createdOn": null,
  "description": "SOMEDESCRIPTION",
  "editionId": null,
  "expirationDate": null,
  "id": null,
  "industryId": null,
  "maxRedemptions": null,
  "maxUnits": 0,
  "minUnits": 0,
  "partnerSharePercentage": 25,
  "paymentPlanId": null,
  "percentage": 70,
  "price": null,
  "redemptionRestriction": "NONE",
  "redemptions": 0,
  "resellerCompanyId": null,
  "retainable": false,
  "startDate": null,
  "type": "PERCENTAGE",
  "unit": "USER",
  "vendorSharePercentage": 50
}
EOF

POST https://{marketplaceURL}/api/channel/v1/discounts HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json

{
  "applicationId": null,
  "applicationName": null,
  "autoApply": true,
  "basePartnerSharePercentage": 25,
  "billingCycles": null,
  "code": null,
  "createdOn": null,
  "description": "SOMEDESCRIPTION",
  "editionId": null,
  "expirationDate": null,
  "id": null,
  "industryId": null,
  "maxRedemptions": null,
  "maxUnits": 0,
  "minUnits": 0,
  "partnerSharePercentage": 25,
  "paymentPlanId": null,
  "percentage": 70,
  "price": null,
  "redemptionRestriction": "NONE",
  "redemptions": 0,
  "resellerCompanyId": null,
  "retainable": false,
  "startDate": null,
  "type": "PERCENTAGE",
  "unit": "USER",
  "vendorSharePercentage": 50
}


var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/channel/v1/discounts',
  method: 'post',
  dataType: 'json',
  data: {
  "applicationId": null,
  "applicationName": null,
  "autoApply": true,
  "basePartnerSharePercentage": 25,
  "billingCycles": null,
  "code": null,
  "createdOn": null,
  "description": "SOMEDESCRIPTION",
  "editionId": null,
  "expirationDate": null,
  "id": null,
  "industryId": null,
  "maxRedemptions": null,
  "maxUnits": 0,
  "minUnits": 0,
  "partnerSharePercentage": 25,
  "paymentPlanId": null,
  "percentage": 70,
  "price": null,
  "redemptionRestriction": "NONE",
  "redemptions": 0,
  "resellerCompanyId": null,
  "retainable": false,
  "startDate": null,
  "type": "PERCENTAGE",
  "unit": "USER",
  "vendorSharePercentage": 50
},

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const inputBody = '{
  "applicationId": null,
  "applicationName": null,
  "autoApply": true,
  "basePartnerSharePercentage": 25,
  "billingCycles": null,
  "code": null,
  "createdOn": null,
  "description": "SOMEDESCRIPTION",
  "editionId": null,
  "expirationDate": null,
  "id": null,
  "industryId": null,
  "maxRedemptions": null,
  "maxUnits": 0,
  "minUnits": 0,
  "partnerSharePercentage": 25,
  "paymentPlanId": null,
  "percentage": 70,
  "price": null,
  "redemptionRestriction": "NONE",
  "redemptions": 0,
  "resellerCompanyId": null,
  "retainable": false,
  "startDate": null,
  "type": "PERCENTAGE",
  "unit": "USER",
  "vendorSharePercentage": 50
}';
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/channel/v1/discounts',
{
  method: 'POST',body: inputBody,headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.post 'https://{marketplaceURL}/api/channel/v1/discounts',
payload={
  "applicationId": null,
  "applicationName": null,
  "autoApply": true,
  "basePartnerSharePercentage": 25,
  "billingCycles": null,
  "code": null,
  "createdOn": null,
  "description": "SOMEDESCRIPTION",
  "editionId": null,
  "expirationDate": null,
  "id": null,
  "industryId": null,
  "maxRedemptions": null,
  "maxUnits": 0,
  "minUnits": 0,
  "partnerSharePercentage": 25,
  "paymentPlanId": null,
  "percentage": 70,
  "price": null,
  "redemptionRestriction": "NONE",
  "redemptions": 0,
  "resellerCompanyId": null,
  "retainable": false,
  "startDate": null,
  "type": "PERCENTAGE",
  "unit": "USER",
  "vendorSharePercentage": 50
}
params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.post('https://{marketplaceURL}/api/channel/v1/discounts',
json={
  "applicationId": null,
  "applicationName": null,
  "autoApply": true,
  "basePartnerSharePercentage": 25,
  "billingCycles": null,
  "code": null,
  "createdOn": null,
  "description": "SOMEDESCRIPTION",
  "editionId": null,
  "expirationDate": null,
  "id": null,
  "industryId": null,
  "maxRedemptions": null,
  "maxUnits": 0,
  "minUnits": 0,
  "partnerSharePercentage": 25,
  "paymentPlanId": null,
  "percentage": 70,
  "price": null,
  "redemptionRestriction": "NONE",
  "redemptions": 0,
  "resellerCompanyId": null,
  "retainable": false,
  "startDate": null,
  "type": "PERCENTAGE",
  "unit": "USER",
  "vendorSharePercentage": 50
}
params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/channel/v1/discounts");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
String inputBody = "{" +
  "\"applicationId\": null," +
  "\"applicationName\": null," +
  "\"autoApply\": true," +
  "\"basePartnerSharePercentage\": 25," +
  "\"billingCycles\": null," +
  "\"code\": null," +
  "\"createdOn\": null," +
  "\"description\": \"SOMEDESCRIPTION\"," +
  "\"editionId\": null," +
  "\"expirationDate\": null," +
  "\"id\": null," +
  "\"industryId\": null," +
  "\"maxRedemptions\": null," +
  "\"maxUnits\": 0," +
  "\"minUnits\": 0," +
  "\"partnerSharePercentage\": 25," +
  "\"paymentPlanId\": null," +
  "\"percentage\": 70," +
  "\"price\": null," +
  "\"redemptionRestriction\": \"NONE\"," +
  "\"redemptions\": 0," +
  "\"resellerCompanyId\": null," +
  "\"retainable\": false," +
  "\"startDate\": null," +
  "\"type\": \"PERCENTAGE\"," +
  "\"unit\": \"USER\"," +
  "\"vendorSharePercentage\": 50" +
"}";

OutputStream os = conn.getOutputStream();
os.write(inputBody.getBytes("UTF-8"));
os.close();

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

{
  "applicationId": null,
  "applicationName": null,
  "autoApply": true,
  "basePartnerSharePercentage": 25,
  "billingCycles": null,
  "code": null,
  "createdOn": 1480969136160,
  "description": "SOMEDESCRIPTION",
  "editionId": null,
  "expirationDate": null,
  "id": 1,
  "industryId": null,
  "maxRedemptions": null,
  "maxUnits": 0,
  "minUnits": 0,
  "partnerSharePercentage": 25,
  "paymentPlanId": null,
  "percentage": 70,
  "price": null,
  "redemptionRestriction": "NONE",
  "redemptions": 0,
  "resellerCompanyId": null,
  "retainable": false,
  "startDate": null,
  "type": "PERCENTAGE",
  "unit": "USER",
  "vendorSharePercentage": 50
}

POST /channel/v1/discounts

Create a discount given the provided data.

Body Parameters

Discount data object

Discount object:

Property Type Description
applicationId number Application ID.
applicationName string Name of the application to which the discount applies.
autoApply boolean True if the discount is automatically applied. Default value is true.
basePartnerSharePercentage number Base partner's percentage share of the discount.
billingCycles number Number of billing cycles for which the discount should be applied.
code string Discount code. Must be at least 4 characters, but no longer than 103 characters.
createdOn number Creation date of the discount.
description string Description of discount. Required field. Must be at least 4 characters, but no longer than 255 characters.
editionId number Edition ID.
expirationDate number Expiration date for the discount. This date must be in the future.
id number Discount ID.
industryId number Industry ID.
maxRedemptions number Maximum number of redemptions available.
maxUnits number Maximum number of units for which to apply the discount.
minUnits number Minimum number of units for which to apply the discount.
partnerSharePercentage number Partner's percentage share of the discount.
paymentPlanId number Payment plan ID.
percentage number Percentage discount if discount is of PERCENTAGE type.
price number Amount to discount if discount is of FIXED_PRICE type.
redemptionRestriction RedemptionRestriction Redemption restriction. May be NONE, ONCE_PER_USER, or ONCE_PER_COMPANY. Default value is NONE.
redemptions number Number of times the discount has been redeemed.
resellerCompanyId string Reseller company ID.
retainable boolean True if the discount is retainable. Default value is false.
startDate number Start date for the discount.
type DiscountType Discount type. Required field. May be PERCENTAGE or FIXED_PRICE.
unit PricingUnit Pricing unit. May be USER, GIGABYTE, MEGABYTE, HOUR, MINUTE, INVOICE, UNIT, PROJECT, PROPERTY, ITEM, WORD,
EMAIL, CONTACT, CALL, CREDIT, ROOM, HOST, AGENT, OPERATOR, PROVIDER, MANAGER, TESTER, JVM, SERVER, WEB_USE_MINUTE,
AUDIO_USE_MINUTE, PIECE, EMPLOYEE_PAY_PERIOD, EMPLOYEE_PER_PAY_PERIOD, COMPUTER, NOT_APPLICABLE, ONE_TIME_SETUP,
DATA_POINTS, TIER1_API_CALLS, TIER2_API_CALLS, ADVISORY_HOURS, OVERAGE_AUDIO_MINUTE, EMPLOYEE, CONNECTION,
PUSH_USER, THOUSAND_EMAILS_PER_DAY, PUSH_NOTIFICATION_DEVICES, API_CALLS, SMS_TEXT_MESSAGE, CONTACTS_1000, CONTRACT_FEE,
TRANSFER_FEE, REACTIVATION_FEE, RECIPIENT, ADDITIONAL_1000_CONTACTS_BLOCK, SCHEDULE_PLAN, EMAILS_1000, EMAILS_2500,
MOBILE_DEVICE, PAYSLIP, PAYSLIP_CORRECTION, STORE, WEBSITE, EPAPER, PAGE, POSTAGE_AND_PRINT, INTERNATIONAL_POSTAGE_AND_PRINT,
TIER1_TOP_LEVEL_DOMAIN, TIER2_TOP_LEVEL_DOMAIN, DEDICATED_IP, ENABLELCM, MAXCOMPONENTS, DATA_MANAGEMENT_USER, SPECIALIST_USER,
PROFESSIONAL_USER, MATERIALITY_MATRIX, STAKEHOLDER_MANAGEMENT, SCORECARD, STANDARD_MAPPING, DONATION_MANAGEMENT, DOCUMENT,
PACKAGE_SMALL, PACKAGE_LARGE, MEMBER, ATTENDEE, MAILING, RESPONSE, EXTERNAL_INVOICE_FEE, CLIENT_TEST, IMAGE_TRANSFORMATION,
TOTAL_IMAGE, LICENSE, MAILBOX, FREE_40_INCH_HDTV_PC, FREE_46_INCH_HDTV_PC, FREE_46_INCH_HDTV_PC_MOUNTING, EMPLOYEE_PER_WEEK,
REGISTER, END_USER, CORE, DEVICE, PORT, MEASURER, PUBLISHED_MEASUREMENT, NODE, SERVER_RULE, VPN_LP, PROXY_LP,
DESKTOP_CONNECT_LP, CAMERA, MAIN_SOUND_ZONE, SUB_SOUND_ZONE, POST, REPORT, BOX, SESSION, DISPLAY, TRUCKROLL, TRANSACTION_FEE,
SENDING_API_CALL, LOOKUP_API_CALL, ANALYTICS_API_CALL, MIGRATION_INSTANCE, NFON_SETUP_PER_PHONE_EXTENSION,
NFON_SETUP_PER_PHONE_EXTENSION_PLUS, NFON_SETUP_PER_EFAX_EXTENSION, NFON_PHONE_EXTENSION, NFON_PHONE_EXTENSION_PLUS,
NFON_EFAX_EXTENSION, NFON_CALL_CENTER_MONITORING, NFON_NMEETING, NFON_MOBILE_NFON_DEVICE, NFON_ISOFTPHONE_MAC,
NFON_NSOFTPHONE_STANDARD_WINDOWS, NFON_NSOFTPHONE_PREMIUM_WINDOWS, NFON_NCTI_STANDARD_WINDOWS, NFON_NCTI_STANDARD_CRM_WINDOWS,
NFON_NCTI_STANDARD_MAC, NFON_NSOFTPHONE_STANDARD_WINDOWS_OR_MOBILE, WESUSTAIN_PERFORMANCE, WESUSTAIN_STAKEHOLDER_REPUTATION,
WESUSTAIN_WEAPP, FAX, FAX_LINE, ROOM_LINE, DEPARTMENT_LINE, INTERNATIONAL_LICENSE, INTERNATIONAL_DEPARTMENT_LINE,
INTERNATIONAL_ROOM_LINE, INTERNATIONAL_LINE, CALLING_CREDIT, LINE, TOLLFREE_ROOM_LINE, TOLLFREE_DEPARTMENT_LINE,
TAXES_AND_FEES, LEAD, OPPORTUNITY, CAMPAIGN, CASE, CUSTOMER, TIER1_STANDARD_LINE, TIER1_ROOM_LINE, TIER1_TOLLFREE_ROOM_LINE,
TIER1_TOLLFREE_DEPARTMENT_LINE, TIER1_FAX_LINE, TIER1_DEPARTMENT_LINE, TIER2_STANDARD_LINE, TIER2_ROOM_LINE,
TIER2_DEPARTMENT_LINE, TIER3_STANDARD_LINE, TIER3_ROOM_LINE, TIER3_DEPARTMENT_LINE, TIER4_STANDARD_LINE, TIER4_ROOM_LINE,
TIER4_DEPARTMENT_LINE, CLUSTER, NODE_4VCPU, FIVE_HUNDRED_GB_SSD, TWELVE_TB_NETWORK_IO, JBOSS_EAP, JBOSS_FUSE, JBOSS_A_MQ,
JBOSS_BRMS, JBOSS_BPM_SUITE, JBOSS_DATA_GRID, JBOSS_DATA_VIRT, USER_LICENSE, ADDITIONAL_NUMBER_LICENSE, ROOM_PHONE_LICENSE,
UBERCONFERENCE_PRO_LICENSE, UBERCONFERENCE_PRO_LICENSE_UNBUNDLED, INSTANCE, INDOOR_CAMERA, OUTDOOR_CAMERA, VINGATE_LP_LICENCE,
ADMINISTRATOR, MOBILE_USER, T1, PHONE, AUTO_ATTENDANT, HUNT_GROUP, VOICEMAIL_BOX, TOLL_FREE_NUMBER,
INBOUND_LONG_DISTANCE_MINUTE, OUTBOUND_LONG_DISTANCE_MINUTE, INBOUND_OUTBOUND_LONG_DISTANCE_MINUTE, SET_TOP_BOX, MODEM,
ACCESS_POINT, CALLING_FEATURE, IAD_DEVICE, ANALOG_LINE, PRI, SBC_DEVICE, ROUTER, INTERNATIONAL_MINUTE, PHONE_LINE,
DYNAMIC_IP_ADDRESS, STATIC_IP_ADDRESS, GATEWAY, REMOTE_CONTROL, TIER1_STANDARD_SEAT, TIER2_STANDARD_SEAT, TIER3_STANDARD_SEAT,
TIER4_STANDARD_SEAT, TIER1_TOLL_FREE_SEAT, MILLION_MESSAGES, MESSAGE, WEEKLY, or PHONE_NUMBER.
vendorSharePercentage number Vendor's percentage share of the discount.

Responses

Status Meaning Description Definition
201 Created Created Discount
400 Bad Request Bad Request
404 Not Found Not Found
409 Conflict Conflict

Update a discount

Example request


curl -X put \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data-binary @- https://{marketplaceURL}/api/channel/v1/discounts/{discountId} <<EOF
{
  "applicationId": null,
  "applicationName": null,
  "autoApply": true,
  "basePartnerSharePercentage": 25,
  "billingCycles": null,
  "code": null,
  "createdOn": null,
  "description": "SOMEDESCRIPTION",
  "editionId": null,
  "expirationDate": null,
  "id": null,
  "industryId": null,
  "maxRedemptions": null,
  "maxUnits": 0,
  "minUnits": 0,
  "partnerSharePercentage": 25,
  "paymentPlanId": null,
  "percentage": 50,
  "price": null,
  "redemptionRestriction": "NONE",
  "redemptions": 0,
  "resellerCompanyId": null,
  "retainable": false,
  "startDate": null,
  "type": "PERCENTAGE",
  "unit": "USER",
  "vendorSharePercentage": 50
}
EOF

PUT https://{marketplaceURL}/api/channel/v1/discounts/{discountId} HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json

{
  "applicationId": null,
  "applicationName": null,
  "autoApply": true,
  "basePartnerSharePercentage": 25,
  "billingCycles": null,
  "code": null,
  "createdOn": null,
  "description": "SOMEDESCRIPTION",
  "editionId": null,
  "expirationDate": null,
  "id": null,
  "industryId": null,
  "maxRedemptions": null,
  "maxUnits": 0,
  "minUnits": 0,
  "partnerSharePercentage": 25,
  "paymentPlanId": null,
  "percentage": 50,
  "price": null,
  "redemptionRestriction": "NONE",
  "redemptions": 0,
  "resellerCompanyId": null,
  "retainable": false,
  "startDate": null,
  "type": "PERCENTAGE",
  "unit": "USER",
  "vendorSharePercentage": 50
}


var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/channel/v1/discounts/{discountId}',
  method: 'put',
  dataType: 'json',
  data: {
  "applicationId": null,
  "applicationName": null,
  "autoApply": true,
  "basePartnerSharePercentage": 25,
  "billingCycles": null,
  "code": null,
  "createdOn": null,
  "description": "SOMEDESCRIPTION",
  "editionId": null,
  "expirationDate": null,
  "id": null,
  "industryId": null,
  "maxRedemptions": null,
  "maxUnits": 0,
  "minUnits": 0,
  "partnerSharePercentage": 25,
  "paymentPlanId": null,
  "percentage": 50,
  "price": null,
  "redemptionRestriction": "NONE",
  "redemptions": 0,
  "resellerCompanyId": null,
  "retainable": false,
  "startDate": null,
  "type": "PERCENTAGE",
  "unit": "USER",
  "vendorSharePercentage": 50
},

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const inputBody = '{
  "applicationId": null,
  "applicationName": null,
  "autoApply": true,
  "basePartnerSharePercentage": 25,
  "billingCycles": null,
  "code": null,
  "createdOn": null,
  "description": "SOMEDESCRIPTION",
  "editionId": null,
  "expirationDate": null,
  "id": null,
  "industryId": null,
  "maxRedemptions": null,
  "maxUnits": 0,
  "minUnits": 0,
  "partnerSharePercentage": 25,
  "paymentPlanId": null,
  "percentage": 50,
  "price": null,
  "redemptionRestriction": "NONE",
  "redemptions": 0,
  "resellerCompanyId": null,
  "retainable": false,
  "startDate": null,
  "type": "PERCENTAGE",
  "unit": "USER",
  "vendorSharePercentage": 50
}';
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/channel/v1/discounts/{discountId}',
{
  method: 'PUT',body: inputBody,headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.put 'https://{marketplaceURL}/api/channel/v1/discounts/{discountId}',
payload={
  "applicationId": null,
  "applicationName": null,
  "autoApply": true,
  "basePartnerSharePercentage": 25,
  "billingCycles": null,
  "code": null,
  "createdOn": null,
  "description": "SOMEDESCRIPTION",
  "editionId": null,
  "expirationDate": null,
  "id": null,
  "industryId": null,
  "maxRedemptions": null,
  "maxUnits": 0,
  "minUnits": 0,
  "partnerSharePercentage": 25,
  "paymentPlanId": null,
  "percentage": 50,
  "price": null,
  "redemptionRestriction": "NONE",
  "redemptions": 0,
  "resellerCompanyId": null,
  "retainable": false,
  "startDate": null,
  "type": "PERCENTAGE",
  "unit": "USER",
  "vendorSharePercentage": 50
}
params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.put('https://{marketplaceURL}/api/channel/v1/discounts/{discountId}',
json={
  "applicationId": null,
  "applicationName": null,
  "autoApply": true,
  "basePartnerSharePercentage": 25,
  "billingCycles": null,
  "code": null,
  "createdOn": null,
  "description": "SOMEDESCRIPTION",
  "editionId": null,
  "expirationDate": null,
  "id": null,
  "industryId": null,
  "maxRedemptions": null,
  "maxUnits": 0,
  "minUnits": 0,
  "partnerSharePercentage": 25,
  "paymentPlanId": null,
  "percentage": 50,
  "price": null,
  "redemptionRestriction": "NONE",
  "redemptions": 0,
  "resellerCompanyId": null,
  "retainable": false,
  "startDate": null,
  "type": "PERCENTAGE",
  "unit": "USER",
  "vendorSharePercentage": 50
}
params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/channel/v1/discounts/{discountId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
String inputBody = "{" +
  "\"applicationId\": null," +
  "\"applicationName\": null," +
  "\"autoApply\": true," +
  "\"basePartnerSharePercentage\": 25," +
  "\"billingCycles\": null," +
  "\"code\": null," +
  "\"createdOn\": null," +
  "\"description\": \"SOMEDESCRIPTION\"," +
  "\"editionId\": null," +
  "\"expirationDate\": null," +
  "\"id\": null," +
  "\"industryId\": null," +
  "\"maxRedemptions\": null," +
  "\"maxUnits\": 0," +
  "\"minUnits\": 0," +
  "\"partnerSharePercentage\": 25," +
  "\"paymentPlanId\": null," +
  "\"percentage\": 50," +
  "\"price\": null," +
  "\"redemptionRestriction\": \"NONE\"," +
  "\"redemptions\": 0," +
  "\"resellerCompanyId\": null," +
  "\"retainable\": false," +
  "\"startDate\": null," +
  "\"type\": \"PERCENTAGE\"," +
  "\"unit\": \"USER\"," +
  "\"vendorSharePercentage\": 50" +
"}";

OutputStream os = conn.getOutputStream();
os.write(inputBody.getBytes("UTF-8"));
os.close();

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

{
  "applicationId": null,
  "applicationName": null,
  "autoApply": true,
  "basePartnerSharePercentage": 25,
  "billingCycles": null,
  "code": null,
  "createdOn": null,
  "description": "SOMEDESCRIPTION",
  "editionId": null,
  "expirationDate": null,
  "id": 5,
  "industryId": null,
  "maxRedemptions": null,
  "maxUnits": 0,
  "minUnits": 0,
  "partnerSharePercentage": 25,
  "paymentPlanId": null,
  "percentage": 50,
  "price": null,
  "redemptionRestriction": "NONE",
  "redemptions": 0,
  "resellerCompanyId": null,
  "retainable": false,
  "startDate": null,
  "type": "PERCENTAGE",
  "unit": "USER",
  "vendorSharePercentage": 50
}

PUT /channel/v1/discounts/{discountId}

Update the given discount using the provided data.

Parameters

Parameter Type Data Type Default Description
*discountId path integer Discount ID

Body Parameters

Discount data object

Discount object:

Property Type Description
applicationId number Application ID.
applicationName string Name of the application to which the discount applies.
autoApply boolean True if the discount is automatically applied. Default value is true.
basePartnerSharePercentage number Base partner's percentage share of the discount.
billingCycles number Number of billing cycles for which the discount should be applied.
code string Discount code. Must be at least 4 characters, but no longer than 103 characters.
createdOn number Creation date of the discount.
description string Description of discount. Required field. Must be at least 4 characters, but no longer than 255 characters.
editionId number Edition ID.
expirationDate number Expiration date for the discount. This date must be in the future.
id number Discount ID.
industryId number Industry ID.
maxRedemptions number Maximum number of redemptions available.
maxUnits number Maximum number of units for which to apply the discount.
minUnits number Minimum number of units for which to apply the discount.
partnerSharePercentage number Partner's percentage share of the discount.
paymentPlanId number Payment plan ID.
percentage number Percentage discount if discount is of PERCENTAGE type.
price number Amount to discount if discount is of FIXED_PRICE type.
redemptionRestriction RedemptionRestriction Redemption restriction. May be NONE, ONCE_PER_USER, or ONCE_PER_COMPANY. Default value is NONE.
redemptions number Number of times the discount has been redeemed.
resellerCompanyId string Reseller company ID.
retainable boolean True if the discount is retainable. Default value is false.
startDate number Start date for the discount.
type DiscountType Discount type. Required field. May be PERCENTAGE or FIXED_PRICE.
unit PricingUnit Pricing unit. May be USER, GIGABYTE, MEGABYTE, HOUR, MINUTE, INVOICE, UNIT, PROJECT, PROPERTY, ITEM, WORD,
EMAIL, CONTACT, CALL, CREDIT, ROOM, HOST, AGENT, OPERATOR, PROVIDER, MANAGER, TESTER, JVM, SERVER, WEB_USE_MINUTE,
AUDIO_USE_MINUTE, PIECE, EMPLOYEE_PAY_PERIOD, EMPLOYEE_PER_PAY_PERIOD, COMPUTER, NOT_APPLICABLE, ONE_TIME_SETUP,
DATA_POINTS, TIER1_API_CALLS, TIER2_API_CALLS, ADVISORY_HOURS, OVERAGE_AUDIO_MINUTE, EMPLOYEE, CONNECTION,
PUSH_USER, THOUSAND_EMAILS_PER_DAY, PUSH_NOTIFICATION_DEVICES, API_CALLS, SMS_TEXT_MESSAGE, CONTACTS_1000, CONTRACT_FEE,
TRANSFER_FEE, REACTIVATION_FEE, RECIPIENT, ADDITIONAL_1000_CONTACTS_BLOCK, SCHEDULE_PLAN, EMAILS_1000, EMAILS_2500,
MOBILE_DEVICE, PAYSLIP, PAYSLIP_CORRECTION, STORE, WEBSITE, EPAPER, PAGE, POSTAGE_AND_PRINT, INTERNATIONAL_POSTAGE_AND_PRINT,
TIER1_TOP_LEVEL_DOMAIN, TIER2_TOP_LEVEL_DOMAIN, DEDICATED_IP, ENABLELCM, MAXCOMPONENTS, DATA_MANAGEMENT_USER, SPECIALIST_USER,
PROFESSIONAL_USER, MATERIALITY_MATRIX, STAKEHOLDER_MANAGEMENT, SCORECARD, STANDARD_MAPPING, DONATION_MANAGEMENT, DOCUMENT,
PACKAGE_SMALL, PACKAGE_LARGE, MEMBER, ATTENDEE, MAILING, RESPONSE, EXTERNAL_INVOICE_FEE, CLIENT_TEST, IMAGE_TRANSFORMATION,
TOTAL_IMAGE, LICENSE, MAILBOX, FREE_40_INCH_HDTV_PC, FREE_46_INCH_HDTV_PC, FREE_46_INCH_HDTV_PC_MOUNTING, EMPLOYEE_PER_WEEK,
REGISTER, END_USER, CORE, DEVICE, PORT, MEASURER, PUBLISHED_MEASUREMENT, NODE, SERVER_RULE, VPN_LP, PROXY_LP,
DESKTOP_CONNECT_LP, CAMERA, MAIN_SOUND_ZONE, SUB_SOUND_ZONE, POST, REPORT, BOX, SESSION, DISPLAY, TRUCKROLL, TRANSACTION_FEE,
SENDING_API_CALL, LOOKUP_API_CALL, ANALYTICS_API_CALL, MIGRATION_INSTANCE, NFON_SETUP_PER_PHONE_EXTENSION,
NFON_SETUP_PER_PHONE_EXTENSION_PLUS, NFON_SETUP_PER_EFAX_EXTENSION, NFON_PHONE_EXTENSION, NFON_PHONE_EXTENSION_PLUS,
NFON_EFAX_EXTENSION, NFON_CALL_CENTER_MONITORING, NFON_NMEETING, NFON_MOBILE_NFON_DEVICE, NFON_ISOFTPHONE_MAC,
NFON_NSOFTPHONE_STANDARD_WINDOWS, NFON_NSOFTPHONE_PREMIUM_WINDOWS, NFON_NCTI_STANDARD_WINDOWS, NFON_NCTI_STANDARD_CRM_WINDOWS,
NFON_NCTI_STANDARD_MAC, NFON_NSOFTPHONE_STANDARD_WINDOWS_OR_MOBILE, WESUSTAIN_PERFORMANCE, WESUSTAIN_STAKEHOLDER_REPUTATION,
WESUSTAIN_WEAPP, FAX, FAX_LINE, ROOM_LINE, DEPARTMENT_LINE, INTERNATIONAL_LICENSE, INTERNATIONAL_DEPARTMENT_LINE,
INTERNATIONAL_ROOM_LINE, INTERNATIONAL_LINE, CALLING_CREDIT, LINE, TOLLFREE_ROOM_LINE, TOLLFREE_DEPARTMENT_LINE,
TAXES_AND_FEES, LEAD, OPPORTUNITY, CAMPAIGN, CASE, CUSTOMER, TIER1_STANDARD_LINE, TIER1_ROOM_LINE, TIER1_TOLLFREE_ROOM_LINE,
TIER1_TOLLFREE_DEPARTMENT_LINE, TIER1_FAX_LINE, TIER1_DEPARTMENT_LINE, TIER2_STANDARD_LINE, TIER2_ROOM_LINE,
TIER2_DEPARTMENT_LINE, TIER3_STANDARD_LINE, TIER3_ROOM_LINE, TIER3_DEPARTMENT_LINE, TIER4_STANDARD_LINE, TIER4_ROOM_LINE,
TIER4_DEPARTMENT_LINE, CLUSTER, NODE_4VCPU, FIVE_HUNDRED_GB_SSD, TWELVE_TB_NETWORK_IO, JBOSS_EAP, JBOSS_FUSE, JBOSS_A_MQ,
JBOSS_BRMS, JBOSS_BPM_SUITE, JBOSS_DATA_GRID, JBOSS_DATA_VIRT, USER_LICENSE, ADDITIONAL_NUMBER_LICENSE, ROOM_PHONE_LICENSE,
UBERCONFERENCE_PRO_LICENSE, UBERCONFERENCE_PRO_LICENSE_UNBUNDLED, INSTANCE, INDOOR_CAMERA, OUTDOOR_CAMERA, VINGATE_LP_LICENCE,
ADMINISTRATOR, MOBILE_USER, T1, PHONE, AUTO_ATTENDANT, HUNT_GROUP, VOICEMAIL_BOX, TOLL_FREE_NUMBER,
INBOUND_LONG_DISTANCE_MINUTE, OUTBOUND_LONG_DISTANCE_MINUTE, INBOUND_OUTBOUND_LONG_DISTANCE_MINUTE, SET_TOP_BOX, MODEM,
ACCESS_POINT, CALLING_FEATURE, IAD_DEVICE, ANALOG_LINE, PRI, SBC_DEVICE, ROUTER, INTERNATIONAL_MINUTE, PHONE_LINE,
DYNAMIC_IP_ADDRESS, STATIC_IP_ADDRESS, GATEWAY, REMOTE_CONTROL, TIER1_STANDARD_SEAT, TIER2_STANDARD_SEAT, TIER3_STANDARD_SEAT,
TIER4_STANDARD_SEAT, TIER1_TOLL_FREE_SEAT, MILLION_MESSAGES, MESSAGE, WEEKLY, or PHONE_NUMBER.
vendorSharePercentage number Vendor's percentage share of the discount.

Responses

Status Meaning Description Definition
200 OK OK Discount
400 Bad Request Bad Request
404 Not Found Not Found
409 Conflict Conflict

Delete a discount

Example request


curl -X delete https://{marketplaceURL}/api/channel/v1/discounts/{discountId} \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

DELETE https://{marketplaceURL}/api/channel/v1/discounts/{discountId} HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/channel/v1/discounts/{discountId}',
  method: 'delete',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/channel/v1/discounts/{discountId}',
{
  method: 'DELETE',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.delete 'https://{marketplaceURL}/api/channel/v1/discounts/{discountId}',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.delete('https://{marketplaceURL}/api/channel/v1/discounts/{discountId}',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/channel/v1/discounts/{discountId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /channel/v1/discounts/{discountId}

Delete the discount for the given discount ID.

Parameters

Parameter Type Data Type Default Description
*discountId path integer Discount ID

Responses

Status Meaning Description Definition
204 No Content No Content
404 Not Found Not Found

Invoices

List All Invoices

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/invoices \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/invoices HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/invoices',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/invoices',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/invoices',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/invoices',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/invoices");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

[
  {
    "company": {
      "href": "http://appdirect/api/account/v1/companies/5a95127f-4b06-459c-bdb1-da80568de2fd",
      "id": "5a95127f-4b06-459c-bdb1-da80568de2fd"
    },
    "creationDate": 1481003387753,
    "currency": "USD",
    "dueDate": 1481353200000,
    "invoiceId": 1,
    "links": [
      {
        "href": "http://appdirect/api/account/v2/users/eefdf767-9197-4402-ba0d-614cfec17ee1",
        "rel": "user"
      },
      {
        "href": "http://appdirect/api/account/v2/companies/5a95127f-4b06-459c-bdb1-da80568de2fd",
        "rel": "company"
      },
      {
        "href": "http://appdirect/api/billing/v1/invoices/1",
        "rel": "self"
      }
    ],
    "orderIds": [
      "2030"
    ],
    "referenceNumber": null,
    "status": "PAID",
    "total": 10,
    "user": {
      "href": "http://appdirect/api/account/v1/users/eefdf767-9197-4402-ba0d-614cfec17ee1",
      "id": "eefdf767-9197-4402-ba0d-614cfec17ee1"
    }
  }
]

GET /billing/v1/invoices

List all invoice data

Parameters

Parameter Type Data Type Default Description
count query string 250 Number of results to fetch. Used for paging.
excludeFree query boolean Exclude invoices with no charges.
fromDate query number From date.
sortField query string of enum:
DATE
INVOICE_ID
TOTAL
INVOICE_ID Sort field.
sortOrder query string of enum:
ASC
DESC
ASC Sort order.
start query string 0 First result index. Used for paging.
status query string of enum:
CARRIED
PAID
UNPAID
VOIDED
Invoice status.
toDate query number To date.
buyerRole query string of enum:
ALL
CUSTOMER
RESELLER
SALES_SUPPORT
Filter invoices with purchases made by user with this role.

Responses

Status Meaning Description Definition
200 OK OK InvoiceListing
204 No Content No Content InvoiceListing
401 Unauthorized Unauthorized
404 Not Found Not Found

Retrieve an Invoice

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber} \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber} HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

{
  "company": {
    "href": "http://appdirect/api/account/v1/companies/ba550905-e0ea-48f2-a04f-0763e999d89c",
    "id": "ba550905-e0ea-48f2-a04f-0763e999d89c"
  },
  "creationDate": 1481003386696,
  "currency": "USD",
  "delegatedToInvoice": null,
  "dueDate": 1481353200000,
  "includedInvoices": null,
  "invoiceId": 1,
  "invoiceLines": [
    {
      "description": "Invoice Line description",
      "editionId": 1210,
      "id": 23,
      "itemId": null,
      "paymentPlanId": 1367,
      "percentage": null,
      "periodEnd": null,
      "periodStart": null,
      "price": null,
      "pricingUnit": "USER",
      "productId": 788,
      "quantity": 1,
      "total": null,
      "type": "ITEM"
    }
  ],
  "links": [
    {
      "href": "http://appdirect/api/account/v2/users/f090d591-8909-43ed-883d-71fb09ef3941",
      "rel": "user"
    },
    {
      "href": "http://appdirect/api/account/v2/companies/ba550905-e0ea-48f2-a04f-0763e999d89c",
      "rel": "company"
    },
    {
      "href": "http://appdirect/api/billing/v1/invoices/1",
      "rel": "self"
    }
  ],
  "orderIds": [
    "2030"
  ],
  "referenceNumber": null,
  "status": "PAID",
  "total": 10,
  "user": {
    "href": "http://appdirect/api/account/v1/users/f090d591-8909-43ed-883d-71fb09ef3941",
    "id": "f090d591-8909-43ed-883d-71fb09ef3941"
  }
}

GET /billing/v1/invoices/{invoiceNumber}

Read an invoice

Parameters

Parameter Type Data Type Default Description
*invoiceNumber path integer The unique identifier for the invoice provided by the channel.

Responses

Status Meaning Description Definition
200 OK OK Invoice
401 Unauthorized Unauthorized
404 Not Found Not Found

List All Invoice Payments

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}/payments \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}/payments HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}/payments',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}/payments',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}/payments',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}/payments',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}/payments");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

[
  {
    "amount": 10,
    "company": {
      "href": "http://appdirect/api/account/v1/companies/5aae5a52-cec3-4cb2-87b4-6352624d2a31",
      "id": "5aae5a52-cec3-4cb2-87b4-6352624d2a31"
    },
    "currency": "USD",
    "date": 1481003382652,
    "gatewayResponse": {
      "avs": true,
      "code": null,
      "cvv": true,
      "message": null
    },
    "links": [
      {
        "href": "http://appdirect/api/billing/v1/payments/2",
        "rel": "self"
      }
    ],
    "method": "CREDIT_CARD",
    "paymentNumber": 2,
    "result": "SUCCESSFUL",
    "transactionId": "123456abcdef",
    "user": {
      "href": "http://appdirect/api/account/v1/users/72ae0d01-8036-4203-95c0-4c2fb424ff6d",
      "id": "72ae0d01-8036-4203-95c0-4c2fb424ff6d"
    }
  }
]

GET /billing/v1/invoices/{invoiceNumber}/payments

List all payment data for an invoice

Parameters

Parameter Type Data Type Default Description
*invoiceNumber path integer Invoice number.
count query string 250 Number of results to fetch. Used for paging.
fromDate query number From date.
method query string of enum:
ADP_INVOICE
ARIBAPAY
BT_BILL
CLICKANDBUY
CLOUDFOUNDRY
CREDIT_CARD
CUMULA_BILL
DTAG
EXTERNAL_INVOICE
KREDITKARTE
LASTSCHRIFT_MRNEXNET
MANO_TEO_BILL
MANUAL
MARKETPLACE_CREDITS
NETS_ARVATO_INVOICE
NEXTEL
PAYPAL
ROGERS_CC_DTMF
ROGERS_CC_POS
SNAP
TBILL
THISTLE
TOICLEARING
Payment method.
result query string of enum:
FAILED
GATEWAY_NOT_AVAILABLE
MANUAL
SUCCESSFUL
Payment result.
sortField query string of enum:
AMOUNT
DATE
PAYMENT_ID
PAYMENT_ID Sort field.
sortOrder query string of enum:
ASC
DESC
ASC Sort order.
start query string 0 First result index. Used for paging.
toDate query number To date.

Responses

Status Meaning Description Definition
200 OK OK Payment
204 No Content No Content Payment
401 Unauthorized Unauthorized
404 Not Found Not Found

Pay an Invoice

Example request


curl -X post \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data-binary @- https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}/payments <<EOF
{
  "amount": 12345,
  "company": {
    "href": "...",
    "id": "..."
  },
  "currency": "INR",
  "date": 12345,
  "gatewayResponse": {
    "avs": true,
    "code": "...",
    "cvv": true,
    "message": "..."
  },
  "id": 12345,
  "links": [
    {
      "href": "...",
      "rel": "..."
    },
    {
      "href": "...",
      "rel": "..."
    }
  ],
  "method": "PAYPAL",
  "result": "GATEWAY_NOT_AVAILABLE",
  "transactionId": "...",
  "user": {
    "href": "...",
    "id": "..."
  }
}
EOF

POST https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}/payments HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json

{
  "amount": 12345,
  "company": {
    "href": "...",
    "id": "..."
  },
  "currency": "INR",
  "date": 12345,
  "gatewayResponse": {
    "avs": true,
    "code": "...",
    "cvv": true,
    "message": "..."
  },
  "id": 12345,
  "links": [
    {
      "href": "...",
      "rel": "..."
    },
    {
      "href": "...",
      "rel": "..."
    }
  ],
  "method": "PAYPAL",
  "result": "GATEWAY_NOT_AVAILABLE",
  "transactionId": "...",
  "user": {
    "href": "...",
    "id": "..."
  }
}


var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}/payments',
  method: 'post',
  dataType: 'json',
  data: {
  "amount": 12345,
  "company": {
    "href": "...",
    "id": "..."
  },
  "currency": "INR",
  "date": 12345,
  "gatewayResponse": {
    "avs": true,
    "code": "...",
    "cvv": true,
    "message": "..."
  },
  "id": 12345,
  "links": [
    {
      "href": "...",
      "rel": "..."
    },
    {
      "href": "...",
      "rel": "..."
    }
  ],
  "method": "PAYPAL",
  "result": "GATEWAY_NOT_AVAILABLE",
  "transactionId": "...",
  "user": {
    "href": "...",
    "id": "..."
  }
},

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const inputBody = '{
  "amount": 12345,
  "company": {
    "href": "...",
    "id": "..."
  },
  "currency": "INR",
  "date": 12345,
  "gatewayResponse": {
    "avs": true,
    "code": "...",
    "cvv": true,
    "message": "..."
  },
  "id": 12345,
  "links": [
    {
      "href": "...",
      "rel": "..."
    },
    {
      "href": "...",
      "rel": "..."
    }
  ],
  "method": "PAYPAL",
  "result": "GATEWAY_NOT_AVAILABLE",
  "transactionId": "...",
  "user": {
    "href": "...",
    "id": "..."
  }
}';
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}/payments',
{
  method: 'POST',body: inputBody,headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.post 'https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}/payments',
payload={
  "amount": 12345,
  "company": {
    "href": "...",
    "id": "..."
  },
  "currency": "INR",
  "date": 12345,
  "gatewayResponse": {
    "avs": true,
    "code": "...",
    "cvv": true,
    "message": "..."
  },
  "id": 12345,
  "links": [
    {
      "href": "...",
      "rel": "..."
    },
    {
      "href": "...",
      "rel": "..."
    }
  ],
  "method": "PAYPAL",
  "result": "GATEWAY_NOT_AVAILABLE",
  "transactionId": "...",
  "user": {
    "href": "...",
    "id": "..."
  }
}
params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.post('https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}/payments',
json={
  "amount": 12345,
  "company": {
    "href": "...",
    "id": "..."
  },
  "currency": "INR",
  "date": 12345,
  "gatewayResponse": {
    "avs": true,
    "code": "...",
    "cvv": true,
    "message": "..."
  },
  "id": 12345,
  "links": [
    {
      "href": "...",
      "rel": "..."
    },
    {
      "href": "...",
      "rel": "..."
    }
  ],
  "method": "PAYPAL",
  "result": "GATEWAY_NOT_AVAILABLE",
  "transactionId": "...",
  "user": {
    "href": "...",
    "id": "..."
  }
}
params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}/payments");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
String inputBody = "{" +
  "\"amount\": 12345," +
  "\"company\": {" +
    "\"href\": \"...\"," +
    "\"id\": \"...\"" +
  "}," +
  "\"currency\": \"INR\"," +
  "\"date\": 12345," +
  "\"gatewayResponse\": {" +
    "\"avs\": true," +
    "\"code\": \"...\"," +
    "\"cvv\": true," +
    "\"message\": \"...\"" +
  "}," +
  "\"id\": 12345," +
  "\"links\": [" +
    "{" +
      "\"href\": \"...\"," +
      "\"rel\": \"...\"" +
    "}," +
    "{" +
      "\"href\": \"...\"," +
      "\"rel\": \"...\"" +
    "}" +
  "]," +
  "\"method\": \"PAYPAL\"," +
  "\"result\": \"GATEWAY_NOT_AVAILABLE\"," +
  "\"transactionId\": \"...\"," +
  "\"user\": {" +
    "\"href\": \"...\"," +
    "\"id\": \"...\"" +
  "}" +
"}";

OutputStream os = conn.getOutputStream();
os.write(inputBody.getBytes("UTF-8"));
os.close();

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /billing/v1/invoices/{invoiceNumber}/payments

If the invoice is unpaid, will process the payment and return the result. Will return an exception otherwise

Parameters

Parameter Type Data Type Default Description
*invoiceNumber path integer The unique identifier for the invoice provided by the channel.

Body Parameters

Payment data object.

Payment object:

Property Type Description
amount number Payment amount.
company LinkWS Link to company information.
currency Currency Payment currency.
date number Payment date.
gatewayResponse GatewayResponse Gateway response
id number Payment number.
links array of Link Resource links
method PaymentMethod Payment method. Includes CREDIT_CARD, PAYPAL, and MANUAL.
result PaymentResult Payment result. May be SUCCESSFUL, FAILED , GATEWAY_NOT_AVAILABLE, or MANUAL.
transactionId string Transaction ID.
user LinkWS Link to user information.

Responses

Status Meaning Description Definition
200 OK OK Payment
400 Bad Request Bad Request
401 Unauthorized Unauthorized
404 Not Found Not Found
409 Conflict Conflict

Metered Usage

Bill Usage

Example request


curl -X post \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data-binary @- https://{marketplaceURL}/api/integration/v1/billing/usage <<EOF
{
  "account": {
    "accountIdentifier": "1-account-identifier",
    "parentAccountIdentifier": null,
    "status": "INITIALIZED"
  },
  "addonInstance": null,
  "items": [
    {
      "customUnit": null,
      "description": null,
      "price": null,
      "quantity": 10,
      "unit": "GIGABYTE"
    }
  ]
}
EOF

POST https://{marketplaceURL}/api/integration/v1/billing/usage HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json

{
  "account": {
    "accountIdentifier": "1-account-identifier",
    "parentAccountIdentifier": null,
    "status": "INITIALIZED"
  },
  "addonInstance": null,
  "items": [
    {
      "customUnit": null,
      "description": null,
      "price": null,
      "quantity": 10,
      "unit": "GIGABYTE"
    }
  ]
}


var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/integration/v1/billing/usage',
  method: 'post',
  dataType: 'json',
  data: {
  "account": {
    "accountIdentifier": "1-account-identifier",
    "parentAccountIdentifier": null,
    "status": "INITIALIZED"
  },
  "addonInstance": null,
  "items": [
    {
      "customUnit": null,
      "description": null,
      "price": null,
      "quantity": 10,
      "unit": "GIGABYTE"
    }
  ]
},

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const inputBody = '{
  "account": {
    "accountIdentifier": "1-account-identifier",
    "parentAccountIdentifier": null,
    "status": "INITIALIZED"
  },
  "addonInstance": null,
  "items": [
    {
      "customUnit": null,
      "description": null,
      "price": null,
      "quantity": 10,
      "unit": "GIGABYTE"
    }
  ]
}';
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/integration/v1/billing/usage',
{
  method: 'POST',body: inputBody,headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.post 'https://{marketplaceURL}/api/integration/v1/billing/usage',
payload={
  "account": {
    "accountIdentifier": "1-account-identifier",
    "parentAccountIdentifier": null,
    "status": "INITIALIZED"
  },
  "addonInstance": null,
  "items": [
    {
      "customUnit": null,
      "description": null,
      "price": null,
      "quantity": 10,
      "unit": "GIGABYTE"
    }
  ]
}
params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.post('https://{marketplaceURL}/api/integration/v1/billing/usage',
json={
  "account": {
    "accountIdentifier": "1-account-identifier",
    "parentAccountIdentifier": null,
    "status": "INITIALIZED"
  },
  "addonInstance": null,
  "items": [
    {
      "customUnit": null,
      "description": null,
      "price": null,
      "quantity": 10,
      "unit": "GIGABYTE"
    }
  ]
}
params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/integration/v1/billing/usage");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
String inputBody = "{" +
  "\"account\": {" +
    "\"accountIdentifier\": \"1-account-identifier\"," +
    "\"parentAccountIdentifier\": null," +
    "\"status\": \"INITIALIZED\"" +
  "}," +
  "\"addonInstance\": null," +
  "\"items\": [" +
    "{" +
      "\"customUnit\": null," +
      "\"description\": null," +
      "\"price\": null," +
      "\"quantity\": 10," +
      "\"unit\": \"GIGABYTE\"" +
    "}" +
  "]" +
"}";

OutputStream os = conn.getOutputStream();
os.write(inputBody.getBytes("UTF-8"));
os.close();

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

{
  "message": "Bill usage API call succeeded.",
  "success": true
}

POST /integration/v1/billing/usage

Submit usage data to be billed for the given account identifier

Parameters

Parameter Type Data Type Default Description
async query boolean false True if asynchronous. Default value is false.

Body Parameters

Usage data information.

UsageBean object:

Property Type Description
account AccountInfo Account information
addonInstance AddonInstanceInfo Add-on instance information
item array of UsageItemBean

Responses

Status Meaning Description Definition
201 Created Created BillingAPIResult
400 Bad Request Bad Request
404 Not Found Not Found
500 Internal Server Error Internal Server Error

Payment Instruments

Retrieve the default payment instrument

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/paymentInstruments/default \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/paymentInstruments/default HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/paymentInstruments/default',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/paymentInstruments/default',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/paymentInstruments/default',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/paymentInstruments/default',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/paymentInstruments/default");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

{
  "accountDisplay": "1111",
  "billingAddress": {
    "city": "Somerville",
    "companyName": "AppDirect",
    "country": "US",
    "firstName": "John",
    "lastName": "Doe",
    "phone": "9999999999",
    "state": "Massachusetts",
    "street1": "50 Grove St.",
    "street2": "500 Grove St.",
    "zip": "02114"
  },
  "company": {
    "href": "http://appdirect/api/account/v1/companies/81ae9b52-f6d6-446e-a1b7-7107998cb4e0",
    "id": "81ae9b52-f6d6-446e-a1b7-7107998cb4e0"
  },
  "createdOn": 1481065767448,
  "creditCard": {
    "expirationMonth": 12,
    "expirationYear": 2016,
    "name": "John Doe",
    "number": "333",
    "securityCode": "333",
    "type": "VISA"
  },
  "default": false,
  "id": "ce6266c9-7939-42ee-8cdb-a7a2bc240be4",
  "parameters": {
    "creditsAccountId": 123456,
    "externalId": "a1a5-a1da6sa2-asf6fa5-1asfs6-6a5sf16asf",
    "invoicingEmail": "invoicing@gmail.com",
    "issuer": "VISA",
    "maskedPan": "thisIsaMaskedPan",
    "paymentMethod": "CREDIT_CARD",
    "paymentToken": "28c21248-bae0-492c-ab32-8f2dda5fb87d",
    "processUrl": "http://processUrl.com"
  },
  "paymentMethod": "CREDIT_CARD",
  "user": {
    "href": "http://appdirect/api/account/v1/users/b665be4f-42a8-47d8-bebc-8e2387fb86d8",
    "id": "b665be4f-42a8-47d8-bebc-8e2387fb86d8"
  }
}

GET /billing/v1/paymentInstruments/default

Retrieve the default payment instrument for a given user and company

Parameters

Parameter Type Data Type Default Description
companyUuid query string User's company UUID
userUuid query string User's UUID

Responses

Status Meaning Description Definition
200 OK OK PaymentInstrument
404 Not Found Not Found

Retrieve a payment instrument

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/paymentInstruments/{paymentInstrumentId} \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/paymentInstruments/{paymentInstrumentId} HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/paymentInstruments/{paymentInstrumentId}',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/paymentInstruments/{paymentInstrumentId}',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/paymentInstruments/{paymentInstrumentId}',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/paymentInstruments/{paymentInstrumentId}',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/paymentInstruments/{paymentInstrumentId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

{
  "accountDisplay": "1111",
  "billingAddress": {
    "city": "Somerville",
    "companyName": "AppDirect",
    "country": "US",
    "firstName": "John",
    "lastName": "Doe",
    "phone": "9999999999",
    "state": "Massachusetts",
    "street1": "50 Grove St.",
    "street2": "500 Grove St.",
    "zip": "02114"
  },
  "company": {
    "href": "http://appdirect/api/account/v1/companies/709997cb-f3b9-42ea-8e8f-2ea0ada4f9e2",
    "id": "709997cb-f3b9-42ea-8e8f-2ea0ada4f9e2"
  },
  "createdOn": 1481065768024,
  "creditCard": {
    "expirationMonth": 12,
    "expirationYear": 2016,
    "name": "John Doe",
    "number": "333",
    "securityCode": "333",
    "type": "VISA"
  },
  "default": false,
  "id": "3aa51449-474d-4a2e-974c-b9b390e9cd54",
  "parameters": {
    "creditsAccountId": 123456,
    "externalId": "a1a5-a1da6sa2-asf6fa5-1asfs6-6a5sf16asf",
    "invoicingEmail": "invoicing@gmail.com",
    "issuer": "VISA",
    "maskedPan": "thisIsaMaskedPan",
    "paymentMethod": "CREDIT_CARD",
    "paymentToken": "28c21248-bae0-492c-ab32-8f2dda5fb87d",
    "processUrl": "http://processUrl.com"
  },
  "paymentMethod": "CREDIT_CARD",
  "user": {
    "href": "http://appdirect/api/account/v1/users/81a3aa25-4da1-4322-8fb2-1a7c79a9f5ff",
    "id": "81a3aa25-4da1-4322-8fb2-1a7c79a9f5ff"
  }
}

GET /billing/v1/paymentInstruments/{paymentInstrumentId}

Parameters

Parameter Type Data Type Default Description
*paymentInstrumentId path string Payment Instrument Id

Responses

Status Meaning Description Definition
200 OK OK PaymentInstrument
404 Not Found Not Found

Delete a payment instrument

Example request


curl -X delete https://{marketplaceURL}/api/billing/v1/paymentInstruments/{paymentInstrumentId} \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

DELETE https://{marketplaceURL}/api/billing/v1/paymentInstruments/{paymentInstrumentId} HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/paymentInstruments/{paymentInstrumentId}',
  method: 'delete',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/paymentInstruments/{paymentInstrumentId}',
{
  method: 'DELETE',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.delete 'https://{marketplaceURL}/api/billing/v1/paymentInstruments/{paymentInstrumentId}',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.delete('https://{marketplaceURL}/api/billing/v1/paymentInstruments/{paymentInstrumentId}',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/paymentInstruments/{paymentInstrumentId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /billing/v1/paymentInstruments/{paymentInstrumentId}

Delete a payment instrument

Parameters

Parameter Type Data Type Default Description
*paymentInstrumentId path string Payment Instrument Id

Responses

Status Meaning Description Definition
204 No Content No Content
404 Not Found Not Found

Payments

List all payments

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/payments \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/payments HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/payments',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/payments',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/payments',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/payments',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/payments");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

[
  {
    "amount": 10,
    "company": {
      "href": "http://appdirect/api/account/v1/companies/13febe65-6774-4c99-aee4-85a57dab94e4",
      "id": "13febe65-6774-4c99-aee4-85a57dab94e4"
    },
    "currency": "USD",
    "date": 1480980392947,
    "gatewayResponse": {
      "avs": true,
      "code": null,
      "cvv": true,
      "message": null
    },
    "links": [
      {
        "href": "http://appdirect/api/billing/v1/payments/1",
        "rel": "self"
      }
    ],
    "method": "CREDIT_CARD",
    "paymentNumber": 1,
    "result": "SUCCESSFUL",
    "transactionId": null,
    "user": {
      "href": "http://appdirect/api/account/v1/users/46b7ee79-5cb4-4ccf-b6cb-5ec869c67ffc",
      "id": "46b7ee79-5cb4-4ccf-b6cb-5ec869c67ffc"
    }
  }
]

Example response

{
  "amount": 12345,
  "company": {
    "href": "...",
    "id": "..."
  },
  "currency": "SEK",
  "date": 12345,
  "gatewayResponse": {
    "avs": true,
    "code": "...",
    "cvv": true,
    "message": "..."
  },
  "id": 12345,
  "links": [
    {
      "href": "...",
      "rel": "..."
    },
    {
      "href": "...",
      "rel": "..."
    }
  ],
  "method": "TBILL",
  "result": "GATEWAY_NOT_AVAILABLE",
  "transactionId": "...",
  "user": {
    "href": "...",
    "id": "..."
  }
}

GET /billing/v1/payments

List all payments matching the input filters

Parameters

Parameter Type Data Type Default Description
count query string 250 Number of results to fetch. Used for paging.
fromDate query number From date
method query string of enum:
ADP_INVOICE
ARIBAPAY
BT_BILL
CLICKANDBUY
CLOUDFOUNDRY
CREDIT_CARD
CUMULA_BILL
DTAG
EXTERNAL_INVOICE
KREDITKARTE
LASTSCHRIFT_MRNEXNET
MANO_TEO_BILL
MANUAL
MARKETPLACE_CREDITS
NETS_ARVATO_INVOICE
NEXTEL
PAYPAL
ROGERS_CC_DTMF
ROGERS_CC_POS
SNAP
TBILL
THISTLE
TOICLEARING
Payment method
result query string of enum:
FAILED
GATEWAY_NOT_AVAILABLE
MANUAL
SUCCESSFUL
Payment result
sortField query string of enum:
AMOUNT
DATE
PAYMENT_ID
PAYMENT_ID Sort field
sortOrder query string of enum:
ASC
DESC
ASC Sort order
start query string 0 First result index. Used for paging.
toDate query number To date

Responses

Status Meaning Description Definition
200 OK OK Payment
204 No Content No content Payment

Retrieve a payment

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/payments/{paymentNumber} \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/payments/{paymentNumber} HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/payments/{paymentNumber}',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/payments/{paymentNumber}',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/payments/{paymentNumber}',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/payments/{paymentNumber}',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/payments/{paymentNumber}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

{
  "amount": 10,
  "company": {
    "href": "http://appdirect/api/account/v1/companies/a5e58cc5-1162-4066-9d07-2275d9759d4e",
    "id": "a5e58cc5-1162-4066-9d07-2275d9759d4e"
  },
  "currency": "USD",
  "date": 1480980388022,
  "gatewayResponse": {
    "avs": true,
    "code": null,
    "cvv": true,
    "message": null
  },
  "links": [],
  "method": "CREDIT_CARD",
  "paymentNumber": 1,
  "result": "SUCCESSFUL",
  "transactionId": null,
  "user": {
    "href": "http://appdirect/api/account/v1/users/24cf38da-ca99-4ea6-ac63-ed7b310456bc",
    "id": "24cf38da-ca99-4ea6-ac63-ed7b310456bc"
  }
}

GET /billing/v1/payments/{paymentNumber}

Retrieve a payment given its payment number

Parameters

Parameter Type Data Type Default Description
*paymentNumber path integer Payment number

Responses

Status Meaning Description Definition
200 OK OK Payment
404 Not Found Not Found

List all payment invoices

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/payments/{paymentNumber}/invoices \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/payments/{paymentNumber}/invoices HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/payments/{paymentNumber}/invoices',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/payments/{paymentNumber}/invoices',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/payments/{paymentNumber}/invoices',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/payments/{paymentNumber}/invoices',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/payments/{paymentNumber}/invoices");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

[
  {
    "company": {
      "href": "http://appdirect/api/account/v1/companies/6a8921e7-6f15-4f36-9ab3-5663d67ba88f",
      "id": "6a8921e7-6f15-4f36-9ab3-5663d67ba88f"
    },
    "creationDate": null,
    "currency": "USD",
    "dueDate": null,
    "invoiceId": 1,
    "links": [
      {
        "href": "http://appdirect/api/account/v2/users/5e496e63-0ccd-42e1-a880-8c636619df7d",
        "rel": "user"
      },
      {
        "href": "http://appdirect/api/account/v2/companies/6a8921e7-6f15-4f36-9ab3-5663d67ba88f",
        "rel": "company"
      },
      {
        "href": "http://appdirect/api/billing/v1/invoices/1",
        "rel": "self"
      }
    ],
    "referenceNumber": null,
    "status": "PAID",
    "total": null,
    "user": {
      "href": "http://appdirect/api/account/v1/users/5e496e63-0ccd-42e1-a880-8c636619df7d",
      "id": "5e496e63-0ccd-42e1-a880-8c636619df7d"
    }
  }
]

GET /billing/v1/payments/{paymentNumber}/invoices

List all invoices attached to a given payment

Parameters

Parameter Type Data Type Default Description
*paymentNumber path integer Payment number
count query string 250 Number of results to fetch. Used for paging.
excludeFree query boolean Exclude free invoices
fromDate query number From date
sortField query string of enum:
DATE
INVOICE_ID
TOTAL
INVOICE_ID Sort field
sortOrder query string of enum:
ASC
DESC
ASC Sort order
start query string 0 First result index. Used for paging.
status query string of enum:
CARRIED
PAID
UNPAID
VOIDED
Status of the related invoice(s)
toDate query number To date

Responses

Status Meaning Description Definition
200 OK OK InvoiceListing
204 No Content No content InvoiceListing
404 Not Found Not Found

Product Context

Retrieve a product context for the current user

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/userProductContext/{applicationId} \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/userProductContext/{applicationId} HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/userProductContext/{applicationId}',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/userProductContext/{applicationId}',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/userProductContext/{applicationId}',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/userProductContext/{applicationId}',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/userProductContext/{applicationId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

{
  "assigned": false,
  "editionId": null,
  "freeTrialAllowed": true,
  "freeTrialDaysLeft": null,
  "maxUsers": null,
  "numAssignedUsers": null,
  "owner": null,
  "partOfExistingBundle": false,
  "paymentPlan": null,
  "pendingEventType": "",
  "purchaseRestrictions": [],
  "status": null,
  "subscription": null
}

GET /billing/v1/userProductContext/{applicationId}

Retrieve a product context for the current user

Parameters

Parameter Type Data Type Default Description
*applicationId path number id of the application

Responses

Status Meaning Description Definition
200 OK OK UserProductContext
404 Not Found Application Not Found

Retrieve a product context for a supplied user and a company they belong to

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/userProductContext/{applicationId}/companies/{companyId}/users/{userId} \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/userProductContext/{applicationId}/companies/{companyId}/users/{userId} HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/userProductContext/{applicationId}/companies/{companyId}/users/{userId}',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/userProductContext/{applicationId}/companies/{companyId}/users/{userId}',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/userProductContext/{applicationId}/companies/{companyId}/users/{userId}',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/userProductContext/{applicationId}/companies/{companyId}/users/{userId}',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/userProductContext/{applicationId}/companies/{companyId}/users/{userId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

{
  "assigned": true,
  "editionId": 22,
  "freeTrialAllowed": false,
  "freeTrialDaysLeft": null,
  "maxUsers": 2,
  "numAssignedUsers": 1,
  "owner": {
    "href": "http://appdirect/api/account/v1/users/7e5ff840-1e1b-4b8f-b243-26ac12ebd427",
    "id": "7e5ff840-1e1b-4b8f-b243-26ac12ebd427"
  },
  "partOfExistingBundle": false,
  "paymentPlan": {
    "href": "http://appdirect/api/marketplace/v1/products/22/editions/22/paymentPlans/41",
    "id": "41"
  },
  "pendingEventType": "",
  "purchaseRestrictions": [],
  "status": "ACTIVE",
  "subscription": {
    "href": "http://appdirect/api/billing/v1/subscriptions/da43fcb9-988e-48d8-a132-fbc465e10aab",
    "id": "da43fcb9-988e-48d8-a132-fbc465e10aab"
  }
}

GET /billing/v1/userProductContext/{applicationId}/companies/{companyId}/users/{userId}

Retrieve a product context for a supplied user and a company they belong to

Parameters

Parameter Type Data Type Default Description
*applicationId path number id of the application
*companyId path string uuid of the desired users' company
*userId path string uuid of the desired user

Responses

Status Meaning Description Definition
200 OK OK UserProductContext
404 Not Found User, Company or Application Not Found

Purchase Orders

List all purchase orders

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/orders \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/orders HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/orders',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/orders',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/orders',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/orders',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/orders");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

{
  "orders": [
    {
      "activated": false,
      "company": {
        "href": "http://appdirect/api/account/v1/companies/5df15aa3-a3f3-4c6f-a434-9a85545e9c95",
        "id": "5df15aa3-a3f3-4c6f-a434-9a85545e9c95"
      },
      "contract": null,
      "currency": "USD",
      "discount": null,
      "discountId": null,
      "endDate": null,
      "endOfDiscountDate": null,
      "frequency": "MONTHLY",
      "id": 4,
      "links": [
        {
          "href": "http://appdirect/api/billing/v1/subscriptions/6d2a0cb2-aa95-48d4-a0c3-37427164475e",
          "rel": "subscription"
        }
      ],
      "nextBillingDate": 1483679427061,
      "nextOrder": null,
      "oneTimeOrders": [],
      "orderLines": [],
      "parameters": [],
      "paymentPlan": {
        "allowCustomUsage": false,
        "contract": {
          "alignWithParentCycleStartDate": false,
          "autoExtensionPricingId": 7,
          "blockContractDowngrades": false,
          "blockContractUpgrades": false,
          "blockSwitchToShorterContract": false,
          "cancellationPeriodLimit": null,
          "endOfContractGracePeriod": null,
          "gracePeriod": null,
          "minimumServiceLength": 3,
          "terminationFee": null
        },
        "costs": [
          {
            "amount": {
              "USD": 10
            },
            "blockContractDecrease": false,
            "blockContractIncrease": false,
            "blockOriginalContractDecrease": false,
            "id": 7,
            "increment": 1,
            "maxUnits": null,
            "meteredUsage": false,
            "minUnits": 0,
            "pricePerIncrement": false,
            "pricingStrategy": "UNIT",
            "unit": "USER",
            "unitDependency": null
          }
        ],
        "discount": null,
        "frequency": "MONTHLY",
        "href": "http://appdirect/api/marketplace/v1/products/4/editions/4/paymentPlans/7",
        "id": 7,
        "isPrimaryPrice": false,
        "keepBillDateOnUsageChange": false,
        "primaryPrice": false,
        "separatePrepaid": false,
        "uuid": "4e29be4a-142b-482f-938c-418720bfd092"
      },
      "paymentPlanId": 7,
      "previousOrder": null,
      "referenceCode": null,
      "salesSupportUser": null,
      "startDate": 1481001027061,
      "status": "ACTIVE",
      "totalPrice": 0,
      "type": "NEW",
      "user": {
        "href": "http://appdirect/api/account/v1/users/091d24f6-7b0c-42a0-84ff-86e1cdcf893c",
        "id": "091d24f6-7b0c-42a0-84ff-86e1cdcf893c"
      }
    }
  ],
  "total": 1
}

GET /billing/v1/orders

List all purchase orders

Parameters

Parameter Type Data Type Default Description
order query string Order filter to be applied com.appdirect.backend.api.billing.types.PurchaseOrderApiFilter.
page query integer 0 First result index. Used for paging.
referenceCode query string Code provided by resellers and Sales Reps while purchasing a subscription
size query integer 250 Number of results to fetch. Used for paging.
sortField query string of enum:
DATE
ORDER_ID
TOTAL
DATE The filed to be used for sorting com.appdirect.backend.api.billing.types.OrderSortWS.
sortOrder query string of enum:
ASC
DESC
ASC Sort order org.springframework.data.domain.Sort.Direction.

Responses

Status Meaning Description Definition
200 OK OK OrderListing
404 Not Found Not Found

Retrieve a purchase order

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/orders/{orderId} \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/orders/{orderId} HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/orders/{orderId}',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/orders/{orderId}',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/orders/{orderId}',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/orders/{orderId}',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/orders/{orderId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

{
  "activated": false,
  "company": {
    "href": "http://appdirect/api/account/v1/companies/5df15aa3-a3f3-4c6f-a434-9a85545e9c95",
    "id": "5df15aa3-a3f3-4c6f-a434-9a85545e9c95"
  },
  "contract": null,
  "currency": "USD",
  "discount": null,
  "discountId": null,
  "endDate": null,
  "endOfDiscountDate": null,
  "frequency": "MONTHLY",
  "id": 4,
  "links": [
    {
      "href": "http://appdirect/api/billing/v1/subscriptions/6d2a0cb2-aa95-48d4-a0c3-37427164475e",
      "rel": "subscription"
    }
  ],
  "nextBillingDate": 1483679427061,
  "nextOrder": null,
  "oneTimeOrders": [],
  "orderLines": [],
  "parameters": [],
  "paymentPlan": {
    "allowCustomUsage": false,
    "contract": {
      "alignWithParentCycleStartDate": false,
      "autoExtensionPricingId": 7,
      "blockContractDowngrades": false,
      "blockContractUpgrades": false,
      "blockSwitchToShorterContract": false,
      "cancellationPeriodLimit": null,
      "endOfContractGracePeriod": null,
      "gracePeriod": null,
      "minimumServiceLength": 3,
      "terminationFee": null
    },
    "costs": [
      {
        "amount": {
          "USD": 10
        },
        "blockContractDecrease": false,
        "blockContractIncrease": false,
        "blockOriginalContractDecrease": false,
        "id": 7,
        "increment": 1,
        "maxUnits": null,
        "meteredUsage": false,
        "minUnits": 0,
        "pricePerIncrement": false,
        "pricingStrategy": "UNIT",
        "unit": "USER",
        "unitDependency": null
      }
    ],
    "discount": null,
    "frequency": "MONTHLY",
    "href": "http://appdirect/api/marketplace/v1/products/4/editions/4/paymentPlans/7",
    "id": 7,
    "isPrimaryPrice": false,
    "keepBillDateOnUsageChange": false,
    "primaryPrice": false,
    "separatePrepaid": false,
    "uuid": "4e29be4a-142b-482f-938c-418720bfd092"
  },
  "paymentPlanId": 7,
  "previousOrder": null,
  "referenceCode": null,
  "salesSupportUser": null,
  "startDate": 1481001027061,
  "status": "ACTIVE",
  "totalPrice": 0,
  "type": "NEW",
  "user": {
    "href": "http://appdirect/api/account/v1/users/091d24f6-7b0c-42a0-84ff-86e1cdcf893c",
    "id": "091d24f6-7b0c-42a0-84ff-86e1cdcf893c"
  }
}

GET /billing/v1/orders/{orderId}

Retrieve a purchase order

Parameters

Parameter Type Data Type Default Description
*orderId path number The specific order id for which information is requested
expand query array of string Provide the list of comma separated resource name (possible values = "user,company,salesSupportUser") which is needed to be expanded in the response

Responses

Status Meaning Description Definition
200 OK OK Order
404 Not Found Not Found

List all purchase order invoices

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/orders/{orderId}/invoices \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/orders/{orderId}/invoices HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/orders/{orderId}/invoices',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/orders/{orderId}/invoices',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/orders/{orderId}/invoices',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/orders/{orderId}/invoices',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/orders/{orderId}/invoices");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

[
  {
    "company": {
      "href": "http://appdirect/api/account/v1/companies/5df15aa3-a3f3-4c6f-a434-9a85545e9c95",
      "id": "5df15aa3-a3f3-4c6f-a434-9a85545e9c95"
    },
    "creationDate": 1481001027061,
    "currency": "USD",
    "dueDate": 1481353200000,
    "invoiceId": 16,
    "links": [
      {
        "href": "http://appdirect/api/account/v2/users/091d24f6-7b0c-42a0-84ff-86e1cdcf893c",
        "rel": "user"
      },
      {
        "href": "http://appdirect/api/account/v2/companies/5df15aa3-a3f3-4c6f-a434-9a85545e9c95",
        "rel": "company"
      },
      {
        "href": "http://appdirect/api/billing/v1/invoices/16",
        "rel": "self"
      }
    ],
    "orderIds": [
      "3754"
    ],
    "referenceNumber": null,
    "status": "PAID",
    "total": 10,
    "user": {
      "href": "http://appdirect/api/account/v1/users/091d24f6-7b0c-42a0-84ff-86e1cdcf893c",
      "id": "091d24f6-7b0c-42a0-84ff-86e1cdcf893c"
    }
  }
]

GET /billing/v1/orders/{orderId}/invoices

List all purchase order invoices

Parameters

Parameter Type Data Type Default Description
*orderId path number The specific order id for which information is requested
count query string 250 Number of results to fetch. Used for paging.
excludeFree query boolean Exclude invoices whose amount is zero
fromDate query number Filter by the start date of the invoice
sortField query string of enum:
DATE
INVOICE_ID
TOTAL
INVOICE_ID The filed to be used for sorting com.appdirect.backend.api.billing.types.OrderSortWS.
sortOrder query string of enum:
ASC
DESC
ASC Sort order org.springframework.data.domain.Sort.Direction.
start query string 0 First result index. Used for paging.
status query string of enum:
CARRIED
PAID
UNPAID
VOIDED
Filter by the status of the invoice
toDate query number Filter by the end date of the invoice

Responses

Status Meaning Description Definition
200 OK OK InvoiceListing
404 Not Found Not Found

List all purchase order payments

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/orders/{orderId}/payments \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/orders/{orderId}/payments HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/orders/{orderId}/payments',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/orders/{orderId}/payments',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/orders/{orderId}/payments',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/orders/{orderId}/payments',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/orders/{orderId}/payments");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

[
  {
    "amount": 10,
    "company": {
      "href": "http://appdirect/api/account/v1/companies/5df15aa3-a3f3-4c6f-a434-9a85545e9c95",
      "id": "5df15aa3-a3f3-4c6f-a434-9a85545e9c95"
    },
    "currency": "USD",
    "date": 1481001027061,
    "gatewayResponse": {
      "avs": true,
      "code": null,
      "cvv": true,
      "message": null
    },
    "links": [
      {
        "href": "http://appdirect/api/billing/v1/payments/17",
        "rel": "self"
      }
    ],
    "method": "CREDIT_CARD",
    "paymentNumber": 17,
    "result": "SUCCESSFUL",
    "transactionId": "123456abcdef",
    "user": {
      "href": "http://appdirect/api/account/v1/users/091d24f6-7b0c-42a0-84ff-86e1cdcf893c",
      "id": "091d24f6-7b0c-42a0-84ff-86e1cdcf893c"
    }
  }
]

GET /billing/v1/orders/{orderId}/payments

List all purchase order payments

Parameters

Parameter Type Data Type Default Description
*orderId path number The specific order id for which information is requested
count query string 250 Number of results to fetch. Used for paging.
fromDate query number Filter by the start date of the invoice
method query string of enum:
ADP_INVOICE
ARIBAPAY
BT_BILL
CLICKANDBUY
CLOUDFOUNDRY
CREDIT_CARD
CUMULA_BILL
DTAG
EXTERNAL_INVOICE
KREDITKARTE
LASTSCHRIFT_MRNEXNET
MANO_TEO_BILL
MANUAL
MARKETPLACE_CREDITS
NETS_ARVATO_INVOICE
NEXTEL
PAYPAL
ROGERS_CC_DTMF
ROGERS_CC_POS
SNAP
TBILL
THISTLE
TOICLEARING
Filter by method of the payment
result query string of enum:
FAILED
GATEWAY_NOT_AVAILABLE
MANUAL
SUCCESSFUL
Filter by results of the payment
sortField query string of enum:
AMOUNT
DATE
PAYMENT_ID
PAYMENT_ID The filed to be used for sorting com.appdirect.backend.api.billing.types.OrderSortWS.
sortOrder query string of enum:
ASC
DESC
ASC Sort order org.springframework.data.domain.Sort.Direction.
start query string 0 First result index. Used for paging.
toDate query number Filter by the end date of the invoice

Responses

Status Meaning Description Definition
200 OK OK Payment
404 Not Found Not Found

Update purchase order configuration details

Example request


curl -X put https://{marketplaceURL}/api/billing/v1/orders/{orderId}/parameters \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

PUT https://{marketplaceURL}/api/billing/v1/orders/{orderId}/parameters HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/orders/{orderId}/parameters',
  method: 'put',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/orders/{orderId}/parameters',
{
  method: 'PUT',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.put 'https://{marketplaceURL}/api/billing/v1/orders/{orderId}/parameters',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.put('https://{marketplaceURL}/api/billing/v1/orders/{orderId}/parameters',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/orders/{orderId}/parameters");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

PUT /billing/v1/orders/{orderId}/parameters

Update purchase order configuration details

Parameters

Parameter Type Data Type Default Description
*orderId path number Id of the specific purchase order to update

Body Parameters

List of parameters which needs to be update

Array of Parameter:

Property Type Description
name string
value string

Responses

Status Meaning Description Definition
200 OK OK

Update a purchase order

Example request


curl -X patch \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data-binary @- https://{marketplaceURL}/api/billing/v1/orders/{orderId} <<EOF
{
  "_embedded": {
    "property1": {},
    "property2": {}
  },
  "activated": true,
  "company": {
    "href": "...",
    "id": "..."
  },
  "contract": {},
  "currency": "...",
  "customAttribute": [
    {
      "attributeType": "TEXT",
      "name": "...",
      "value": "...",
      "valueKeys": [
        "...",
        "..."
      ]
    },
    {
      "attributeType": "MULTISELECT",
      "name": "...",
      "value": "...",
      "valueKeys": [
        "...",
        "..."
      ]
    }
  ],
  "discount": {
    "href": "...",
    "id": "..."
  },
  "discountId": 12345,
  "endDate": 12345,
  "endOfDiscountDate": 12345,
  "frequency": "...",
  "id": 12345,
  "links": [
    {
      "href": "...",
      "rel": "..."
    },
    {
      "href": "...",
      "rel": "..."
    }
  ],
  "nextBillingDate": 12345,
  "nextOrder": {
    "href": "...",
    "id": "..."
  },
  "oneTimeOrder": [
    {
      "_embedded": {
        "property1": {},
        "property2": {}
      },
      "company": {
        "href": "...",
        "id": "..."
      },
      "currency": "...",
      "endDate": 12345,
      "endOfDiscountDate": 12345,
      "frequency": "...",
      "id": 12345,
      "links": [
        {
          "href": "...",
          "rel": "..."
        },
        {
          "href": "...",
          "rel": "..."
        }
      ],
      "nextBillingDate": 12345,
      "paymentPlan": {
        "href": "...",
        "id": "..."
      },
      "referenceCode": "...",
      "salesSupportUser": {
        "href": "...",
        "id": "..."
      },
      "startDate": 12345,
      "status": "...",
      "totalPrice": 12345,
      "type": "...",
      "user": {
        "href": "...",
        "id": "..."
      }
    },
    {
      "_embedded": {
        "property1": {},
        "property2": {}
      },
      "company": {
        "href": "...",
        "id": "..."
      },
      "currency": "...",
      "endDate": 12345,
      "endOfDiscountDate": 12345,
      "frequency": "...",
      "id": 12345,
      "links": [
        {
          "href": "...",
          "rel": "..."
        },
        {
          "href": "...",
          "rel": "..."
        }
      ],
      "nextBillingDate": 12345,
      "paymentPlan": {
        "href": "...",
        "id": "..."
      },
      "referenceCode": "...",
      "salesSupportUser": {
        "href": "...",
        "id": "..."
      },
      "startDate": 12345,
      "status": "...",
      "totalPrice": 12345,
      "type": "...",
      "user": {
        "href": "...",
        "id": "..."
      }
    }
  ],
  "orderLine": [
    {},
    {}
  ],
  "parameter": [
    {
      "name": "...",
      "value": "..."
    },
    {
      "name": "...",
      "value": "..."
    }
  ],
  "paymentPlan": {
    "allowCustomUsage": true,
    "contract": {
      "alignWithParentCycleStartDate": true,
      "autoExtensionPricingId": 12345,
      "blockContractDowngrades": true,
      "blockContractUpgrades": true,
      "blockSwitchToShorterContract": true,
      "cancellationPeriodLimit": 12345,
      "endOfContractGracePeriod": 12345,
      "gracePeriod": {},
      "minimumServiceLength": 12345,
      "terminationFee": {}
    },
    "cost": [
      {
        "amount": {},
        "blockContractDecrease": true,
        "blockContractIncrease": true,
        "blockOriginalContractDecrease": true,
        "editionPricingItemId": 12345,
        "id": 12345,
        "increment": 12345,
        "maxUnits": 12345,
        "meteredUsage": true,
        "minUnits": 12345,
        "pricePerIncrement": true,
        "pricingStrategy": "...",
        "unit": "...",
        "unitDependency": "..."
      },
      {
        "amount": {},
        "blockContractDecrease": true,
        "blockContractIncrease": true,
        "blockOriginalContractDecrease": true,
        "editionPricingItemId": 12345,
        "id": 12345,
        "increment": 12345,
        "maxUnits": 12345,
        "meteredUsage": true,
        "minUnits": 12345,
        "pricePerIncrement": true,
        "pricingStrategy": "...",
        "unit": "...",
        "unitDependency": "..."
      }
    ],
    "discount": {
      "amount": {},
      "availableRedemptions": 12345,
      "description": "...",
      "expirationDate": 12345,
      "numOfBillingCycles": 12345,
      "percentage": 12345,
      "pricingUnit": "CALLING_FEATURE",
      "startDate": 12345
    },
    "frequency": "...",
    "href": "...",
    "id": 12345,
    "isPrimaryPrice": true,
    "keepBillDateOnUsageChange": true,
    "primaryPrice": true,
    "separatePrepaid": true,
    "tld": "...",
    "uuid": "..."
  },
  "paymentPlanId": 12345,
  "previousOrder": {
    "href": "...",
    "id": "..."
  },
  "referenceCode": "...",
  "salesSupportUser": {
    "href": "...",
    "id": "..."
  },
  "startDate": 12345,
  "status": "...",
  "totalPrice": 12345,
  "type": "...",
  "user": {
    "href": "...",
    "id": "..."
  }
}
EOF

PATCH https://{marketplaceURL}/api/billing/v1/orders/{orderId} HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json

{
  "_embedded": {
    "property1": {},
    "property2": {}
  },
  "activated": true,
  "company": {
    "href": "...",
    "id": "..."
  },
  "contract": {},
  "currency": "...",
  "customAttribute": [
    {
      "attributeType": "TEXT",
      "name": "...",
      "value": "...",
      "valueKeys": [
        "...",
        "..."
      ]
    },
    {
      "attributeType": "MULTISELECT",
      "name": "...",
      "value": "...",
      "valueKeys": [
        "...",
        "..."
      ]
    }
  ],
  "discount": {
    "href": "...",
    "id": "..."
  },
  "discountId": 12345,
  "endDate": 12345,
  "endOfDiscountDate": 12345,
  "frequency": "...",
  "id": 12345,
  "links": [
    {
      "href": "...",
      "rel": "..."
    },
    {
      "href": "...",
      "rel": "..."
    }
  ],
  "nextBillingDate": 12345,
  "nextOrder": {
    "href": "...",
    "id": "..."
  },
  "oneTimeOrder": [
    {
      "_embedded": {
        "property1": {},
        "property2": {}
      },
      "company": {
        "href": "...",
        "id": "..."
      },
      "currency": "...",
      "endDate": 12345,
      "endOfDiscountDate": 12345,
      "frequency": "...",
      "id": 12345,
      "links": [
        {
          "href": "...",
          "rel": "..."
        },
        {
          "href": "...",
          "rel": "..."
        }
      ],
      "nextBillingDate": 12345,
      "paymentPlan": {
        "href": "...",
        "id": "..."
      },
      "referenceCode": "...",
      "salesSupportUser": {
        "href": "...",
        "id": "..."
      },
      "startDate": 12345,
      "status": "...",
      "totalPrice": 12345,
      "type": "...",
      "user": {
        "href": "...",
        "id": "..."
      }
    },
    {
      "_embedded": {
        "property1": {},
        "property2": {}
      },
      "company": {
        "href": "...",
        "id": "..."
      },
      "currency": "...",
      "endDate": 12345,
      "endOfDiscountDate": 12345,
      "frequency": "...",
      "id": 12345,
      "links": [
        {
          "href": "...",
          "rel": "..."
        },
        {
          "href": "...",
          "rel": "..."
        }
      ],
      "nextBillingDate": 12345,
      "paymentPlan": {
        "href": "...",
        "id": "..."
      },
      "referenceCode": "...",
      "salesSupportUser": {
        "href": "...",
        "id": "..."
      },
      "startDate": 12345,
      "status": "...",
      "totalPrice": 12345,
      "type": "...",
      "user": {
        "href": "...",
        "id": "..."
      }
    }
  ],
  "orderLine": [
    {},
    {}
  ],
  "parameter": [
    {
      "name": "...",
      "value": "..."
    },
    {
      "name": "...",
      "value": "..."
    }
  ],
  "paymentPlan": {
    "allowCustomUsage": true,
    "contract": {
      "alignWithParentCycleStartDate": true,
      "autoExtensionPricingId": 12345,
      "blockContractDowngrades": true,
      "blockContractUpgrades": true,
      "blockSwitchToShorterContract": true,
      "cancellationPeriodLimit": 12345,
      "endOfContractGracePeriod": 12345,
      "gracePeriod": {},
      "minimumServiceLength": 12345,
      "terminationFee": {}
    },
    "cost": [
      {
        "amount": {},
        "blockContractDecrease": true,
        "blockContractIncrease": true,
        "blockOriginalContractDecrease": true,
        "editionPricingItemId": 12345,
        "id": 12345,
        "increment": 12345,
        "maxUnits": 12345,
        "meteredUsage": true,
        "minUnits": 12345,
        "pricePerIncrement": true,
        "pricingStrategy": "...",
        "unit": "...",
        "unitDependency": "..."
      },
      {
        "amount": {},
        "blockContractDecrease": true,
        "blockContractIncrease": true,
        "blockOriginalContractDecrease": true,
        "editionPricingItemId": 12345,
        "id": 12345,
        "increment": 12345,
        "maxUnits": 12345,
        "meteredUsage": true,
        "minUnits": 12345,
        "pricePerIncrement": true,
        "pricingStrategy": "...",
        "unit": "...",
        "unitDependency": "..."
      }
    ],
    "discount": {
      "amount": {},
      "availableRedemptions": 12345,
      "description": "...",
      "expirationDate": 12345,
      "numOfBillingCycles": 12345,
      "percentage": 12345,
      "pricingUnit": "CALLING_FEATURE",
      "startDate": 12345
    },
    "frequency": "...",
    "href": "...",
    "id": 12345,
    "isPrimaryPrice": true,
    "keepBillDateOnUsageChange": true,
    "primaryPrice": true,
    "separatePrepaid": true,
    "tld": "...",
    "uuid": "..."
  },
  "paymentPlanId": 12345,
  "previousOrder": {
    "href": "...",
    "id": "..."
  },
  "referenceCode": "...",
  "salesSupportUser": {
    "href": "...",
    "id": "..."
  },
  "startDate": 12345,
  "status": "...",
  "totalPrice": 12345,
  "type": "...",
  "user": {
    "href": "...",
    "id": "..."
  }
}


var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/orders/{orderId}',
  method: 'patch',
  dataType: 'json',
  data: {
  "_embedded": {
    "property1": {},
    "property2": {}
  },
  "activated": true,
  "company": {
    "href": "...",
    "id": "..."
  },
  "contract": {},
  "currency": "...",
  "customAttribute": [
    {
      "attributeType": "TEXT",
      "name": "...",
      "value": "...",
      "valueKeys": [
        "...",
        "..."
      ]
    },
    {
      "attributeType": "MULTISELECT",
      "name": "...",
      "value": "...",
      "valueKeys": [
        "...",
        "..."
      ]
    }
  ],
  "discount": {
    "href": "...",
    "id": "..."
  },
  "discountId": 12345,
  "endDate": 12345,
  "endOfDiscountDate": 12345,
  "frequency": "...",
  "id": 12345,
  "links": [
    {
      "href": "...",
      "rel": "..."
    },
    {
      "href": "...",
      "rel": "..."
    }
  ],
  "nextBillingDate": 12345,
  "nextOrder": {
    "href": "...",
    "id": "..."
  },
  "oneTimeOrder": [
    {
      "_embedded": {
        "property1": {},
        "property2": {}
      },
      "company": {
        "href": "...",
        "id": "..."
      },
      "currency": "...",
      "endDate": 12345,
      "endOfDiscountDate": 12345,
      "frequency": "...",
      "id": 12345,
      "links": [
        {
          "href": "...",
          "rel": "..."
        },
        {
          "href": "...",
          "rel": "..."
        }
      ],
      "nextBillingDate": 12345,
      "paymentPlan": {
        "href": "...",
        "id": "..."
      },
      "referenceCode": "...",
      "salesSupportUser": {
        "href": "...",
        "id": "..."
      },
      "startDate": 12345,
      "status": "...",
      "totalPrice": 12345,
      "type": "...",
      "user": {
        "href": "...",
        "id": "..."
      }
    },
    {
      "_embedded": {
        "property1": {},
        "property2": {}
      },
      "company": {
        "href": "...",
        "id": "..."
      },
      "currency": "...",
      "endDate": 12345,
      "endOfDiscountDate": 12345,
      "frequency": "...",
      "id": 12345,
      "links": [
        {
          "href": "...",
          "rel": "..."
        },
        {
          "href": "...",
          "rel": "..."
        }
      ],
      "nextBillingDate": 12345,
      "paymentPlan": {
        "href": "...",
        "id": "..."
      },
      "referenceCode": "...",
      "salesSupportUser": {
        "href": "...",
        "id": "..."
      },
      "startDate": 12345,
      "status": "...",
      "totalPrice": 12345,
      "type": "...",
      "user": {
        "href": "...",
        "id": "..."
      }
    }
  ],
  "orderLine": [
    {},
    {}
  ],
  "parameter": [
    {
      "name": "...",
      "value": "..."
    },
    {
      "name": "...",
      "value": "..."
    }
  ],
  "paymentPlan": {
    "allowCustomUsage": true,
    "contract": {
      "alignWithParentCycleStartDate": true,
      "autoExtensionPricingId": 12345,
      "blockContractDowngrades": true,
      "blockContractUpgrades": true,
      "blockSwitchToShorterContract": true,
      "cancellationPeriodLimit": 12345,
      "endOfContractGracePeriod": 12345,
      "gracePeriod": {},
      "minimumServiceLength": 12345,
      "terminationFee": {}
    },
    "cost": [
      {
        "amount": {},
        "blockContractDecrease": true,
        "blockContractIncrease": true,
        "blockOriginalContractDecrease": true,
        "editionPricingItemId": 12345,
        "id": 12345,
        "increment": 12345,
        "maxUnits": 12345,
        "meteredUsage": true,
        "minUnits": 12345,
        "pricePerIncrement": true,
        "pricingStrategy": "...",
        "unit": "...",
        "unitDependency": "..."
      },
      {
        "amount": {},
        "blockContractDecrease": true,
        "blockContractIncrease": true,
        "blockOriginalContractDecrease": true,
        "editionPricingItemId": 12345,
        "id": 12345,
        "increment": 12345,
        "maxUnits": 12345,
        "meteredUsage": true,
        "minUnits": 12345,
        "pricePerIncrement": true,
        "pricingStrategy": "...",
        "unit": "...",
        "unitDependency": "..."
      }
    ],
    "discount": {
      "amount": {},
      "availableRedemptions": 12345,
      "description": "...",
      "expirationDate": 12345,
      "numOfBillingCycles": 12345,
      "percentage": 12345,
      "pricingUnit": "CALLING_FEATURE",
      "startDate": 12345
    },
    "frequency": "...",
    "href": "...",
    "id": 12345,
    "isPrimaryPrice": true,
    "keepBillDateOnUsageChange": true,
    "primaryPrice": true,
    "separatePrepaid": true,
    "tld": "...",
    "uuid": "..."
  },
  "paymentPlanId": 12345,
  "previousOrder": {
    "href": "...",
    "id": "..."
  },
  "referenceCode": "...",
  "salesSupportUser": {
    "href": "...",
    "id": "..."
  },
  "startDate": 12345,
  "status": "...",
  "totalPrice": 12345,
  "type": "...",
  "user": {
    "href": "...",
    "id": "..."
  }
},

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const inputBody = '{
  "_embedded": {
    "property1": {},
    "property2": {}
  },
  "activated": true,
  "company": {
    "href": "...",
    "id": "..."
  },
  "contract": {},
  "currency": "...",
  "customAttribute": [
    {
      "attributeType": "TEXT",
      "name": "...",
      "value": "...",
      "valueKeys": [
        "...",
        "..."
      ]
    },
    {
      "attributeType": "MULTISELECT",
      "name": "...",
      "value": "...",
      "valueKeys": [
        "...",
        "..."
      ]
    }
  ],
  "discount": {
    "href": "...",
    "id": "..."
  },
  "discountId": 12345,
  "endDate": 12345,
  "endOfDiscountDate": 12345,
  "frequency": "...",
  "id": 12345,
  "links": [
    {
      "href": "...",
      "rel": "..."
    },
    {
      "href": "...",
      "rel": "..."
    }
  ],
  "nextBillingDate": 12345,
  "nextOrder": {
    "href": "...",
    "id": "..."
  },
  "oneTimeOrder": [
    {
      "_embedded": {
        "property1": {},
        "property2": {}
      },
      "company": {
        "href": "...",
        "id": "..."
      },
      "currency": "...",
      "endDate": 12345,
      "endOfDiscountDate": 12345,
      "frequency": "...",
      "id": 12345,
      "links": [
        {
          "href": "...",
          "rel": "..."
        },
        {
          "href": "...",
          "rel": "..."
        }
      ],
      "nextBillingDate": 12345,
      "paymentPlan": {
        "href": "...",
        "id": "..."
      },
      "referenceCode": "...",
      "salesSupportUser": {
        "href": "...",
        "id": "..."
      },
      "startDate": 12345,
      "status": "...",
      "totalPrice": 12345,
      "type": "...",
      "user": {
        "href": "...",
        "id": "..."
      }
    },
    {
      "_embedded": {
        "property1": {},
        "property2": {}
      },
      "company": {
        "href": "...",
        "id": "..."
      },
      "currency": "...",
      "endDate": 12345,
      "endOfDiscountDate": 12345,
      "frequency": "...",
      "id": 12345,
      "links": [
        {
          "href": "...",
          "rel": "..."
        },
        {
          "href": "...",
          "rel": "..."
        }
      ],
      "nextBillingDate": 12345,
      "paymentPlan": {
        "href": "...",
        "id": "..."
      },
      "referenceCode": "...",
      "salesSupportUser": {
        "href": "...",
        "id": "..."
      },
      "startDate": 12345,
      "status": "...",
      "totalPrice": 12345,
      "type": "...",
      "user": {
        "href": "...",
        "id": "..."
      }
    }
  ],
  "orderLine": [
    {},
    {}
  ],
  "parameter": [
    {
      "name": "...",
      "value": "..."
    },
    {
      "name": "...",
      "value": "..."
    }
  ],
  "paymentPlan": {
    "allowCustomUsage": true,
    "contract": {
      "alignWithParentCycleStartDate": true,
      "autoExtensionPricingId": 12345,
      "blockContractDowngrades": true,
      "blockContractUpgrades": true,
      "blockSwitchToShorterContract": true,
      "cancellationPeriodLimit": 12345,
      "endOfContractGracePeriod": 12345,
      "gracePeriod": {},
      "minimumServiceLength": 12345,
      "terminationFee": {}
    },
    "cost": [
      {
        "amount": {},
        "blockContractDecrease": true,
        "blockContractIncrease": true,
        "blockOriginalContractDecrease": true,
        "editionPricingItemId": 12345,
        "id": 12345,
        "increment": 12345,
        "maxUnits": 12345,
        "meteredUsage": true,
        "minUnits": 12345,
        "pricePerIncrement": true,
        "pricingStrategy": "...",
        "unit": "...",
        "unitDependency": "..."
      },
      {
        "amount": {},
        "blockContractDecrease": true,
        "blockContractIncrease": true,
        "blockOriginalContractDecrease": true,
        "editionPricingItemId": 12345,
        "id": 12345,
        "increment": 12345,
        "maxUnits": 12345,
        "meteredUsage": true,
        "minUnits": 12345,
        "pricePerIncrement": true,
        "pricingStrategy": "...",
        "unit": "...",
        "unitDependency": "..."
      }
    ],
    "discount": {
      "amount": {},
      "availableRedemptions": 12345,
      "description": "...",
      "expirationDate": 12345,
      "numOfBillingCycles": 12345,
      "percentage": 12345,
      "pricingUnit": "CALLING_FEATURE",
      "startDate": 12345
    },
    "frequency": "...",
    "href": "...",
    "id": 12345,
    "isPrimaryPrice": true,
    "keepBillDateOnUsageChange": true,
    "primaryPrice": true,
    "separatePrepaid": true,
    "tld": "...",
    "uuid": "..."
  },
  "paymentPlanId": 12345,
  "previousOrder": {
    "href": "...",
    "id": "..."
  },
  "referenceCode": "...",
  "salesSupportUser": {
    "href": "...",
    "id": "..."
  },
  "startDate": 12345,
  "status": "...",
  "totalPrice": 12345,
  "type": "...",
  "user": {
    "href": "...",
    "id": "..."
  }
}';
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/orders/{orderId}',
{
  method: 'PATCH',body: inputBody,headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.patch 'https://{marketplaceURL}/api/billing/v1/orders/{orderId}',
payload={
  "_embedded": {
    "property1": {},
    "property2": {}
  },
  "activated": true,
  "company": {
    "href": "...",
    "id": "..."
  },
  "contract": {},
  "currency": "...",
  "customAttribute": [
    {
      "attributeType": "TEXT",
      "name": "...",
      "value": "...",
      "valueKeys": [
        "...",
        "..."
      ]
    },
    {
      "attributeType": "MULTISELECT",
      "name": "...",
      "value": "...",
      "valueKeys": [
        "...",
        "..."
      ]
    }
  ],
  "discount": {
    "href": "...",
    "id": "..."
  },
  "discountId": 12345,
  "endDate": 12345,
  "endOfDiscountDate": 12345,
  "frequency": "...",
  "id": 12345,
  "links": [
    {
      "href": "...",
      "rel": "..."
    },
    {
      "href": "...",
      "rel": "..."
    }
  ],
  "nextBillingDate": 12345,
  "nextOrder": {
    "href": "...",
    "id": "..."
  },
  "oneTimeOrder": [
    {
      "_embedded": {
        "property1": {},
        "property2": {}
      },
      "company": {
        "href": "...",
        "id": "..."
      },
      "currency": "...",
      "endDate": 12345,
      "endOfDiscountDate": 12345,
      "frequency": "...",
      "id": 12345,
      "links": [
        {
          "href": "...",
          "rel": "..."
        },
        {
          "href": "...",
          "rel": "..."
        }
      ],
      "nextBillingDate": 12345,
      "paymentPlan": {
        "href": "...",
        "id": "..."
      },
      "referenceCode": "...",
      "salesSupportUser": {
        "href": "...",
        "id": "..."
      },
      "startDate": 12345,
      "status": "...",
      "totalPrice": 12345,
      "type": "...",
      "user": {
        "href": "...",
        "id": "..."
      }
    },
    {
      "_embedded": {
        "property1": {},
        "property2": {}
      },
      "company": {
        "href": "...",
        "id": "..."
      },
      "currency": "...",
      "endDate": 12345,
      "endOfDiscountDate": 12345,
      "frequency": "...",
      "id": 12345,
      "links": [
        {
          "href": "...",
          "rel": "..."
        },
        {
          "href": "...",
          "rel": "..."
        }
      ],
      "nextBillingDate": 12345,
      "paymentPlan": {
        "href": "...",
        "id": "..."
      },
      "referenceCode": "...",
      "salesSupportUser": {
        "href": "...",
        "id": "..."
      },
      "startDate": 12345,
      "status": "...",
      "totalPrice": 12345,
      "type": "...",
      "user": {
        "href": "...",
        "id": "..."
      }
    }
  ],
  "orderLine": [
    {},
    {}
  ],
  "parameter": [
    {
      "name": "...",
      "value": "..."
    },
    {
      "name": "...",
      "value": "..."
    }
  ],
  "paymentPlan": {
    "allowCustomUsage": true,
    "contract": {
      "alignWithParentCycleStartDate": true,
      "autoExtensionPricingId": 12345,
      "blockContractDowngrades": true,
      "blockContractUpgrades": true,
      "blockSwitchToShorterContract": true,
      "cancellationPeriodLimit": 12345,
      "endOfContractGracePeriod": 12345,
      "gracePeriod": {},
      "minimumServiceLength": 12345,
      "terminationFee": {}
    },
    "cost": [
      {
        "amount": {},
        "blockContractDecrease": true,
        "blockContractIncrease": true,
        "blockOriginalContractDecrease": true,
        "editionPricingItemId": 12345,
        "id": 12345,
        "increment": 12345,
        "maxUnits": 12345,
        "meteredUsage": true,
        "minUnits": 12345,
        "pricePerIncrement": true,
        "pricingStrategy": "...",
        "unit": "...",
        "unitDependency": "..."
      },
      {
        "amount": {},
        "blockContractDecrease": true,
        "blockContractIncrease": true,
        "blockOriginalContractDecrease": true,
        "editionPricingItemId": 12345,
        "id": 12345,
        "increment": 12345,
        "maxUnits": 12345,
        "meteredUsage": true,
        "minUnits": 12345,
        "pricePerIncrement": true,
        "pricingStrategy": "...",
        "unit": "...",
        "unitDependency": "..."
      }
    ],
    "discount": {
      "amount": {},
      "availableRedemptions": 12345,
      "description": "...",
      "expirationDate": 12345,
      "numOfBillingCycles": 12345,
      "percentage": 12345,
      "pricingUnit": "CALLING_FEATURE",
      "startDate": 12345
    },
    "frequency": "...",
    "href": "...",
    "id": 12345,
    "isPrimaryPrice": true,
    "keepBillDateOnUsageChange": true,
    "primaryPrice": true,
    "separatePrepaid": true,
    "tld": "...",
    "uuid": "..."
  },
  "paymentPlanId": 12345,
  "previousOrder": {
    "href": "...",
    "id": "..."
  },
  "referenceCode": "...",
  "salesSupportUser": {
    "href": "...",
    "id": "..."
  },
  "startDate": 12345,
  "status": "...",
  "totalPrice": 12345,
  "type": "...",
  "user": {
    "href": "...",
    "id": "..."
  }
}
params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.patch('https://{marketplaceURL}/api/billing/v1/orders/{orderId}',
json={
  "_embedded": {
    "property1": {},
    "property2": {}
  },
  "activated": true,
  "company": {
    "href": "...",
    "id": "..."
  },
  "contract": {},
  "currency": "...",
  "customAttribute": [
    {
      "attributeType": "TEXT",
      "name": "...",
      "value": "...",
      "valueKeys": [
        "...",
        "..."
      ]
    },
    {
      "attributeType": "MULTISELECT",
      "name": "...",
      "value": "...",
      "valueKeys": [
        "...",
        "..."
      ]
    }
  ],
  "discount": {
    "href": "...",
    "id": "..."
  },
  "discountId": 12345,
  "endDate": 12345,
  "endOfDiscountDate": 12345,
  "frequency": "...",
  "id": 12345,
  "links": [
    {
      "href": "...",
      "rel": "..."
    },
    {
      "href": "...",
      "rel": "..."
    }
  ],
  "nextBillingDate": 12345,
  "nextOrder": {
    "href": "...",
    "id": "..."
  },
  "oneTimeOrder": [
    {
      "_embedded": {
        "property1": {},
        "property2": {}
      },
      "company": {
        "href": "...",
        "id": "..."
      },
      "currency": "...",
      "endDate": 12345,
      "endOfDiscountDate": 12345,
      "frequency": "...",
      "id": 12345,
      "links": [
        {
          "href": "...",
          "rel": "..."
        },
        {
          "href": "...",
          "rel": "..."
        }
      ],
      "nextBillingDate": 12345,
      "paymentPlan": {
        "href": "...",
        "id": "..."
      },
      "referenceCode": "...",
      "salesSupportUser": {
        "href": "...",
        "id": "..."
      },
      "startDate": 12345,
      "status": "...",
      "totalPrice": 12345,
      "type": "...",
      "user": {
        "href": "...",
        "id": "..."
      }
    },
    {
      "_embedded": {
        "property1": {},
        "property2": {}
      },
      "company": {
        "href": "...",
        "id": "..."
      },
      "currency": "...",
      "endDate": 12345,
      "endOfDiscountDate": 12345,
      "frequency": "...",
      "id": 12345,
      "links": [
        {
          "href": "...",
          "rel": "..."
        },
        {
          "href": "...",
          "rel": "..."
        }
      ],
      "nextBillingDate": 12345,
      "paymentPlan": {
        "href": "...",
        "id": "..."
      },
      "referenceCode": "...",
      "salesSupportUser": {
        "href": "...",
        "id": "..."
      },
      "startDate": 12345,
      "status": "...",
      "totalPrice": 12345,
      "type": "...",
      "user": {
        "href": "...",
        "id": "..."
      }
    }
  ],
  "orderLine": [
    {},
    {}
  ],
  "parameter": [
    {
      "name": "...",
      "value": "..."
    },
    {
      "name": "...",
      "value": "..."
    }
  ],
  "paymentPlan": {
    "allowCustomUsage": true,
    "contract": {
      "alignWithParentCycleStartDate": true,
      "autoExtensionPricingId": 12345,
      "blockContractDowngrades": true,
      "blockContractUpgrades": true,
      "blockSwitchToShorterContract": true,
      "cancellationPeriodLimit": 12345,
      "endOfContractGracePeriod": 12345,
      "gracePeriod": {},
      "minimumServiceLength": 12345,
      "terminationFee": {}
    },
    "cost": [
      {
        "amount": {},
        "blockContractDecrease": true,
        "blockContractIncrease": true,
        "blockOriginalContractDecrease": true,
        "editionPricingItemId": 12345,
        "id": 12345,
        "increment": 12345,
        "maxUnits": 12345,
        "meteredUsage": true,
        "minUnits": 12345,
        "pricePerIncrement": true,
        "pricingStrategy": "...",
        "unit": "...",
        "unitDependency": "..."
      },
      {
        "amount": {},
        "blockContractDecrease": true,
        "blockContractIncrease": true,
        "blockOriginalContractDecrease": true,
        "editionPricingItemId": 12345,
        "id": 12345,
        "increment": 12345,
        "maxUnits": 12345,
        "meteredUsage": true,
        "minUnits": 12345,
        "pricePerIncrement": true,
        "pricingStrategy": "...",
        "unit": "...",
        "unitDependency": "..."
      }
    ],
    "discount": {
      "amount": {},
      "availableRedemptions": 12345,
      "description": "...",
      "expirationDate": 12345,
      "numOfBillingCycles": 12345,
      "percentage": 12345,
      "pricingUnit": "CALLING_FEATURE",
      "startDate": 12345
    },
    "frequency": "...",
    "href": "...",
    "id": 12345,
    "isPrimaryPrice": true,
    "keepBillDateOnUsageChange": true,
    "primaryPrice": true,
    "separatePrepaid": true,
    "tld": "...",
    "uuid": "..."
  },
  "paymentPlanId": 12345,
  "previousOrder": {
    "href": "...",
    "id": "..."
  },
  "referenceCode": "...",
  "salesSupportUser": {
    "href": "...",
    "id": "..."
  },
  "startDate": 12345,
  "status": "...",
  "totalPrice": 12345,
  "type": "...",
  "user": {
    "href": "...",
    "id": "..."
  }
}
params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/orders/{orderId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PATCH");
String inputBody = "{" +
  "\"_embedded\": {" +
    "\"property1\": {}," +
    "\"property2\": {}" +
  "}," +
  "\"activated\": true," +
  "\"company\": {" +
    "\"href\": \"...\"," +
    "\"id\": \"...\"" +
  "}," +
  "\"contract\": {}," +
  "\"currency\": \"...\"," +
  "\"customAttribute\": [" +
    "{" +
      "\"attributeType\": \"TEXT\"," +
      "\"name\": \"...\"," +
      "\"value\": \"...\"," +
      "\"valueKeys\": [" +
        "\"...\"," +
        "\"...\"" +
      "]" +
    "}," +
    "{" +
      "\"attributeType\": \"MULTISELECT\"," +
      "\"name\": \"...\"," +
      "\"value\": \"...\"," +
      "\"valueKeys\": [" +
        "\"...\"," +
        "\"...\"" +
      "]" +
    "}" +
  "]," +
  "\"discount\": {" +
    "\"href\": \"...\"," +
    "\"id\": \"...\"" +
  "}," +
  "\"discountId\": 12345," +
  "\"endDate\": 12345," +
  "\"endOfDiscountDate\": 12345," +
  "\"frequency\": \"...\"," +
  "\"id\": 12345," +
  "\"links\": [" +
    "{" +
      "\"href\": \"...\"," +
      "\"rel\": \"...\"" +
    "}," +
    "{" +
      "\"href\": \"...\"," +
      "\"rel\": \"...\"" +
    "}" +
  "]," +
  "\"nextBillingDate\": 12345," +
  "\"nextOrder\": {" +
    "\"href\": \"...\"," +
    "\"id\": \"...\"" +
  "}," +
  "\"oneTimeOrder\": [" +
    "{" +
      "\"_embedded\": {" +
        "\"property1\": {}," +
        "\"property2\": {}" +
      "}," +
      "\"company\": {" +
        "\"href\": \"...\"," +
        "\"id\": \"...\"" +
      "}," +
      "\"currency\": \"...\"," +
      "\"endDate\": 12345," +
      "\"endOfDiscountDate\": 12345," +
      "\"frequency\": \"...\"," +
      "\"id\": 12345," +
      "\"links\": [" +
        "{" +
          "\"href\": \"...\"," +
          "\"rel\": \"...\"" +
        "}," +
        "{" +
          "\"href\": \"...\"," +
          "\"rel\": \"...\"" +
        "}" +
      "]," +
      "\"nextBillingDate\": 12345," +
      "\"paymentPlan\": {" +
        "\"href\": \"...\"," +
        "\"id\": \"...\"" +
      "}," +
      "\"referenceCode\": \"...\"," +
      "\"salesSupportUser\": {" +
        "\"href\": \"...\"," +
        "\"id\": \"...\"" +
      "}," +
      "\"startDate\": 12345," +
      "\"status\": \"...\"," +
      "\"totalPrice\": 12345," +
      "\"type\": \"...\"," +
      "\"user\": {" +
        "\"href\": \"...\"," +
        "\"id\": \"...\"" +
      "}" +
    "}," +
    "{" +
      "\"_embedded\": {" +
        "\"property1\": {}," +
        "\"property2\": {}" +
      "}," +
      "\"company\": {" +
        "\"href\": \"...\"," +
        "\"id\": \"...\"" +
      "}," +
      "\"currency\": \"...\"," +
      "\"endDate\": 12345," +
      "\"endOfDiscountDate\": 12345," +
      "\"frequency\": \"...\"," +
      "\"id\": 12345," +
      "\"links\": [" +
        "{" +
          "\"href\": \"...\"," +
          "\"rel\": \"...\"" +
        "}," +
        "{" +
          "\"href\": \"...\"," +
          "\"rel\": \"...\"" +
        "}" +
      "]," +
      "\"nextBillingDate\": 12345," +
      "\"paymentPlan\": {" +
        "\"href\": \"...\"," +
        "\"id\": \"...\"" +
      "}," +
      "\"referenceCode\": \"...\"," +
      "\"salesSupportUser\": {" +
        "\"href\": \"...\"," +
        "\"id\": \"...\"" +
      "}," +
      "\"startDate\": 12345," +
      "\"status\": \"...\"," +
      "\"totalPrice\": 12345," +
      "\"type\": \"...\"," +
      "\"user\": {" +
        "\"href\": \"...\"," +
        "\"id\": \"...\"" +
      "}" +
    "}" +
  "]," +
  "\"orderLine\": [" +
    "{}," +
    "{}" +
  "]," +
  "\"parameter\": [" +
    "{" +
      "\"name\": \"...\"," +
      "\"value\": \"...\"" +
    "}," +
    "{" +
      "\"name\": \"...\"," +
      "\"value\": \"...\"" +
    "}" +
  "]," +
  "\"paymentPlan\": {" +
    "\"allowCustomUsage\": true," +
    "\"contract\": {" +
      "\"alignWithParentCycleStartDate\": true," +
      "\"autoExtensionPricingId\": 12345," +
      "\"blockContractDowngrades\": true," +
      "\"blockContractUpgrades\": true," +
      "\"blockSwitchToShorterContract\": true," +
      "\"cancellationPeriodLimit\": 12345," +
      "\"endOfContractGracePeriod\": 12345," +
      "\"gracePeriod\": {}," +
      "\"minimumServiceLength\": 12345," +
      "\"terminationFee\": {}" +
    "}," +
    "\"cost\": [" +
      "{" +
        "\"amount\": {}," +
        "\"blockContractDecrease\": true," +
        "\"blockContractIncrease\": true," +
        "\"blockOriginalContractDecrease\": true," +
        "\"editionPricingItemId\": 12345," +
        "\"id\": 12345," +
        "\"increment\": 12345," +
        "\"maxUnits\": 12345," +
        "\"meteredUsage\": true," +
        "\"minUnits\": 12345," +
        "\"pricePerIncrement\": true," +
        "\"pricingStrategy\": \"...\"," +
        "\"unit\": \"...\"," +
        "\"unitDependency\": \"...\"" +
      "}," +
      "{" +
        "\"amount\": {}," +
        "\"blockContractDecrease\": true," +
        "\"blockContractIncrease\": true," +
        "\"blockOriginalContractDecrease\": true," +
        "\"editionPricingItemId\": 12345," +
        "\"id\": 12345," +
        "\"increment\": 12345," +
        "\"maxUnits\": 12345," +
        "\"meteredUsage\": true," +
        "\"minUnits\": 12345," +
        "\"pricePerIncrement\": true," +
        "\"pricingStrategy\": \"...\"," +
        "\"unit\": \"...\"," +
        "\"unitDependency\": \"...\"" +
      "}" +
    "]," +
    "\"discount\": {" +
      "\"amount\": {}," +
      "\"availableRedemptions\": 12345," +
      "\"description\": \"...\"," +
      "\"expirationDate\": 12345," +
      "\"numOfBillingCycles\": 12345," +
      "\"percentage\": 12345," +
      "\"pricingUnit\": \"CALLING_FEATURE\"," +
      "\"startDate\": 12345" +
    "}," +
    "\"frequency\": \"...\"," +
    "\"href\": \"...\"," +
    "\"id\": 12345," +
    "\"isPrimaryPrice\": true," +
    "\"keepBillDateOnUsageChange\": true," +
    "\"primaryPrice\": true," +
    "\"separatePrepaid\": true," +
    "\"tld\": \"...\"," +
    "\"uuid\": \"...\"" +
  "}," +
  "\"paymentPlanId\": 12345," +
  "\"previousOrder\": {" +
    "\"href\": \"...\"," +
    "\"id\": \"...\"" +
  "}," +
  "\"referenceCode\": \"...\"," +
  "\"salesSupportUser\": {" +
    "\"href\": \"...\"," +
    "\"id\": \"...\"" +
  "}," +
  "\"startDate\": 12345," +
  "\"status\": \"...\"," +
  "\"totalPrice\": 12345," +
  "\"type\": \"...\"," +
  "\"user\": {" +
    "\"href\": \"...\"," +
    "\"id\": \"...\"" +
  "}" +
"}";

OutputStream os = conn.getOutputStream();
os.write(inputBody.getBytes("UTF-8"));
os.close();

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

{
  "activated": false,
  "company": null,
  "contract": null,
  "currency": "USD",
  "discount": null,
  "discountId": null,
  "endDate": null,
  "endOfDiscountDate": null,
  "frequency": "MONTHLY",
  "id": 6,
  "links": [
    {
      "href": "http://appdirect/api/billing/v1/subscriptions/34a0b642-bc11-4147-bf0e-3966e391064b",
      "rel": "subscription"
    }
  ],
  "nextBillingDate": 1483679429176,
  "nextOrder": null,
  "oneTimeOrders": [],
  "orderLines": [],
  "parameters": [],
  "paymentPlan": {
    "allowCustomUsage": false,
    "contract": {
      "alignWithParentCycleStartDate": false,
      "autoExtensionPricingId": 11,
      "blockContractDowngrades": false,
      "blockContractUpgrades": false,
      "blockSwitchToShorterContract": false,
      "cancellationPeriodLimit": null,
      "endOfContractGracePeriod": null,
      "gracePeriod": null,
      "minimumServiceLength": 3,
      "terminationFee": null
    },
    "costs": [
      {
        "amount": {
          "USD": 10
        },
        "blockContractDecrease": false,
        "blockContractIncrease": false,
        "blockOriginalContractDecrease": false,
        "id": 11,
        "increment": 1,
        "maxUnits": null,
        "meteredUsage": false,
        "minUnits": 0,
        "pricePerIncrement": false,
        "pricingStrategy": "UNIT",
        "unit": "USER",
        "unitDependency": null
      }
    ],
    "discount": null,
    "frequency": "MONTHLY",
    "href": "http://appdirect/api/marketplace/v1/products/6/editions/6/paymentPlans/11",
    "id": 11,
    "isPrimaryPrice": false,
    "keepBillDateOnUsageChange": false,
    "primaryPrice": false,
    "separatePrepaid": false,
    "uuid": "9274b98d-b712-4cfb-9465-809a34751d41"
  },
  "paymentPlanId": 11,
  "previousOrder": null,
  "referenceCode": null,
  "salesSupportUser": null,
  "startDate": 1481001029176,
  "status": "ACTIVE",
  "totalPrice": 0,
  "type": "NEW",
  "user": null
}

PATCH /billing/v1/orders/{orderId}

Update a purchase order

Parameters

Parameter Type Data Type Default Description
*orderId path number Id of the specific purchase order to update

Body Parameters

Purchase order resource to be updated with

Order object:

Property Type Description
_embedded object
activated boolean True if the subscription has been activated
company LinkWS Link to company information.
contract OrderContract Contract for this order (optional)
currency string Currency.
customAttribute array of CustomAttribute List of custom attributes applying to this order.
discount LinkWS Link to the discount applied to this order (optional)
discountId number The unique identifier for the discount applied to this order
endDate number Order end date.
endOfDiscountDate number Discount end date.
frequency string Frequency.
id number ID.
links array of Link Resource links
nextBillingDate number Next billing date for the order.
nextOrder LinkWS Link to the next order for this subscription
oneTimeOrder array of OrderListing List of one time orders applying to this subscription order
orderLine array of OrderLine List of order lines for this subscription order
parameter array of Parameter List of custom parameters applying to this order.
paymentPlan PaymentPlan Payment plan for this order
paymentPlanId number The unique identifier for the payment plan for this order
previousOrder LinkWS Link to the previous order for this subscription
referenceCode string Reference code.
salesSupportUser LinkWS Link to sales support user information.
startDate number Order start date.
status string Order status.
totalPrice number Total price for the order.
type string Type.
user LinkWS Link to user information.

Responses

Status Meaning Description Definition
200 OK Updated order Order

Reconciliation

Retrieve ledger lines

Example request


curl -X get https://{marketplaceURL}/api/v3/reconciliation/ledgerLines \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/v3/reconciliation/ledgerLines HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/v3/reconciliation/ledgerLines',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/v3/reconciliation/ledgerLines',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/v3/reconciliation/ledgerLines',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/v3/reconciliation/ledgerLines',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/v3/reconciliation/ledgerLines");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

{
  "content": [
    {
      "amount": 10,
      "createdOn": 1506083752000,
      "currency": "JPY",
      "customer": {
        "email": "enduser003@appdirect.com",
        "id": 4712,
        "username": "enduser003@appdirect.com",
        "uuid": "62c8b934-aca8-4ed2-bcd5-8f798fd19355"
      },
      "editionId": 7552,
      "editionName": "Recurring Edition",
      "editionPricingItemId": 14467,
      "id": 6,
      "invoiceId": 8568,
      "issuerParty": {
        "id": "RESELLERSMARKETPLACE",
        "name": "RESELLER MARKETPLACE",
        "type": "CHANNEL",
        "uuid": "5d08ea40-c948-40e2-9335-1f3c513a6524"
      },
      "lastModified": 1506083752000,
      "lineItemDescription": "TEST - Recurring Edition - Monthly Fee Period from 09/22/17 to 10/22/17",
      "lineItemType": "ITEM",
      "orderId": 3598,
      "payments": [
        {
          "id": 5881,
          "type": "MANUAL"
        }
      ],
      "productId": 3402,
      "productName": "TEST",
      "recipientParty": {
        "id": "4052",
        "name": "Reseller Company 02",
        "type": "RESELLER",
        "uuid": "d282c59d-129a-4281-b390-a7d61876d9ce"
      },
      "reconciliationDate": 1506083747000,
      "reconciliationType": "ITEM",
      "transferStatus": "OPEN",
      "type": "DEBIT"
    },
    {
      "amount": 10,
      "createdOn": 1506083752000,
      "currency": "JPY",
      "customer": {
        "email": "enduser003@appdirect.com",
        "id": 4712,
        "username": "enduser003@appdirect.com",
        "uuid": "62c8b934-aca8-4ed2-bcd5-8f798fd19355"
      },
      "editionId": 7552,
      "editionName": "Recurring Edition",
      "editionPricingItemId": 14467,
      "id": 5,
      "invoiceId": 8568,
      "invoiceLineId": 8569,
      "issuerParty": {
        "id": "4052",
        "name": "Reseller Company 02",
        "type": "RESELLER",
        "uuid": "d282c59d-129a-4281-b390-a7d61876d9ce"
      },
      "lastModified": 1506083752000,
      "lineItemDescription": "TEST - Recurring Edition - Monthly Fee Period from 09/22/17 to 10/22/17",
      "lineItemType": "ITEM",
      "orderId": 3598,
      "payments": [
        {
          "id": 5881,
          "type": "MANUAL"
        }
      ],
      "productId": 3402,
      "productName": "TEST",
      "recipientParty": {
        "id": "RESELLERSMARKETPLACE",
        "name": "RESELLER MARKETPLACE",
        "type": "CHANNEL",
        "uuid": "5d08ea40-c948-40e2-9335-1f3c513a6524"
      },
      "reconciliationDate": 1506083747000,
      "reconciliationType": "ITEM",
      "transferStatus": "OPEN",
      "type": "CREDIT"
    }
  ],
  "links": [],
  "page": {
    "number": 1,
    "size": 50,
    "totalElements": 2,
    "totalPages": 1
  }
}

GET /v3/reconciliation/ledgerLines

Retrieve ledger lines generated for a specific role. Example, retrieve all ledger lines that a reseller manager has against all resellers

Parameters

Parameter Type Data Type Default Description
*context query string of enum:
RESELLER_MANAGER
Currently only supported value is 'RESELLER_MANAGER'
page query integer Page number to be returned in the result. Default value is 1
size query integer Size of the page to be returned. Default value is 50, maximum allowed is 250
sortOrder query string of enum:
ASC
DESC
Sorting is done against 'reconciliationDate'. Defaults to sorting in ascending order
fromDate query number Filters ledger lines from given date. Filtering is performed against the reconciliation date of the ledger line. The parameter represents milliseconds since epoch date, but only the date part is taken into account. The time component is ignored
toDate query number Filters ledger lines until given date. Filtering is performed against the reconciliation date of the ledger line. The parameter represents milliseconds since epoch date, but only the date part is taken into account. The time component is ignored
reconciliationType query string of enum:
ITEM
TAX
DISCOUNT
TERMINATION_FEE
ADJUSTMENT
RESELLER_MARKUP
CHANNEL_MARKUP
APPDIRECT_FEE
Filters by ledger line reconciliation type
operationType query string of enum:
CREDIT
DEBIT
Filters by ledger line operation type

Responses

Status Meaning Description Definition
200 OK OK PagedLedgerLineDetailsWS
400 Bad Request Bad Request, typically bad query parameters
401 Unauthorized Invalid authentication
403 Forbidden Invalid authorization

Subscriptions

List all subscriptions for a user

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

[
  {
    "assignmentCount": 1,
    "company": {
      "href": "http://appdirect/api/account/v1/companies/e83cd3d6-7865-4fc2-9d7c-603ad17dd639",
      "id": "e83cd3d6-7865-4fc2-9d7c-603ad17dd639"
    },
    "creationDate": 1481002406580,
    "edition": {
      "href": "http://appdirect/api/marketplace/v1/products/2/editions/2",
      "id": "2"
    },
    "endDate": null,
    "externalAccountId": "d2f4acf1-fb5a-4c4a-921f-75c4b6bfff08",
    "id": "1b577640-9b77-47bc-beb8-ed59accb4836",
    "links": [],
    "maxUsers": 1,
    "order": {
      "href": "http://appdirect/api/billing/v1/orders/1",
      "id": "1"
    },
    "parentSubscriptionId": null,
    "product": {
      "href": "http://appdirect/api/marketplace/v1/products/2",
      "id": "2"
    },
    "status": "ACTIVE",
    "suspensionReason": "API",
    "user": {
      "href": "http://appdirect/api/account/v1/users/c47d0fd7-b67a-4e07-84f8-f93dfafbeecc",
      "id": "c47d0fd7-b67a-4e07-84f8-f93dfafbeecc"
    }
  }
]

GET /billing/v1/companies/{companyId}/users/{userId}/subscriptions

List all of the subscriptions for the given user

Parameters

Parameter Type Data Type Default Description
*companyId path string User's company ID
*userId path string User ID
filter query string Subscription filter to be applied
count query integer 250 Number of results to fetch. Used for paging.
sortField query string of enum:
APPLICATION
COMPANY
DATE
OWNER
STATUS
SUBSCRIPTION_ID
DATE Sort field
sortOrder query string of enum:
ASC
DESC
ASC Sort order
start query integer 0 First result index. Used for paging.

Responses

Status Meaning Description Definition
200 OK OK SubscriptionListing
404 Not Found Not Found

List all subscriptions

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/subscriptions \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/subscriptions HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/subscriptions',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/subscriptions',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/subscriptions',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/subscriptions',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/subscriptions");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

[
  {
    "_embedded": {
      "order": {
        "activated": false,
        "company": {
          "href": "http://appdirect/api/account/v1/companies/ff732167-9b1b-4dba-bc2e-dece04f8fb41",
          "id": "ff732167-9b1b-4dba-bc2e-dece04f8fb41"
        },
        "contract": null,
        "currency": "USD",
        "discount": null,
        "discountId": null,
        "endDate": null,
        "endOfDiscountDate": null,
        "frequency": "MONTHLY",
        "id": 16,
        "links": [
          {
            "href": "http://appdirect/api/billing/v1/subscriptions/3bdda3a2-4af6-48fd-be7c-39cbf2ded56f",
            "rel": "subscription"
          }
        ],
        "nextBillingDate": 1483677844367,
        "nextOrder": null,
        "oneTimeOrders": [],
        "orderLines": [],
        "parameters": [],
        "paymentPlan": {
          "allowCustomUsage": false,
          "contract": {
            "alignWithParentCycleStartDate": false,
            "autoExtensionPricingId": 26,
            "blockContractDowngrades": false,
            "blockContractUpgrades": false,
            "blockSwitchToShorterContract": false,
            "cancellationPeriodLimit": null,
            "endOfContractGracePeriod": null,
            "gracePeriod": null,
            "minimumServiceLength": 3,
            "terminationFee": null
          },
          "costs": [
            {
              "amount": {
                "USD": 10
              },
              "blockContractDecrease": false,
              "blockContractIncrease": false,
              "blockOriginalContractDecrease": false,
              "id": 26,
              "increment": 1,
              "maxUnits": null,
              "meteredUsage": false,
              "minUnits": 0,
              "pricePerIncrement": false,
              "pricingStrategy": "UNIT",
              "unit": "USER",
              "unitDependency": null
            }
          ],
          "discount": null,
          "frequency": "MONTHLY",
          "href": "http://appdirect/api/marketplace/v1/products/12/editions/15/paymentPlans/26",
          "id": 26,
          "isPrimaryPrice": false,
          "keepBillDateOnUsageChange": false,
          "primaryPrice": false,
          "separatePrepaid": false,
          "uuid": "292e4509-3a7b-41e3-87be-e47dcb51adf2"
        },
        "paymentPlanId": 26,
        "previousOrder": null,
        "referenceCode": null,
        "salesSupportUser": null,
        "startDate": 1480999444367,
        "status": "ACTIVE",
        "totalPrice": 0,
        "type": "NEW",
        "user": {
          "href": "http://appdirect/api/account/v1/users/5ab780a4-1767-4799-9b83-5b898ac76763",
          "id": "5ab780a4-1767-4799-9b83-5b898ac76763"
        }
      }
    },
    "assignmentCount": 1,
    "company": {
      "href": "http://appdirect/api/account/v1/companies/ff732167-9b1b-4dba-bc2e-dece04f8fb41",
      "id": "ff732167-9b1b-4dba-bc2e-dece04f8fb41"
    },
    "creationDate": 1480999444377,
    "edition": {
      "href": "http://appdirect/api/marketplace/v1/products/12/editions/15",
      "id": "15"
    },
    "endDate": null,
    "externalAccountId": "16-account-identifier",
    "id": "3bdda3a2-4af6-48fd-be7c-39cbf2ded56f",
    "links": [],
    "maxUsers": 0,
    "order": {
      "href": "http://appdirect/api/billing/v1/orders/16",
      "id": 16
    },
    "parentSubscriptionId": null,
    "product": {
      "href": "http://appdirect/api/marketplace/v1/products/12",
      "id": "12"
    },
    "status": "ACTIVE",
    "suspensionReason": null,
    "user": {
      "href": "http://appdirect/api/account/v1/users/5ab780a4-1767-4799-9b83-5b898ac76763",
      "id": "5ab780a4-1767-4799-9b83-5b898ac76763"
    }
  }
]

GET /billing/v1/subscriptions

The list may be filtered using the optional filter parameters

Parameters

Parameter Type Data Type Default Description
filter query string Search filter
count query integer 250 Number of results to fetch. Used for paging.
sortField query string of enum:
APPLICATION
COMPANY
DATE
OWNER
STATUS
SUBSCRIPTION_ID
DATE Sort field
sortOrder query string of enum:
ASC
DESC
ASC Sort order
start query integer 0 First result index. Used for paging.

Responses

Status Meaning Description Definition
200 OK OK Subscription
404 Not Found Not Found

Read addon instances for a subscription

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/addons \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/addons HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/addons',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/addons',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/addons',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/addons',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/addons");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /billing/v1/subscriptions/{subscriptionId}/addons

Read addon instances for a subscription

Parameters

Parameter Type Data Type Default Description
*subscriptionId path string Subscription ID
filter query string Search filter
sortField query string of enum:
DATE
STATUS
UUID
DATE Sort field (UUID, DATE or STATUS)
sortOrder query string of enum:
ASC
DESC
ASC Sort order (ASC or DESC)

Responses

Status Meaning Description Definition
200 OK OK AddonInstance
404 Not Found Not Found

List all invoices for a subscription

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/invoices \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/invoices HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/invoices',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/invoices',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/invoices',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/invoices',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/invoices");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

Headers:
  X-Total-Count: 1
[
  {
    "company": {
      "href": "http://appdirect/api/account/v1/companies/d6190d63-3cae-4baa-a4ed-6e102c509178",
      "id": "d6190d63-3cae-4baa-a4ed-6e102c509178"
    },
    "creationDate": 1480999442314,
    "currency": "USD",
    "dueDate": 1481353200000,
    "invoiceId": 24,
    "links": [
      {
        "href": "http://appdirect/api/account/v2/users/f295b2f1-178f-46b4-a360-092011ad2946",
        "rel": "user"
      },
      {
        "href": "http://appdirect/api/account/v2/companies/d6190d63-3cae-4baa-a4ed-6e102c509178",
        "rel": "company"
      },
      {
        "href": "http://appdirect/api/billing/v1/invoices/24",
        "rel": "self"
      }
    ],
    "orderIds": [
      "2030"
    ],
    "referenceNumber": null,
    "status": "PAID",
    "total": 10,
    "user": {
      "href": "http://appdirect/api/account/v1/users/f295b2f1-178f-46b4-a360-092011ad2946",
      "id": "f295b2f1-178f-46b4-a360-092011ad2946"
    }
  }
]

GET /billing/v1/subscriptions/{subscriptionId}/invoices

List all of the invoices for the given subscription

Parameters

Parameter Type Data Type Default Description
*subscriptionId path string Subscription ID
count query integer 250 Number of results to fetch. Used for paging.
excludeFree query boolean Exclude invoices with no charges (free)
fromDate query number From date
sortField query string of enum:
DATE
INVOICE_ID
TOTAL
INVOICE_ID Sort field
sortOrder query string of enum:
ASC
DESC
ASC Sort order
start query integer 0 First result index. Used for paging.
status query string of enum:
CARRIED
PAID
UNPAID
VOIDED
Invoice status
toDate query number To date

Responses

Status Meaning Description Definition
200 OK OK InvoiceListing
404 Not Found Not Found

List all purchase orders for a subscription

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/orders \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/orders HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/orders',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/orders',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/orders',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/orders',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/orders");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

{
  "orders": [
    {
      "activated": false,
      "company": {
        "href": "http://appdirect/api/account/v1/companies/a470269b-f5d1-4e33-b739-9835f50c0683",
        "id": "a470269b-f5d1-4e33-b739-9835f50c0683"
      },
      "contract": null,
      "currency": "USD",
      "discount": null,
      "discountId": null,
      "endDate": null,
      "endOfDiscountDate": null,
      "frequency": "MONTHLY",
      "id": 15,
      "links": [
        {
          "href": "http://appdirect/api/billing/v1/subscriptions/5096ed99-675b-449a-926e-0ee2c0aa4128",
          "rel": "subscription"
        }
      ],
      "nextBillingDate": 1483677843538,
      "nextOrder": null,
      "oneTimeOrders": [],
      "orderLines": [],
      "parameters": [],
      "paymentPlan": {
        "allowCustomUsage": false,
        "contract": {
          "alignWithParentCycleStartDate": false,
          "autoExtensionPricingId": 24,
          "blockContractDowngrades": false,
          "blockContractUpgrades": false,
          "blockSwitchToShorterContract": false,
          "cancellationPeriodLimit": null,
          "endOfContractGracePeriod": null,
          "gracePeriod": null,
          "minimumServiceLength": 3,
          "terminationFee": null
        },
        "costs": [
          {
            "amount": {
              "USD": 10
            },
            "blockContractDecrease": false,
            "blockContractIncrease": false,
            "blockOriginalContractDecrease": false,
            "id": 24,
            "increment": 1,
            "maxUnits": null,
            "meteredUsage": false,
            "minUnits": 0,
            "pricePerIncrement": false,
            "pricingStrategy": "UNIT",
            "unit": "USER",
            "unitDependency": null
          }
        ],
        "discount": null,
        "frequency": "MONTHLY",
        "href": "http://appdirect/api/marketplace/v1/products/11/editions/14/paymentPlans/24",
        "id": 24,
        "isPrimaryPrice": false,
        "keepBillDateOnUsageChange": false,
        "primaryPrice": false,
        "separatePrepaid": false,
        "uuid": "865c805d-5efd-459d-b605-3b6587376727"
      },
      "paymentPlanId": 24,
      "previousOrder": null,
      "referenceCode": null,
      "salesSupportUser": null,
      "startDate": 1480999443538,
      "status": "ACTIVE",
      "totalPrice": 0,
      "type": "NEW",
      "user": {
        "href": "http://appdirect/api/account/v1/users/ef508ef9-5814-4788-aba4-488d98947c4c",
        "id": "ef508ef9-5814-4788-aba4-488d98947c4c"
      }
    }
  ],
  "total": 1
}

GET /billing/v1/subscriptions/{subscriptionId}/orders

List all the purchase orders for the given subscription

Parameters

Parameter Type Data Type Default Description
*subscriptionId path string Subscription ID.
filter query string Search filter.
count query integer 250 Number of results to fetch. Used for paging.
sortField query string of enum:
DATE
ORDER_ID
TOTAL
DATE Sort field.
sortOrder query string of enum:
ASC
DESC
ASC Sort order.
start query integer 0 First result index. Used for paging.

Responses

Status Meaning Description Definition
200 OK Response.

List all payments for a subscription

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/payments \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/payments HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/payments',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/payments',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/payments',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/payments',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/payments");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

[
  {
    "amount": 10,
    "company": {
      "href": "http://appdirect/api/account/v1/companies/95b5f752-5ba7-487e-b555-7ebfd8ec3079",
      "id": "95b5f752-5ba7-487e-b555-7ebfd8ec3079"
    },
    "currency": "USD",
    "date": 1480999442914,
    "gatewayResponse": {
      "avs": true,
      "code": null,
      "cvv": true,
      "message": null
    },
    "links": [
      {
        "href": "http://appdirect/api/billing/v1/payments/3",
        "rel": "self"
      }
    ],
    "method": "CREDIT_CARD",
    "paymentNumber": 3,
    "result": "SUCCESSFUL",
    "transactionId": "123456abcdef",
    "user": {
      "href": "http://appdirect/api/account/v1/users/f5dbf30d-233d-4b85-9737-e4711b509fb7",
      "id": "f5dbf30d-233d-4b85-9737-e4711b509fb7"
    }
  }
]

GET /billing/v1/subscriptions/{subscriptionId}/payments

List all the payments for the given subscription

Parameters

Parameter Type Data Type Default Description
*subscriptionId path string Subscription ID
count query integer 250 Number of results to fetch. Used for paging.
fromDate query number From date
method query string of enum:
ADP_INVOICE
ARIBAPAY
BT_BILL
CLICKANDBUY
CLOUDFOUNDRY
CREDIT_CARD
CUMULA_BILL
DTAG
EXTERNAL_INVOICE
KREDITKARTE
LASTSCHRIFT_MRNEXNET
MANO_TEO_BILL
MANUAL
MARKETPLACE_CREDITS
NETS_ARVATO_INVOICE
NEXTEL
PAYPAL
ROGERS_CC_DTMF
ROGERS_CC_POS
SNAP
TBILL
THISTLE
TOICLEARING
Payment method
result query string of enum:
FAILED
GATEWAY_NOT_AVAILABLE
MANUAL
SUCCESSFUL
Payment result
sortField query string of enum:
AMOUNT
DATE
PAYMENT_ID
PAYMENT_ID Sort field
sortOrder query string of enum:
ASC
DESC
ASC Sort order
start query integer 0 First result index. Used for paging.
toDate query number To date

Responses

Status Meaning Description Definition
200 OK OK Payment
404 Not Found Not Found

Preview subscription cancellation

Example request


curl -X get https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/previewCancel \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/previewCancel HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/previewCancel',
  method: 'get',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/previewCancel',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.get 'https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/previewCancel',

params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/previewCancel',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}/previewCancel");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

{
  "assignedUsers": 1,
  "company": {
    "href": "http://appdirect/api/account/v1/companies/1a32fa08-839f-4594-9003-aa4081c84fff",
    "id": "1a32fa08-839f-4594-9003-aa4081c84fff"
  },
  "creationDate": 1480999441698,
  "edition": {
    "href": "http://appdirect/api/marketplace/v1/products/8/editions/11",
    "id": "11"
  },
  "endDate": null,
  "externalAccountId": "12-account-identifier",
  "id": "08e230e5-2895-478f-aaeb-3879f5fe5c33",
  "maxUsers": 0,
  "order": {
    "activated": false,
    "company": {
      "href": "http://appdirect/api/account/v1/companies/1a32fa08-839f-4594-9003-aa4081c84fff",
      "id": "1a32fa08-839f-4594-9003-aa4081c84fff"
    },
    "contract": {
      "cancellationPeriodLimit": null,
      "endOfContractDate": 1588789800000,
      "endOfContractGracePeriod": null,
      "gracePeriodEndDate": null,
      "minimumServiceLength": 24,
      "renewal": null,
      "terminationFee": {
        "description": "Fee",
        "estimatedCost": 254.6628,
        "percentage": 100,
        "price": null,
        "type": "PERCENTAGE"
      }
    },
    "currency": "USD",
    "discount": null,
    "discountId": null,
    "endDate": null,
    "endOfDiscountDate": null,
    "frequency": "MONTHLY",
    "id": 12,
    "links": [
      {
        "href": "http://appdirect/api/billing/v1/subscriptions/08e230e5-2895-478f-aaeb-3879f5fe5c33",
        "rel": "subscription"
      }
    ],
    "nextBillingDate": 1483677841682,
    "nextOrder": null,
    "oneTimeOrders": [],
    "orderLines": [],
    "parameters": [],
    "paymentPlan": {
      "allowCustomUsage": false,
      "contract": {
        "alignWithParentCycleStartDate": false,
        "autoExtensionPricingId": 18,
        "blockContractDowngrades": false,
        "blockContractUpgrades": false,
        "blockSwitchToShorterContract": false,
        "cancellationPeriodLimit": null,
        "endOfContractGracePeriod": null,
        "gracePeriod": null,
        "minimumServiceLength": 3,
        "terminationFee": null
      },
      "costs": [
        {
          "amount": {
            "USD": 10
          },
          "blockContractDecrease": false,
          "blockContractIncrease": false,
          "blockOriginalContractDecrease": false,
          "id": 18,
          "increment": 1,
          "maxUnits": null,
          "meteredUsage": false,
          "minUnits": 0,
          "pricePerIncrement": false,
          "pricingStrategy": "UNIT",
          "unit": "USER",
          "unitDependency": null
        }
      ],
      "discount": null,
      "frequency": "MONTHLY",
      "href": "http://appdirect/api/marketplace/v1/products/8/editions/11/paymentPlans/18",
      "id": 18,
      "isPrimaryPrice": false,
      "keepBillDateOnUsageChange": false,
      "primaryPrice": false,
      "separatePrepaid": false,
      "uuid": "feed23e0-de8c-4e6f-b70a-13b0f610b0f7"
    },
    "paymentPlanId": 18,
    "previousOrder": null,
    "referenceCode": null,
    "salesSupportUser": null,
    "startDate": 1480999441682,
    "status": "ACTIVE",
    "totalPrice": 0,
    "type": "NEW",
    "user": {
      "href": "http://appdirect/api/account/v1/users/69474681-db96-4486-8954-34d12c23e415",
      "id": "69474681-db96-4486-8954-34d12c23e415"
    }
  },
  "product": {
    "href": "http://appdirect/api/marketplace/v1/products/8",
    "id": "8"
  },
  "redirectUrl": null,
  "status": "ACTIVE",
  "upcomingOrder": null,
  "user": {
    "href": "http://appdirect/api/account/v1/users/69474681-db96-4486-8954-34d12c23e415",
    "id": "69474681-db96-4486-8954-34d12c23e415"
  }
}

GET /billing/v1/subscriptions/{subscriptionId}/previewCancel

Preview a subscription cancellation for the given subscription ID

Parameters

Parameter Type Data Type Default Description
*subscriptionId path string The subscription ID

Responses

Status Meaning Description Definition
200 OK OK Subscription
404 Not Found Not Found

Create a subscription

Example request


curl -X post \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data-binary @- https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions <<EOF
{
  "assignedUsers": 12345,
  "company": {
    "href": "...",
    "id": "..."
  },
  "creationDate": 12345,
  "edition": {
    "href": "...",
    "id": "..."
  },
  "endDate": 12345,
  "externalAccountId": "...",
  "id": "...",
  "internalId": "...",
  "maxUsers": 12345,
  "order": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {
      "cancellationPeriodLimit": null,
      "endOfContractDate": 123451232,
      "endOfContractGracePeriod": null,
      "gracePeriodEndDate": null,
      "minimumServiceLength": 24,
      "renewal": null,
      "terminationFee": {
        "description": "Fee",
        "estimatedCost": 324.56,
        "percentage": 100,
        "price": null,
        "type": "PERCENTAGE"
      }
    },
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "product": {
    "href": "...",
    "id": "..."
  },
  "redirectUrl": "...",
  "status": "...",
  "upcomingOrder": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {},
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "user": {
    "href": "...",
    "id": "..."
  }
}
EOF

POST https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json

{
  "assignedUsers": 12345,
  "company": {
    "href": "...",
    "id": "..."
  },
  "creationDate": 12345,
  "edition": {
    "href": "...",
    "id": "..."
  },
  "endDate": 12345,
  "externalAccountId": "...",
  "id": "...",
  "internalId": "...",
  "maxUsers": 12345,
  "order": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {
      "cancellationPeriodLimit": null,
      "endOfContractDate": 123451232,
      "endOfContractGracePeriod": null,
      "gracePeriodEndDate": null,
      "minimumServiceLength": 24,
      "renewal": null,
      "terminationFee": {
        "description": "Fee",
        "estimatedCost": 324.56,
        "percentage": 100,
        "price": null,
        "type": "PERCENTAGE"
      }
    },
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "product": {
    "href": "...",
    "id": "..."
  },
  "redirectUrl": "...",
  "status": "...",
  "upcomingOrder": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {},
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "user": {
    "href": "...",
    "id": "..."
  }
}


var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions',
  method: 'post',
  dataType: 'json',
  data: {
  "assignedUsers": 12345,
  "company": {
    "href": "...",
    "id": "..."
  },
  "creationDate": 12345,
  "edition": {
    "href": "...",
    "id": "..."
  },
  "endDate": 12345,
  "externalAccountId": "...",
  "id": "...",
  "internalId": "...",
  "maxUsers": 12345,
  "order": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {
      "cancellationPeriodLimit": null,
      "endOfContractDate": 123451232,
      "endOfContractGracePeriod": null,
      "gracePeriodEndDate": null,
      "minimumServiceLength": 24,
      "renewal": null,
      "terminationFee": {
        "description": "Fee",
        "estimatedCost": 324.56,
        "percentage": 100,
        "price": null,
        "type": "PERCENTAGE"
      }
    },
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "product": {
    "href": "...",
    "id": "..."
  },
  "redirectUrl": "...",
  "status": "...",
  "upcomingOrder": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {},
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "user": {
    "href": "...",
    "id": "..."
  }
},

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const inputBody = '{
  "assignedUsers": 12345,
  "company": {
    "href": "...",
    "id": "..."
  },
  "creationDate": 12345,
  "edition": {
    "href": "...",
    "id": "..."
  },
  "endDate": 12345,
  "externalAccountId": "...",
  "id": "...",
  "internalId": "...",
  "maxUsers": 12345,
  "order": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {
      "cancellationPeriodLimit": null,
      "endOfContractDate": 123451232,
      "endOfContractGracePeriod": null,
      "gracePeriodEndDate": null,
      "minimumServiceLength": 24,
      "renewal": null,
      "terminationFee": {
        "description": "Fee",
        "estimatedCost": 324.56,
        "percentage": 100,
        "price": null,
        "type": "PERCENTAGE"
      }
    },
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "product": {
    "href": "...",
    "id": "..."
  },
  "redirectUrl": "...",
  "status": "...",
  "upcomingOrder": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {},
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "user": {
    "href": "...",
    "id": "..."
  }
}';
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

fetch('https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions',
{
  method: 'POST',body: inputBody,headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json'
}

result = RestClient.post 'https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions',
payload={
  "assignedUsers": 12345,
  "company": {
    "href": "...",
    "id": "..."
  },
  "creationDate": 12345,
  "edition": {
    "href": "...",
    "id": "..."
  },
  "endDate": 12345,
  "externalAccountId": "...",
  "id": "...",
  "internalId": "...",
  "maxUsers": 12345,
  "order": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {
      "cancellationPeriodLimit": null,
      "endOfContractDate": 123451232,
      "endOfContractGracePeriod": null,
      "gracePeriodEndDate": null,
      "minimumServiceLength": 24,
      "renewal": null,
      "terminationFee": {
        "description": "Fee",
        "estimatedCost": 324.56,
        "percentage": 100,
        "price": null,
        "type": "PERCENTAGE"
      }
    },
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "product": {
    "href": "...",
    "id": "..."
  },
  "redirectUrl": "...",
  "status": "...",
  "upcomingOrder": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {},
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "user": {
    "href": "...",
    "id": "..."
  }
}
params: {
},
headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

r = requests.post('https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions',
json={
  "assignedUsers": 12345,
  "company": {
    "href": "...",
    "id": "..."
  },
  "creationDate": 12345,
  "edition": {
    "href": "...",
    "id": "..."
  },
  "endDate": 12345,
  "externalAccountId": "...",
  "id": "...",
  "internalId": "...",
  "maxUsers": 12345,
  "order": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {
      "cancellationPeriodLimit": null,
      "endOfContractDate": 123451232,
      "endOfContractGracePeriod": null,
      "gracePeriodEndDate": null,
      "minimumServiceLength": 24,
      "renewal": null,
      "terminationFee": {
        "description": "Fee",
        "estimatedCost": 324.56,
        "percentage": 100,
        "price": null,
        "type": "PERCENTAGE"
      }
    },
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "product": {
    "href": "...",
    "id": "..."
  },
  "redirectUrl": "...",
  "status": "...",
  "upcomingOrder": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {},
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "user": {
    "href": "...",
    "id": "..."
  }
}
params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
String inputBody = "{" +
  "\"assignedUsers\": 12345," +
  "\"company\": {" +
    "\"href\": \"...\"," +
    "\"id\": \"...\"" +
  "}," +
  "\"creationDate\": 12345," +
  "\"edition\": {" +
    "\"href\": \"...\"," +
    "\"id\": \"...\"" +
  "}," +
  "\"endDate\": 12345," +
  "\"externalAccountId\": \"...\"," +
  "\"id\": \"...\"," +
  "\"internalId\": \"...\"," +
  "\"maxUsers\": 12345," +
  "\"order\": {" +
    "\"_embedded\": {" +
      "\"property1\": {}," +
      "\"property2\": {}" +
    "}," +
    "\"activated\": true," +
    "\"company\": {" +
      "\"href\": \"...\"," +
      "\"id\": \"...\"" +
    "}," +
    "\"contract\": {" +
      "\"cancellationPeriodLimit\": null," +
      "\"endOfContractDate\": 123451232," +
      "\"endOfContractGracePeriod\": null," +
      "\"gracePeriodEndDate\": null," +
      "\"minimumServiceLength\": 24," +
      "\"renewal\": null," +
      "\"terminationFee\": {" +
        "\"description\": \"Fee\"," +
        "\"estimatedCost\": 324.56," +
        "\"percentage\": 100," +
        "\"price\": null," +
        "\"type\": \"PERCENTAGE\"" +
      "}" +
    "}," +
    "\"currency\": \"...\"," +
    "\"customAttribute\": [" +
      "{" +
        "\"attributeType\": \"TEXT\"," +
        "\"name\": \"...\"," +
        "\"value\": \"...\"," +
        "\"valueKeys\": [" +
          "\"...\"," +
          "\"...\"" +
        "]" +
      "}," +
      "{" +
        "\"attributeType\": \"TEXT\"," +
        "\"name\": \"...\"," +
        "\"value\": \"...\"," +
        "\"valueKeys\": [" +
          "\"...\"," +
          "\"...\"" +
        "]" +
      "}" +
    "]," +
    "\"discount\": {" +
      "\"href\": \"...\"," +
      "\"id\": \"...\"" +
    "}," +
    "\"discountId\": 12345," +
    "\"endDate\": 12345," +
    "\"endOfDiscountDate\": 12345," +
    "\"frequency\": \"...\"," +
    "\"id\": 12345," +
    "\"links\": [" +
      "{" +
        "\"href\": \"...\"," +
        "\"rel\": \"...\"" +
      "}," +
      "{" +
        "\"href\": \"...\"," +
        "\"rel\": \"...\"" +
      "}" +
    "]," +
    "\"nextBillingDate\": 12345," +
    "\"nextOrder\": {" +
      "\"href\": \"...\"," +
      "\"id\": \"...\"" +
    "}," +
    "\"oneTimeOrder\": [" +
      "{" +
        "\"_embedded\": {" +
          "\"property1\": {}," +
          "\"property2\": {}" +
        "}," +
        "\"company\": {}," +
        "\"currency\": \"...\"," +
        "\"endDate\": 12345," +
        "\"endOfDiscountDate\": 12345," +
        "\"frequency\": \"...\"," +
        "\"id\": 12345," +
        "\"links\": [" +
          "{}," +
          "{}" +
        "]," +
        "\"nextBillingDate\": 12345," +
        "\"paymentPlan\": {}," +
        "\"referenceCode\": \"...\"," +
        "\"salesSupportUser\": {}," +
        "\"startDate\": 12345," +
        "\"status\": \"...\"," +
        "\"totalPrice\": 12345," +
        "\"type\": \"...\"," +
        "\"user\": {}" +
      "}," +
      "{" +
        "\"_embedded\": {" +
          "\"property1\": {}," +
          "\"property2\": {}" +
        "}," +
        "\"company\": {}," +
        "\"currency\": \"...\"," +
        "\"endDate\": 12345," +
        "\"endOfDiscountDate\": 12345," +
        "\"frequency\": \"...\"," +
        "\"id\": 12345," +
        "\"links\": [" +
          "{}," +
          "{}" +
        "]," +
        "\"nextBillingDate\": 12345," +
        "\"paymentPlan\": {}," +
        "\"referenceCode\": \"...\"," +
        "\"salesSupportUser\": {}," +
        "\"startDate\": 12345," +
        "\"status\": \"...\"," +
        "\"totalPrice\": 12345," +
        "\"type\": \"...\"," +
        "\"user\": {}" +
      "}" +
    "]," +
    "\"orderLine\": [" +
      "{}," +
      "{}" +
    "]," +
    "\"parameter\": [" +
      "{" +
        "\"name\": \"...\"," +
        "\"value\": \"...\"" +
      "}," +
      "{" +
        "\"name\": \"...\"," +
        "\"value\": \"...\"" +
      "}" +
    "]," +
    "\"paymentPlan\": {" +
      "\"allowCustomUsage\": true," +
      "\"contract\": {}," +
      "\"cost\": [" +
        "{}," +
        "{}" +
      "]," +
      "\"discount\": {}," +
      "\"frequency\": \"...\"," +
      "\"href\": \"...\"," +
      "\"id\": 12345," +
      "\"isPrimaryPrice\": true," +
      "\"keepBillDateOnUsageChange\": true," +
      "\"primaryPrice\": true," +
      "\"separatePrepaid\": true," +
      "\"tld\": \"...\"," +
      "\"uuid\": \"...\"" +
    "}," +
    "\"paymentPlanId\": 12345," +
    "\"previousOrder\": {" +
      "\"href\": \"...\"," +
      "\"id\": \"...\"" +
    "}," +
    "\"referenceCode\": \"...\"," +
    "\"salesSupportUser\": {" +
      "\"href\": \"...\"," +
      "\"id\": \"...\"" +
    "}," +
    "\"startDate\": 12345," +
    "\"status\": \"...\"," +
    "\"totalPrice\": 12345," +
    "\"type\": \"...\"," +
    "\"user\": {" +
      "\"href\": \"...\"," +
      "\"id\": \"...\"" +
    "}" +
  "}," +
  "\"product\": {" +
    "\"href\": \"...\"," +
    "\"id\": \"...\"" +
  "}," +
  "\"redirectUrl\": \"...\"," +
  "\"status\": \"...\"," +
  "\"upcomingOrder\": {" +
    "\"_embedded\": {" +
      "\"property1\": {}," +
      "\"property2\": {}" +
    "}," +
    "\"activated\": true," +
    "\"company\": {" +
      "\"href\": \"...\"," +
      "\"id\": \"...\"" +
    "}," +
    "\"contract\": {}," +
    "\"currency\": \"...\"," +
    "\"customAttribute\": [" +
      "{" +
        "\"attributeType\": \"TEXT\"," +
        "\"name\": \"...\"," +
        "\"value\": \"...\"," +
        "\"valueKeys\": [" +
          "\"...\"," +
          "\"...\"" +
        "]" +
      "}," +
      "{" +
        "\"attributeType\": \"TEXT\"," +
        "\"name\": \"...\"," +
        "\"value\": \"...\"," +
        "\"valueKeys\": [" +
          "\"...\"," +
          "\"...\"" +
        "]" +
      "}" +
    "]," +
    "\"discount\": {" +
      "\"href\": \"...\"," +
      "\"id\": \"...\"" +
    "}," +
    "\"discountId\": 12345," +
    "\"endDate\": 12345," +
    "\"endOfDiscountDate\": 12345," +
    "\"frequency\": \"...\"," +
    "\"id\": 12345," +
    "\"links\": [" +
      "{" +
        "\"href\": \"...\"," +
        "\"rel\": \"...\"" +
      "}," +
      "{" +
        "\"href\": \"...\"," +
        "\"rel\": \"...\"" +
      "}" +
    "]," +
    "\"nextBillingDate\": 12345," +
    "\"nextOrder\": {" +
      "\"href\": \"...\"," +
      "\"id\": \"...\"" +
    "}," +
    "\"oneTimeOrder\": [" +
      "{" +
        "\"_embedded\": {" +
          "\"property1\": {}," +
          "\"property2\": {}" +
        "}," +
        "\"company\": {}," +
        "\"currency\": \"...\"," +
        "\"endDate\": 12345," +
        "\"endOfDiscountDate\": 12345," +
        "\"frequency\": \"...\"," +
        "\"id\": 12345," +
        "\"links\": [" +
          "{}," +
          "{}" +
        "]," +
        "\"nextBillingDate\": 12345," +
        "\"paymentPlan\": {}," +
        "\"referenceCode\": \"...\"," +
        "\"salesSupportUser\": {}," +
        "\"startDate\": 12345," +
        "\"status\": \"...\"," +
        "\"totalPrice\": 12345," +
        "\"type\": \"...\"," +
        "\"user\": {}" +
      "}," +
      "{" +
        "\"_embedded\": {" +
          "\"property1\": {}," +
          "\"property2\": {}" +
        "}," +
        "\"company\": {}," +
        "\"currency\": \"...\"," +
        "\"endDate\": 12345," +
        "\"endOfDiscountDate\": 12345," +
        "\"frequency\": \"...\"," +
        "\"id\": 12345," +
        "\"links\": [" +
          "{}," +
          "{}" +
        "]," +
        "\"nextBillingDate\": 12345," +
        "\"paymentPlan\": {}," +
        "\"referenceCode\": \"...\"," +
        "\"salesSupportUser\": {}," +
        "\"startDate\": 12345," +
        "\"status\": \"...\"," +
        "\"totalPrice\": 12345," +
        "\"type\": \"...\"," +
        "\"user\": {}" +
      "}" +
    "]," +
    "\"orderLine\": [" +
      "{}," +
      "{}" +
    "]," +
    "\"parameter\": [" +
      "{" +
        "\"name\": \"...\"," +
        "\"value\": \"...\"" +
      "}," +
      "{" +
        "\"name\": \"...\"," +
        "\"value\": \"...\"" +
      "}" +
    "]," +
    "\"paymentPlan\": {" +
      "\"allowCustomUsage\": true," +
      "\"contract\": {}," +
      "\"cost\": [" +
        "{}," +
        "{}" +
      "]," +
      "\"discount\": {}," +
      "\"frequency\": \"...\"," +
      "\"href\": \"...\"," +
      "\"id\": 12345," +
      "\"isPrimaryPrice\": true," +
      "\"keepBillDateOnUsageChange\": true," +
      "\"primaryPrice\": true," +
      "\"separatePrepaid\": true," +
      "\"tld\": \"...\"," +
      "\"uuid\": \"...\"" +
    "}," +
    "\"paymentPlanId\": 12345," +
    "\"previousOrder\": {" +
      "\"href\": \"...\"," +
      "\"id\": \"...\"" +
    "}," +
    "\"referenceCode\": \"...\"," +
    "\"salesSupportUser\": {" +
      "\"href\": \"...\"," +
      "\"id\": \"...\"" +
    "}," +
    "\"startDate\": 12345," +
    "\"status\": \"...\"," +
    "\"totalPrice\": 12345," +
    "\"type\": \"...\"," +
    "\"user\": {" +
      "\"href\": \"...\"," +
      "\"id\": \"...\"" +
    "}" +
  "}," +
  "\"user\": {" +
    "\"href\": \"...\"," +
    "\"id\": \"...\"" +
  "}" +
"}";

OutputStream os = conn.getOutputStream();
os.write(inputBody.getBytes("UTF-8"));
os.close();

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

Example response

Headers:
  Location: http://appdirect/api/billing/v1/companies/e83cd3d6-7865-4fc2-9d7c-603ad17dd639/users/c47d0fd7-b67a-4e07-84f8-f93dfafbeecc/subscriptions/1b577640-9b77-47bc-beb8-ed59accb4836
{
  "assignedUsers": 1,
  "company": {
    "href": "http://appdirect/api/account/v1/companies/e83cd3d6-7865-4fc2-9d7c-603ad17dd639",
    "id": "e83cd3d6-7865-4fc2-9d7c-603ad17dd639"
  },
  "creationDate": 1481002406580,
  "edition": {
    "href": "http://appdirect/api/marketplace/v1/products/2/editions/2",
    "id": "2"
  },
  "endDate": null,
  "externalAccountId": "d2f4acf1-fb5a-4c4a-921f-75c4b6bfff08",
  "id": "1b577640-9b77-47bc-beb8-ed59accb4836",
  "maxUsers": 1,
  "order": {
    "activated": false,
    "company": {
      "href": "http://appdirect/api/account/v1/companies/e83cd3d6-7865-4fc2-9d7c-603ad17dd639",
      "id": "e83cd3d6-7865-4fc2-9d7c-603ad17dd639"
    },
    "contract": null,
    "currency": "USD",
    "discount": null,
    "discountId": null,
    "endDate": null,
    "endOfDiscountDate": null,
    "frequency": "MONTHLY",
    "id": 1,
    "links": [
      {
        "href": "http://appdirect/api/billing/v1/subscriptions/1b577640-9b77-47bc-beb8-ed59accb4836",
        "rel": "subscription"
      }
    ],
    "nextBillingDate": 1483599600000,
    "nextOrder": null,
    "oneTimeOrders": [],
    "orderLines": [
      {
        "description": "Test App 1 - null - Per User Fee",
        "id": 1,
        "listingPrice": 10,
        "price": 10,
        "quantity": 1,
        "totalPrice": 10,
        "type": "ITEM",
        "unit": "USER"
      }
    ],
    "parameters": [],
    "paymentPlan": {
      "allowCustomUsage": false,
      "contract": {
        "alignWithParentCycleStartDate": false,
        "autoExtensionPricingId": null,
        "blockContractDowngrades": false,
        "blockContractUpgrades": false,
        "blockSwitchToShorterContract": false,
        "cancellationPeriodLimit": null,
        "endOfContractGracePeriod": null,
        "gracePeriod": null,
        "minimumServiceLength": null,
        "terminationFee": null
      },
      "costs": [
        {
          "amount": {
            "USD": 10
          },
          "blockContractDecrease": false,
          "blockContractIncrease": false,
          "blockOriginalContractDecrease": false,
          "id": 2,
          "increment": 1,
          "maxUnits": null,
          "meteredUsage": false,
          "minUnits": 0,
          "pricePerIncrement": false,
          "pricingStrategy": "UNIT",
          "unit": "USER",
          "unitDependency": null
        }
      ],
      "discount": null,
      "frequency": "MONTHLY",
      "href": "http://appdirect/api/marketplace/v1/products/2/editions/2/paymentPlans/2",
      "id": 2,
      "isPrimaryPrice": false,
      "keepBillDateOnUsageChange": false,
      "primaryPrice": false,
      "separatePrepaid": false,
      "uuid": "eaca1aa5-4c4f-44cb-8cf4-eb0aa9267273"
    },
    "paymentPlanId": 2,
    "previousOrder": null,
    "referenceCode": null,
    "salesSupportUser": null,
    "startDate": 1480921200000,
    "status": "ACTIVE",
    "totalPrice": 0,
    "type": "NEW",
    "user": {
      "href": "http://appdirect/api/account/v1/users/c47d0fd7-b67a-4e07-84f8-f93dfafbeecc",
      "id": "c47d0fd7-b67a-4e07-84f8-f93dfafbeecc"
    }
  },
  "product": {
    "href": "http://appdirect/api/marketplace/v1/products/2",
    "id": "2"
  },
  "redirectUrl": null,
  "status": "ACTIVE",
  "upcomingOrder": null,
  "user": {
    "href": "http://appdirect/api/account/v1/users/c47d0fd7-b67a-4e07-84f8-f93dfafbeecc",
    "id": "c47d0fd7-b67a-4e07-84f8-f93dfafbeecc"
  }
}

POST /billing/v1/companies/{companyId}/users/{userId}/subscriptions

Create a subscription for the given user and company using the provided data

Parameters

Parameter Type Data Type Default Description
*companyId path string User's company ID
*userId path string User ID
sendNotification query boolean true Send notification of the subscription's creation. Default value is true.

Body Parameters

Subscription data object

Subscription object:

Property Type Description
assignedUsers number Number of users assigned to subscription
company LinkWS Link to company information
creationDate number Subscription creation date
edition LinkWS Link to edition information
endDate number Subscription end date
externalAccountId string External account identifier (from vendor)
id string ID
internalId string The UUID for a subscription
maxUsers number Maximum number of users allowed to be assigned to subscription
order Order Current order
product LinkWS Link to product information
redirectUrl string Interactive endpoint URL
status string Subscription status (Valid values are INITIALIZED, FAILED, FREE_TRIAL, FREE_TRIAL_EXPIRED, ACTIVE, SUSPENDED, or CANCELLED.)
upcomingOrder Order Upcoming order
user LinkWS Link to user information

Responses

Status Meaning Description Definition
201 Created Created Subscription
400 Bad Request Bad Request
404 Not Found Not Found
409 Conflict Conflict

Preview create a subscription

Example request


curl -X post \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data-binary @- https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions/preview <<EOF
{
  "assignedUsers": 12345,
  "company": {
    "href": "...",
    "id": "..."
  },
  "creationDate": 12345,
  "edition": {
    "href": "...",
    "id": "..."
  },
  "endDate": 12345,
  "externalAccountId": "...",
  "id": "...",
  "internalId": "...",
  "maxUsers": 12345,
  "order": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {
      "cancellationPeriodLimit": null,
      "endOfContractDate": 123451232,
      "endOfContractGracePeriod": null,
      "gracePeriodEndDate": null,
      "minimumServiceLength": 24,
      "renewal": null,
      "terminationFee": {
        "description": "Fee",
        "estimatedCost": 324.56,
        "percentage": 100,
        "price": null,
        "type": "PERCENTAGE"
      }
    },
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "product": {
    "href": "...",
    "id": "..."
  },
  "redirectUrl": "...",
  "status": "...",
  "upcomingOrder": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {},
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "user": {
    "href": "...",
    "id": "..."
  }
}
EOF

POST https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions/preview HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json

{
  "assignedUsers": 12345,
  "company": {
    "href": "...",
    "id": "..."
  },
  "creationDate": 12345,
  "edition": {
    "href": "...",
    "id": "..."
  },
  "endDate": 12345,
  "externalAccountId": "...",
  "id": "...",
  "internalId": "...",
  "maxUsers": 12345,
  "order": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {
      "cancellationPeriodLimit": null,
      "endOfContractDate": 123451232,
      "endOfContractGracePeriod": null,
      "gracePeriodEndDate": null,
      "minimumServiceLength": 24,
      "renewal": null,
      "terminationFee": {
        "description": "Fee",
        "estimatedCost": 324.56,
        "percentage": 100,
        "price": null,
        "type": "PERCENTAGE"
      }
    },
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "product": {
    "href": "...",
    "id": "..."
  },
  "redirectUrl": "...",
  "status": "...",
  "upcomingOrder": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {},
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "user": {
    "href": "...",
    "id": "..."
  }
}


var headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions/preview',
  method: 'post',
  dataType: 'json',
  data: {
  "assignedUsers": 12345,
  "company": {
    "href": "...",
    "id": "..."
  },
  "creationDate": 12345,
  "edition": {
    "href": "...",
    "id": "..."
  },
  "endDate": 12345,
  "externalAccountId": "...",
  "id": "...",
  "internalId": "...",
  "maxUsers": 12345,
  "order": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {
      "cancellationPeriodLimit": null,
      "endOfContractDate": 123451232,
      "endOfContractGracePeriod": null,
      "gracePeriodEndDate": null,
      "minimumServiceLength": 24,
      "renewal": null