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 Wed Sep 11 2019 09:54:36 GMT-0400 (EDT)

Discounts

Create discounts

Example request

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

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

var headers = {
    'Content-Type':'application/json',
    'Accept':'application/json'
};
$.ajax({
  url: 'https://{marketplaceURL}/api/channel/v1/discounts',
  method: 'post',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})

const request = require('node-fetch');
const inputBody = '{
  "allOf": [
    {
      "description": "Discount details",
      "type": "object",
      "title": "Discount",
      "required": [
        "type",
        "description"
      ],
      "properties": {
        "applicationId": {
          "description": "Application ID.",
          "nullable": true,
          "type": "number"
        },
        "applicationName": {
          "description": "Name of the application to which the discount applies.",
          "nullable": true,
          "type": "string"
        },
        "autoApply": {
          "description": "True if the discount is automatically applied. Default value is true.",
          "type": "boolean"
        },
        "basePartnerSharePercentage": {
          "description": "Base partner's percentage share of the discount.",
          "nullable": true,
          "type": "number"
        },
        "billingCycles": {
          "description": "Number of billing cycles for which the discount should be applied.",
          "nullable": true,
          "type": "number"
        },
        "code": {
          "description": "Discount code. Must be at least 4 characters, but no longer than 103 characters.",
          "nullable": true,
          "type": "string"
        },
        "createdOn": {
          "description": "Creation date of the discount.",
          "nullable": true,
          "type": "number"
        },
        "description": {
          "description": "Description of discount. Required field. Must be at least 4 characters, but no longer than 255 characters.",
          "type": "string"
        },
        "editionId": {
          "description": "Edition ID.",
          "nullable": true,
          "type": "number"
        },
        "expirationDate": {
          "description": "Expiration date for the discount. This date must be in the future.",
          "nullable": true,
          "type": "number"
        },
        "id": {
          "description": "Discount ID.",
          "nullable": true,
          "type": "number"
        },
        "industryId": {
          "description": "Industry ID.",
          "nullable": true,
          "type": "number"
        },
        "maxRedemptions": {
          "description": "Maximum number of redemptions available.",
          "nullable": true,
          "type": "number"
        },
        "maxUnits": {
          "description": "Maximum number of units for which to apply the discount.",
          "type": "number"
        },
        "minUnits": {
          "description": "Minimum number of units for which to apply the discount.",
          "type": "number"
        },
        "partnerSharePercentage": {
          "description": "Partner's percentage share of the discount.",
          "nullable": true,
          "type": "number"
        },
        "paymentPlanId": {
          "description": "Payment plan ID.",
          "nullable": true,
          "type": "number"
        },
        "percentage": {
          "description": "Percentage discount if discount is of PERCENTAGE type. The percentage value cannot exceed two decimal places (for example, 10.15).",
          "type": "number"
        },
        "price": {
          "description": "Amount to discount if discount is of FIXED_PRICE type.",
          "nullable": true,
          "type": "number"
        },
        "redemptionRestriction": {
          "allOf": [
            {
              "type": "string",
              "title": "RedemptionRestriction",
              "properties": {
                "RedemptionRestriction": {
                  "type": "string",
                  "enum": [
                    "NONE",
                    "ONCE_PER_USER",
                    "ONCE_PER_COMPANY"
                  ]
                }
              }
            },
            {
              "description": "Redemption restriction. May be NONE, ONCE_PER_USER, or ONCE_PER_COMPANY. Default value is NONE."
            }
          ]
        },
        "redemptions": {
          "description": "Number of times the discount has been redeemed.",
          "type": "number"
        },
        "retainable": {
          "description": "True if the discount is retainable. Retainable discounts can be redeemed on orders that are updated after the discount expires. For example, if an order includes a discount that expires on 01 January 2019, and the order is then updated on 02 January 2019, the discount would still be redeemable. The default value is false (discounts are not retained).",
          "type": "boolean"
        },
        "startDate": {
          "description": "Start date for the discount.",
          "nullable": true,
          "type": "number"
        },
        "type": {
          "allOf": [
            {
              "type": "string",
              "title": "DiscountType",
              "properties": {
                "DiscountType": {
                  "type": "string",
                  "enum": [
                    "PERCENTAGE",
                    "FIXED_PRICE"
                  ]
                }
              }
            },
            {
              "description": "Discount type. Required field. May be PERCENTAGE or FIXED_PRICE."
            }
          ]
        },
        "unit": {
          "allOf": [
            {
              "type": "string",
              "title": "PricingUnit",
              "enum": [
                "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",
                "PHONE_NUMBER",
                "GUEST",
                "REVISION_SAFE_DATAROOM",
                "GROUP_SESSION",
                "MAILBOX_AD_SYNC",
                "PHONE_SUPPORT",
                "EXTRA_10TB",
                "EXTRA_50TB",
                "EXTRA_200TB",
                "MAP_VIEW",
                "SVM",
                "CHANNEL",
                "NUMBER_PRINTER_TABLET",
                "NUMBER_ONSITE_SERVER",
                "NUMBER_VISITS",
                "ONSITE_TECHNICIAN_PC",
                "ONSITE_TECHNICIAN_SERVER",
                "SHORTER_REACTION_TIMES",
                "E_COMMERCE_INTEGRATION",
                "LOCATION",
                "TRAINING_SESSION",
                "PRORATED_CREDIT"
              ]
            },
            {
              "description": "Pricing unit. May be USER, GIGABYTE, MEGABYTE, HOUR, MINUTE, INVOICE, UNIT, PROJECT, PROPERTY, ITEM, WORD,\nEMAIL, CONTACT, CALL, CREDIT, ROOM, HOST, AGENT, OPERATOR, PROVIDER, MANAGER, TESTER, JVM, SERVER, WEB_USE_MINUTE,\nAUDIO_USE_MINUTE, PIECE, EMPLOYEE_PAY_PERIOD, EMPLOYEE_PER_PAY_PERIOD, COMPUTER, NOT_APPLICABLE, ONE_TIME_SETUP,\nDATA_POINTS, TIER1_API_CALLS, TIER2_API_CALLS, ADVISORY_HOURS, OVERAGE_AUDIO_MINUTE, EMPLOYEE, CONNECTION,\nPUSH_USER, THOUSAND_EMAILS_PER_DAY, PUSH_NOTIFICATION_DEVICES, API_CALLS, SMS_TEXT_MESSAGE, CONTACTS_1000, CONTRACT_FEE,\nTRANSFER_FEE, REACTIVATION_FEE, RECIPIENT, ADDITIONAL_1000_CONTACTS_BLOCK, SCHEDULE_PLAN, EMAILS_1000, EMAILS_2500,\nMOBILE_DEVICE, PAYSLIP, PAYSLIP_CORRECTION, STORE, WEBSITE, EPAPER, PAGE, POSTAGE_AND_PRINT, INTERNATIONAL_POSTAGE_AND_PRINT,\nTIER1_TOP_LEVEL_DOMAIN, TIER2_TOP_LEVEL_DOMAIN, DEDICATED_IP, ENABLELCM, MAXCOMPONENTS, DATA_MANAGEMENT_USER, SPECIALIST_USER,\nPROFESSIONAL_USER, MATERIALITY_MATRIX, STAKEHOLDER_MANAGEMENT, SCORECARD, STANDARD_MAPPING, DONATION_MANAGEMENT, DOCUMENT,\nPACKAGE_SMALL, PACKAGE_LARGE, MEMBER, ATTENDEE, MAILING, RESPONSE, EXTERNAL_INVOICE_FEE, CLIENT_TEST, IMAGE_TRANSFORMATION,\nTOTAL_IMAGE, LICENSE, MAILBOX, FREE_40_INCH_HDTV_PC, FREE_46_INCH_HDTV_PC, FREE_46_INCH_HDTV_PC_MOUNTING, EMPLOYEE_PER_WEEK,\nREGISTER, END_USER, CORE, DEVICE, PORT, MEASURER, PUBLISHED_MEASUREMENT, NODE, SERVER_RULE, VPN_LP, PROXY_LP,\nDESKTOP_CONNECT_LP, CAMERA, MAIN_SOUND_ZONE, SUB_SOUND_ZONE, POST, REPORT, BOX, SESSION, DISPLAY, TRUCKROLL, TRANSACTION_FEE,\nSENDING_API_CALL, LOOKUP_API_CALL, ANALYTICS_API_CALL, MIGRATION_INSTANCE, NFON_SETUP_PER_PHONE_EXTENSION,\nNFON_SETUP_PER_PHONE_EXTENSION_PLUS, NFON_SETUP_PER_EFAX_EXTENSION, NFON_PHONE_EXTENSION, NFON_PHONE_EXTENSION_PLUS,\nNFON_EFAX_EXTENSION, NFON_CALL_CENTER_MONITORING, NFON_NMEETING, NFON_MOBILE_NFON_DEVICE, NFON_ISOFTPHONE_MAC,\nNFON_NSOFTPHONE_STANDARD_WINDOWS, NFON_NSOFTPHONE_PREMIUM_WINDOWS, NFON_NCTI_STANDARD_WINDOWS, NFON_NCTI_STANDARD_CRM_WINDOWS,\nNFON_NCTI_STANDARD_MAC, NFON_NSOFTPHONE_STANDARD_WINDOWS_OR_MOBILE, WESUSTAIN_PERFORMANCE, WESUSTAIN_STAKEHOLDER_REPUTATION,\nWESUSTAIN_WEAPP, FAX, FAX_LINE, ROOM_LINE, DEPARTMENT_LINE, INTERNATIONAL_LICENSE, INTERNATIONAL_DEPARTMENT_LINE,\nINTERNATIONAL_ROOM_LINE, INTERNATIONAL_LINE, CALLING_CREDIT, LINE, TOLLFREE_ROOM_LINE, TOLLFREE_DEPARTMENT_LINE,\nTAXES_AND_FEES, LEAD, OPPORTUNITY, CAMPAIGN, CASE, CUSTOMER, TIER1_STANDARD_LINE, TIER1_ROOM_LINE, TIER1_TOLLFREE_ROOM_LINE,\nTIER1_TOLLFREE_DEPARTMENT_LINE, TIER1_FAX_LINE, TIER1_DEPARTMENT_LINE, TIER2_STANDARD_LINE, TIER2_ROOM_LINE,\nTIER2_DEPARTMENT_LINE, TIER3_STANDARD_LINE, TIER3_ROOM_LINE, TIER3_DEPARTMENT_LINE, TIER4_STANDARD_LINE, TIER4_ROOM_LINE,\nTIER4_DEPARTMENT_LINE, CLUSTER, NODE_4VCPU, FIVE_HUNDRED_GB_SSD, TWELVE_TB_NETWORK_IO, JBOSS_EAP, JBOSS_FUSE, JBOSS_A_MQ,\nJBOSS_BRMS, JBOSS_BPM_SUITE, JBOSS_DATA_GRID, JBOSS_DATA_VIRT, USER_LICENSE, ADDITIONAL_NUMBER_LICENSE, ROOM_PHONE_LICENSE,\nUBERCONFERENCE_PRO_LICENSE, UBERCONFERENCE_PRO_LICENSE_UNBUNDLED, INSTANCE, INDOOR_CAMERA, OUTDOOR_CAMERA, VINGATE_LP_LICENCE,\nADMINISTRATOR, MOBILE_USER, T1, PHONE, AUTO_ATTENDANT, HUNT_GROUP, VOICEMAIL_BOX, TOLL_FREE_NUMBER,\nINBOUND_LONG_DISTANCE_MINUTE, OUTBOUND_LONG_DISTANCE_MINUTE, INBOUND_OUTBOUND_LONG_DISTANCE_MINUTE, SET_TOP_BOX, MODEM,\nACCESS_POINT, CALLING_FEATURE, IAD_DEVICE, ANALOG_LINE, PRI, SBC_DEVICE, ROUTER, INTERNATIONAL_MINUTE, PHONE_LINE,\nDYNAMIC_IP_ADDRESS, STATIC_IP_ADDRESS, GATEWAY, REMOTE_CONTROL, TIER1_STANDARD_SEAT, TIER2_STANDARD_SEAT, TIER3_STANDARD_SEAT,\nTIER4_STANDARD_SEAT, TIER1_TOLL_FREE_SEAT, MILLION_MESSAGES, MESSAGE, WEEKLY, or PHONE_NUMBER."
            }
          ]
        },
        "vendorSharePercentage": {
          "description": "Vendor's percentage share of the discount.",
          "nullable": true,
          "type": "number"
        }
      }
    },
    {
      "example": {
        "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,
        "retainable": false,
        "startDate": null,
        "type": "PERCENTAGE",
        "unit": "USER",
        "vendorSharePercentage": 50
      }
    }
  ]
}';
const headers = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

URL obj = new URL("https://{marketplaceURL}/api/channel/v1/discounts");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
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());

Request body

{
  "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,
  "retainable": false,
  "startDate": null,
  "type": "PERCENTAGE",
  "unit": "USER",
  "vendorSharePercentage": 50
}

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,
  "retainable": false,
  "startDate": null,
  "type": "PERCENTAGE",
  "unit": "USER",
  "vendorSharePercentage": 50
}

POST/channel/v1/discounts

Creates a discount with the provided data. Note that percentage discounts cannot exceed two decimal places (for example, 10.15).

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. The percentage value cannot exceed two decimal places (for example, 10.15).

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.

retainable boolean

True if the discount is retainable. Retainable discounts can be redeemed on orders that are updated after the discount expires. For example, if an order includes a discount that expires on 01 January 2019, and the order is then updated on 02 January 2019, the discount would still be redeemable. The default value is false (discounts are not retained).

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

Delete discounts

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 = {
    'Content-Type':'application/json',
    'Accept':'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 = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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}

Deletes the discount with the specified 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

Retrieve discounts

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 = {
    'Content-Type':'application/json',
    'Accept':'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 = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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,
  "retainable": false,
  "startDate": null,
  "type": "PERCENTAGE",
  "unit": "USER",
  "vendorSharePercentage": null
}

GET/channel/v1/discounts/{discountId}

Retrieves 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

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 = {
    'Content-Type':'application/json',
    'Accept':'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 = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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

[
  {
    "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,
    "retainable": false,
    "startDate": null,
    "type": "PERCENTAGE",
    "unit": "USER",
    "vendorSharePercentage": null
  }
]

GET/channel/v1/discounts

Lists all available discounts. The parameters can be used to filter the results.

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
START_DATE
CREATED_ON Sort field. Default value is creation 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 array of Discount
404 Not Found Not Found

Update discounts

Example request

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

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

var headers = {
    'Content-Type':'application/json',
    'Accept':'application/json'
};
$.ajax({
  url: 'https://{marketplaceURL}/api/channel/v1/discounts/{discountId}',
  method: 'put',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})

const request = require('node-fetch');
const inputBody = '{
  "allOf": [
    {
      "description": "Discount details",
      "type": "object",
      "title": "Discount",
      "required": [
        "type",
        "description"
      ],
      "properties": {
        "applicationId": {
          "description": "Application ID.",
          "nullable": true,
          "type": "number"
        },
        "applicationName": {
          "description": "Name of the application to which the discount applies.",
          "nullable": true,
          "type": "string"
        },
        "autoApply": {
          "description": "True if the discount is automatically applied. Default value is true.",
          "type": "boolean"
        },
        "basePartnerSharePercentage": {
          "description": "Base partner's percentage share of the discount.",
          "nullable": true,
          "type": "number"
        },
        "billingCycles": {
          "description": "Number of billing cycles for which the discount should be applied.",
          "nullable": true,
          "type": "number"
        },
        "code": {
          "description": "Discount code. Must be at least 4 characters, but no longer than 103 characters.",
          "nullable": true,
          "type": "string"
        },
        "createdOn": {
          "description": "Creation date of the discount.",
          "nullable": true,
          "type": "number"
        },
        "description": {
          "description": "Description of discount. Required field. Must be at least 4 characters, but no longer than 255 characters.",
          "type": "string"
        },
        "editionId": {
          "description": "Edition ID.",
          "nullable": true,
          "type": "number"
        },
        "expirationDate": {
          "description": "Expiration date for the discount. This date must be in the future.",
          "nullable": true,
          "type": "number"
        },
        "id": {
          "description": "Discount ID.",
          "nullable": true,
          "type": "number"
        },
        "industryId": {
          "description": "Industry ID.",
          "nullable": true,
          "type": "number"
        },
        "maxRedemptions": {
          "description": "Maximum number of redemptions available.",
          "nullable": true,
          "type": "number"
        },
        "maxUnits": {
          "description": "Maximum number of units for which to apply the discount.",
          "type": "number"
        },
        "minUnits": {
          "description": "Minimum number of units for which to apply the discount.",
          "type": "number"
        },
        "partnerSharePercentage": {
          "description": "Partner's percentage share of the discount.",
          "nullable": true,
          "type": "number"
        },
        "paymentPlanId": {
          "description": "Payment plan ID.",
          "nullable": true,
          "type": "number"
        },
        "percentage": {
          "description": "Percentage discount if discount is of PERCENTAGE type. The percentage value cannot exceed two decimal places (for example, 10.15).",
          "type": "number"
        },
        "price": {
          "description": "Amount to discount if discount is of FIXED_PRICE type.",
          "nullable": true,
          "type": "number"
        },
        "redemptionRestriction": {
          "allOf": [
            {
              "type": "string",
              "title": "RedemptionRestriction",
              "properties": {
                "RedemptionRestriction": {
                  "type": "string",
                  "enum": [
                    "NONE",
                    "ONCE_PER_USER",
                    "ONCE_PER_COMPANY"
                  ]
                }
              }
            },
            {
              "description": "Redemption restriction. May be NONE, ONCE_PER_USER, or ONCE_PER_COMPANY. Default value is NONE."
            }
          ]
        },
        "redemptions": {
          "description": "Number of times the discount has been redeemed.",
          "type": "number"
        },
        "retainable": {
          "description": "True if the discount is retainable. Retainable discounts can be redeemed on orders that are updated after the discount expires. For example, if an order includes a discount that expires on 01 January 2019, and the order is then updated on 02 January 2019, the discount would still be redeemable. The default value is false (discounts are not retained).",
          "type": "boolean"
        },
        "startDate": {
          "description": "Start date for the discount.",
          "nullable": true,
          "type": "number"
        },
        "type": {
          "allOf": [
            {
              "type": "string",
              "title": "DiscountType",
              "properties": {
                "DiscountType": {
                  "type": "string",
                  "enum": [
                    "PERCENTAGE",
                    "FIXED_PRICE"
                  ]
                }
              }
            },
            {
              "description": "Discount type. Required field. May be PERCENTAGE or FIXED_PRICE."
            }
          ]
        },
        "unit": {
          "allOf": [
            {
              "type": "string",
              "title": "PricingUnit",
              "enum": [
                "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",
                "PHONE_NUMBER",
                "GUEST",
                "REVISION_SAFE_DATAROOM",
                "GROUP_SESSION",
                "MAILBOX_AD_SYNC",
                "PHONE_SUPPORT",
                "EXTRA_10TB",
                "EXTRA_50TB",
                "EXTRA_200TB",
                "MAP_VIEW",
                "SVM",
                "CHANNEL",
                "NUMBER_PRINTER_TABLET",
                "NUMBER_ONSITE_SERVER",
                "NUMBER_VISITS",
                "ONSITE_TECHNICIAN_PC",
                "ONSITE_TECHNICIAN_SERVER",
                "SHORTER_REACTION_TIMES",
                "E_COMMERCE_INTEGRATION",
                "LOCATION",
                "TRAINING_SESSION",
                "PRORATED_CREDIT"
              ]
            },
            {
              "description": "Pricing unit. May be USER, GIGABYTE, MEGABYTE, HOUR, MINUTE, INVOICE, UNIT, PROJECT, PROPERTY, ITEM, WORD,\nEMAIL, CONTACT, CALL, CREDIT, ROOM, HOST, AGENT, OPERATOR, PROVIDER, MANAGER, TESTER, JVM, SERVER, WEB_USE_MINUTE,\nAUDIO_USE_MINUTE, PIECE, EMPLOYEE_PAY_PERIOD, EMPLOYEE_PER_PAY_PERIOD, COMPUTER, NOT_APPLICABLE, ONE_TIME_SETUP,\nDATA_POINTS, TIER1_API_CALLS, TIER2_API_CALLS, ADVISORY_HOURS, OVERAGE_AUDIO_MINUTE, EMPLOYEE, CONNECTION,\nPUSH_USER, THOUSAND_EMAILS_PER_DAY, PUSH_NOTIFICATION_DEVICES, API_CALLS, SMS_TEXT_MESSAGE, CONTACTS_1000, CONTRACT_FEE,\nTRANSFER_FEE, REACTIVATION_FEE, RECIPIENT, ADDITIONAL_1000_CONTACTS_BLOCK, SCHEDULE_PLAN, EMAILS_1000, EMAILS_2500,\nMOBILE_DEVICE, PAYSLIP, PAYSLIP_CORRECTION, STORE, WEBSITE, EPAPER, PAGE, POSTAGE_AND_PRINT, INTERNATIONAL_POSTAGE_AND_PRINT,\nTIER1_TOP_LEVEL_DOMAIN, TIER2_TOP_LEVEL_DOMAIN, DEDICATED_IP, ENABLELCM, MAXCOMPONENTS, DATA_MANAGEMENT_USER, SPECIALIST_USER,\nPROFESSIONAL_USER, MATERIALITY_MATRIX, STAKEHOLDER_MANAGEMENT, SCORECARD, STANDARD_MAPPING, DONATION_MANAGEMENT, DOCUMENT,\nPACKAGE_SMALL, PACKAGE_LARGE, MEMBER, ATTENDEE, MAILING, RESPONSE, EXTERNAL_INVOICE_FEE, CLIENT_TEST, IMAGE_TRANSFORMATION,\nTOTAL_IMAGE, LICENSE, MAILBOX, FREE_40_INCH_HDTV_PC, FREE_46_INCH_HDTV_PC, FREE_46_INCH_HDTV_PC_MOUNTING, EMPLOYEE_PER_WEEK,\nREGISTER, END_USER, CORE, DEVICE, PORT, MEASURER, PUBLISHED_MEASUREMENT, NODE, SERVER_RULE, VPN_LP, PROXY_LP,\nDESKTOP_CONNECT_LP, CAMERA, MAIN_SOUND_ZONE, SUB_SOUND_ZONE, POST, REPORT, BOX, SESSION, DISPLAY, TRUCKROLL, TRANSACTION_FEE,\nSENDING_API_CALL, LOOKUP_API_CALL, ANALYTICS_API_CALL, MIGRATION_INSTANCE, NFON_SETUP_PER_PHONE_EXTENSION,\nNFON_SETUP_PER_PHONE_EXTENSION_PLUS, NFON_SETUP_PER_EFAX_EXTENSION, NFON_PHONE_EXTENSION, NFON_PHONE_EXTENSION_PLUS,\nNFON_EFAX_EXTENSION, NFON_CALL_CENTER_MONITORING, NFON_NMEETING, NFON_MOBILE_NFON_DEVICE, NFON_ISOFTPHONE_MAC,\nNFON_NSOFTPHONE_STANDARD_WINDOWS, NFON_NSOFTPHONE_PREMIUM_WINDOWS, NFON_NCTI_STANDARD_WINDOWS, NFON_NCTI_STANDARD_CRM_WINDOWS,\nNFON_NCTI_STANDARD_MAC, NFON_NSOFTPHONE_STANDARD_WINDOWS_OR_MOBILE, WESUSTAIN_PERFORMANCE, WESUSTAIN_STAKEHOLDER_REPUTATION,\nWESUSTAIN_WEAPP, FAX, FAX_LINE, ROOM_LINE, DEPARTMENT_LINE, INTERNATIONAL_LICENSE, INTERNATIONAL_DEPARTMENT_LINE,\nINTERNATIONAL_ROOM_LINE, INTERNATIONAL_LINE, CALLING_CREDIT, LINE, TOLLFREE_ROOM_LINE, TOLLFREE_DEPARTMENT_LINE,\nTAXES_AND_FEES, LEAD, OPPORTUNITY, CAMPAIGN, CASE, CUSTOMER, TIER1_STANDARD_LINE, TIER1_ROOM_LINE, TIER1_TOLLFREE_ROOM_LINE,\nTIER1_TOLLFREE_DEPARTMENT_LINE, TIER1_FAX_LINE, TIER1_DEPARTMENT_LINE, TIER2_STANDARD_LINE, TIER2_ROOM_LINE,\nTIER2_DEPARTMENT_LINE, TIER3_STANDARD_LINE, TIER3_ROOM_LINE, TIER3_DEPARTMENT_LINE, TIER4_STANDARD_LINE, TIER4_ROOM_LINE,\nTIER4_DEPARTMENT_LINE, CLUSTER, NODE_4VCPU, FIVE_HUNDRED_GB_SSD, TWELVE_TB_NETWORK_IO, JBOSS_EAP, JBOSS_FUSE, JBOSS_A_MQ,\nJBOSS_BRMS, JBOSS_BPM_SUITE, JBOSS_DATA_GRID, JBOSS_DATA_VIRT, USER_LICENSE, ADDITIONAL_NUMBER_LICENSE, ROOM_PHONE_LICENSE,\nUBERCONFERENCE_PRO_LICENSE, UBERCONFERENCE_PRO_LICENSE_UNBUNDLED, INSTANCE, INDOOR_CAMERA, OUTDOOR_CAMERA, VINGATE_LP_LICENCE,\nADMINISTRATOR, MOBILE_USER, T1, PHONE, AUTO_ATTENDANT, HUNT_GROUP, VOICEMAIL_BOX, TOLL_FREE_NUMBER,\nINBOUND_LONG_DISTANCE_MINUTE, OUTBOUND_LONG_DISTANCE_MINUTE, INBOUND_OUTBOUND_LONG_DISTANCE_MINUTE, SET_TOP_BOX, MODEM,\nACCESS_POINT, CALLING_FEATURE, IAD_DEVICE, ANALOG_LINE, PRI, SBC_DEVICE, ROUTER, INTERNATIONAL_MINUTE, PHONE_LINE,\nDYNAMIC_IP_ADDRESS, STATIC_IP_ADDRESS, GATEWAY, REMOTE_CONTROL, TIER1_STANDARD_SEAT, TIER2_STANDARD_SEAT, TIER3_STANDARD_SEAT,\nTIER4_STANDARD_SEAT, TIER1_TOLL_FREE_SEAT, MILLION_MESSAGES, MESSAGE, WEEKLY, or PHONE_NUMBER."
            }
          ]
        },
        "vendorSharePercentage": {
          "description": "Vendor's percentage share of the discount.",
          "nullable": true,
          "type": "number"
        }
      }
    },
    {
      "example": {
        "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,
        "retainable": false,
        "startDate": null,
        "type": "PERCENTAGE",
        "unit": "USER",
        "vendorSharePercentage": 50
      }
    }
  ]
}';
const headers = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

URL obj = new URL("https://{marketplaceURL}/api/channel/v1/discounts/{discountId}");
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());

Request body

{
  "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,
  "retainable": false,
  "startDate": null,
  "type": "PERCENTAGE",
  "unit": "USER",
  "vendorSharePercentage": 50
}

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,
  "retainable": false,
  "startDate": null,
  "type": "PERCENTAGE",
  "unit": "USER",
  "vendorSharePercentage": 50
}

PUT/channel/v1/discounts/{discountId}

Updates the specified discount with the provided data. Note that percentage discounts cannot exceed two decimal places (for example, 10.15).

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. The percentage value cannot exceed two decimal places (for example, 10.15).

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.

retainable boolean

True if the discount is retainable. Retainable discounts can be redeemed on orders that are updated after the discount expires. For example, if an order includes a discount that expires on 01 January 2019, and the order is then updated on 02 January 2019, the discount would still be redeemable. The default value is false (discounts are not retained).

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

Invoices

Pay an Invoice

Example request

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

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

var headers = {
    'Content-Type':'application/json',
    'Accept':'application/json'
};
$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}/payments',
  method: 'post',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})

const request = require('node-fetch');
const inputBody = '{
  "allOf": [
    {
      "allOf": [
        {
          "description": "Resource links",
          "title": "ResourceSupport",
          "properties": {
            "links": {
              "description": "Resource links",
              "type": "array",
              "items": {
                "title": "Link",
                "properties": {
                  "href": {
                    "type": "string"
                  },
                  "rel": {
                    "type": "string"
                  }
                },
                "example": {
                  "href": "...",
                  "rel": "..."
                },
                "nullable": true,
                "type": "object"
              }
            }
          },
          "example": {
            "links": [
              {
                "href": "...",
                "rel": "..."
              },
              {
                "href": "...",
                "rel": "..."
              }
            ]
          },
          "nullable": true,
          "type": "object"
        },
        {
          "type": "object",
          "title": "Payment",
          "properties": {
            "amount": {
              "description": "Payment amount.",
              "nullable": true,
              "type": "number"
            },
            "company": {
              "allOf": [
                {
                  "title": "LinkWS",
                  "properties": {
                    "href": {},
                    "id": {}
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object"
                },
                {
                  "description": "Link to company information."
                }
              ]
            },
            "currency": {
              "allOf": [
                {
                  "description": "Supported currencies for the system",
                  "type": "string",
                  "title": "Currency",
                  "enum": [
                    "USD",
                    "CAD",
                    "EUR",
                    "JPY",
                    "GBP",
                    "KRW",
                    "CHF",
                    "SEK",
                    "SGD",
                    "MYR",
                    "AUD",
                    "MXN",
                    "INR",
                    "BRL",
                    "DKK",
                    "NZD",
                    "NOK",
                    "ZAR",
                    "PHP",
                    "CNY",
                    "SAR",
                    "GTQ"
                  ]
                },
                {
                  "description": "Payment currency."
                }
              ]
            },
            "date": {
              "description": "Payment date.",
              "nullable": true,
              "type": "number"
            },
            "gatewayResponse": {
              "allOf": [
                {
                  "type": "object",
                  "title": "GatewayResponse",
                  "properties": {
                    "avs": {},
                    "code": {},
                    "cvv": {},
                    "message": {}
                  },
                  "example": {
                    "avs": true,
                    "code": "...",
                    "cvv": true,
                    "message": "..."
                  }
                },
                {
                  "description": "Gateway response"
                }
              ]
            },
            "id": {
              "description": "Payment number.",
              "nullable": true,
              "type": "number"
            },
            "method": {
              "allOf": [
                {
                  "description": "The supported payment methods",
                  "type": "string",
                  "title": "PaymentMethod",
                  "enum": [
                    "CREDIT_CARD",
                    "PAYPAL",
                    "MANUAL",
                    "EXTERNAL_INVOICE",
                    "MARKETPLACE_CREDITS"
                  ]
                },
                {
                  "description": "Payment method. Includes CREDIT_CARD, PAYPAL, and MANUAL."
                }
              ]
            },
            "result": {
              "allOf": [
                {
                  "type": "string",
                  "title": "PaymentResult",
                  "enum": [
                    "SUCCESSFUL",
                    "FAILED",
                    "GATEWAY_NOT_AVAILABLE",
                    "MANUAL"
                  ]
                },
                {
                  "description": "Payment result. May be SUCCESSFUL, FAILED , GATEWAY_NOT_AVAILABLE, or MANUAL."
                }
              ]
            },
            "transactionId": {
              "description": "Transaction ID.",
              "nullable": true,
              "type": "string"
            },
            "user": {
              "allOf": [
                {
                  "title": "LinkWS",
                  "properties": {
                    "href": {},
                    "id": {}
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object"
                },
                {
                  "description": "Link to user information."
                }
              ]
            }
          },
          "example": {
            "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": "..."
            }
          }
        }
      ]
    },
    {
      "description": "Payment data object."
    }
  ]
}';
const headers = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

URL obj = new URL("https://{marketplaceURL}/api/billing/v1/invoices/{invoiceNumber}/payments");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
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());

Request body

{
  "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": "..."
  }
}

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

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 = {
    'Content-Type':'application/json',
    'Accept':'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 = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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
count query string 250 Number of results to fetch. Used for paging.
fromDate query number From date.
*invoiceNumber path integer Invoice number.
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 array of Payment
204 No Content No Content array of Payment
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 = {
    'Content-Type':'application/json',
    'Accept':'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 = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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 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 = {
    'Content-Type':'application/json',
    'Accept':'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 = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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
buyerRole query string of enum:
ALL
CUSTOMER
RESELLER
SALES_SUPPORT
Filter invoices with purchases made by user with this role.
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.

Responses

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

Metered Usage

Bill Usage

Example request

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

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

var headers = {
    'Content-Type':'application/json',
    'Accept':'application/json'
};
$.ajax({
  url: 'https://{marketplaceURL}/api/integration/v1/billing/usage',
  method: 'post',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})

const request = require('node-fetch');
const inputBody = '{
  "allOf": [
    {
      "type": "object",
      "title": "UsageBean",
      "properties": {
        "account": {
          "allOf": [
            {
              "title": "AccountInfo",
              "properties": {
                "accountIdentifier": {
                  "description": "Account identifier",
                  "nullable": true,
                  "type": "string"
                },
                "parentAccountIdentifier": {
                  "description": "Parent account identifier. Applies to add-on products.",
                  "nullable": true,
                  "type": "string"
                },
                "status": {
                  "allOf": [
                    {},
                    {}
                  ]
                }
              },
              "example": {
                "accountIdentifier": "...",
                "parentAccountIdentifier": "...",
                "status": "INITIALIZED"
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Account information"
            }
          ]
        },
        "addonInstance": {
          "allOf": [
            {
              "type": "object",
              "title": "AddonInstanceInfo",
              "properties": {
                "id": {
                  "description": "ID",
                  "nullable": true,
                  "type": "string"
                }
              },
              "example": {
                "id": "..."
              }
            },
            {
              "description": "Add-on instance information"
            }
          ]
        },
        "item": {
          "type": "array",
          "items": {
            "type": "object",
            "title": "UsageItemBean",
            "properties": {
              "customUnit": {
                "nullable": true,
                "type": "string"
              },
              "description": {
                "nullable": true,
                "type": "string"
              },
              "price": {
                "nullable": true,
                "type": "number"
              },
              "quantity": {
                "nullable": true,
                "type": "number"
              },
              "unit": {
                "type": "string",
                "title": "PricingUnit",
                "enum": [
                  "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",
                  "PHONE_NUMBER",
                  "GUEST",
                  "REVISION_SAFE_DATAROOM",
                  "GROUP_SESSION",
                  "MAILBOX_AD_SYNC",
                  "PHONE_SUPPORT",
                  "EXTRA_10TB",
                  "EXTRA_50TB",
                  "EXTRA_200TB",
                  "MAP_VIEW",
                  "SVM",
                  "CHANNEL",
                  "NUMBER_PRINTER_TABLET",
                  "NUMBER_ONSITE_SERVER",
                  "NUMBER_VISITS",
                  "ONSITE_TECHNICIAN_PC",
                  "ONSITE_TECHNICIAN_SERVER",
                  "SHORTER_REACTION_TIMES",
                  "E_COMMERCE_INTEGRATION",
                  "LOCATION",
                  "TRAINING_SESSION",
                  "PRORATED_CREDIT"
                ]
              }
            },
            "example": {
              "customUnit": "...",
              "description": "...",
              "price": 12345,
              "quantity": 12345,
              "unit": "OPERATOR"
            }
          }
        }
      },
      "example": {
        "account": {
          "accountIdentifier": "...",
          "parentAccountIdentifier": "...",
          "status": "CANCELLED"
        },
        "addonInstance": {
          "id": "..."
        },
        "item": [
          {
            "customUnit": "...",
            "description": "...",
            "price": 12345,
            "quantity": 12345,
            "unit": "TIER3_STANDARD_LINE"
          },
          {
            "customUnit": "...",
            "description": "...",
            "price": 12345,
            "quantity": 12345,
            "unit": "CONTACTS_1000"
          }
        ]
      }
    },
    {
      "description": "Usage data information.",
      "example": {
        "account": {
          "accountIdentifier": "1-account-identifier",
          "parentAccountIdentifier": null,
          "status": "INITIALIZED"
        },
        "addonInstance": null,
        "items": [
          {
            "customUnit": null,
            "description": null,
            "price": null,
            "quantity": 10,
            "unit": "GIGABYTE"
          }
        ]
      }
    }
  ]
}';
const headers = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('https://{marketplaceURL}/api/integration/v1/billing/usage', params={

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

result = RestClient.post 'https://{marketplaceURL}/api/integration/v1/billing/usage',
  params: {
  }, headers: headers

p JSON.parse(result)

URL obj = new URL("https://{marketplaceURL}/api/integration/v1/billing/usage");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
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());

Request body

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

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

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 = {
    'Content-Type':'application/json',
    'Accept':'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 = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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

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 = {
    'Content-Type':'application/json',
    'Accept':'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 = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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",
  "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 = {
    'Content-Type':'application/json',
    'Accept':'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 = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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",
  "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

Payments

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 = {
    'Content-Type':'application/json',
    'Accept':'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 = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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
count query string 250 Number of results to fetch. Used for paging.
excludeFree query boolean Exclude free invoices
fromDate query number From date
*paymentNumber path integer Payment number
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 array of InvoiceListing
204 No Content No content array of InvoiceListing
404 Not Found Not Found

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 = {
    'Content-Type':'application/json',
    'Accept':'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 = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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 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 = {
    'Content-Type':'application/json',
    'Accept':'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 = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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"
    }
  }
]

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 array of Payment
204 No Content No content array of Payment

Product Context

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 = {
    'Content-Type':'application/json',
    'Accept':'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 = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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

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 = {
    'Content-Type':'application/json',
    'Accept':'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 = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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

Purchase Orders

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 = {
    'Content-Type':'application/json',
    'Accept':'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 = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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
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
*orderId path number The specific order id for which information is requested
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 array of 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 = {
    'Content-Type':'application/json',
    'Accept':'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 = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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
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
*orderId path number The specific order id for which information is requested
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 array of Payment
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 = {
    'Content-Type':'application/json',
    'Accept':'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 = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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": [],
  "parentSubscriptionId": 5,
  "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,
  "salesSupportCompany": null,
  "salesSupportUser": null,
  "serviceStartDate": 1483679427061,
  "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
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
*orderId path number The specific order id for which information is requested

Responses

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

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 = {
    'Content-Type':'application/json',
    'Accept':'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 = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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": [],
      "parentSubscriptionId": 5,
      "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,
      "salesSupportCompany": null,
      "salesSupportUser": null,
      "serviceStartDate": 1483679427061,
      "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
applicationIds query number Filters orders by internal application ID
currency query string of enum:
USD
CAD
EUR
JPY
GBP
KRW
CHF
SEK
SGD
MYR
AUD
MXN
INR
BRL
DKK
NZD
NOK
ZAR
PHP
CNY
SAR
GTQ
IDR
ARS
COP
PEN
Filters orders by currency
frequency query string of enum:
ONE_TIME
MONTHLY
QUARTERLY
SIX_MONTHS
YEARLY
TWO_YEARS
THREE_YEARS
DAILY
Filters orders by payment frequency
fromCreationDate query number Filters results to only include subscriptions that were created on or after the specified date
orderReferenceCode query string Filters orders by order reference code
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 50 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.
startDateFrom query number Filters results to only include subscriptions that were started on or after the specified date
startDateTo query number Filters results to only include subscriptions that were started on or before the specified date
status query string of enum:
INITIALIZED
PENDING_USER_APPROVAL
PENDING_REMOTE_CREATION
PENDING_MANUAL_RECOVERY
PENDING_ASYNCHRONOUS_CREATION
FREE_TRIAL
ACTIVE
FINISHED
ONE_TIME
CANCELLED
SUSPENDED
FREE_TRIAL_EXPIRED
FREE_TRIAL_CANCELLED
DELETED
FAILED
UPCOMING
PENDING_MIGRATION_ACTIVATION
PENDING_DELAYED_PROVISIONING
Filters orders with an order status
toCreationDate query number Filters results to only include subscriptions that were created on or before the specified date
type query string of enum:
NEW
MIGRATION
ADOPTION
FREE_TRIAL_ACTIVATION
TERMINATION_FEE
END_OF_CONTRACT_MIGRATION
REFUND
CREDIT
ONE_TIME_FEE
ADDITIONAL_FEE
END_OF_DISCOUNT_MIGRATION
METERED_USAGE
Filters orders by type.
NEW: The first order of a subscription. The order contains flat fees (one time or recurring) for this subscription. It is active until the subscription is updated or canceled.
MIGRATION: The order created after a subscription change. The order includes flat fees for both one-time and recurring editions.
ADOPTION: The order created by an administrator who has taken ownership of an application from another user within the same company.
FREE_TRIAL_ACTIVATION: Created when a free trial is manually upgraded to a paid subscription. Any subscription that is updated from free trial to paid automatically keeps its NEW status purchase order.
TERMINATION_FEE: A subscription is canceled that had a termination fee. This purchase order represents the fees incurred as a result of the cancellation.
END_OF_CONTRACT_MIGRATION: Created when a subscription update takes place as a result of a contract extension. If the contract autorenewal is set to either continue without a contract or renew the contract with the same pricing plan, then no migration occurs and the original purchase order is updated to include the new end date for the contract.
REFUND: Created when a refund is performed. The refund purchase order is created for only on-platform refunds. Off-platform refunds do not generate this type of purchase order.
CREDIT: Created during subscription update events. Any subscription update calculates a paid period and a credit period. The credit is then provided to the user to prorate the subscription.
ONE_TIME_FEE: Created if an edition includes one-time setup fees.
ADDITIONAL_FEE: Used for off-order charges. A developer change creates an off-order charge and charges their customer a custom amount outside of the normal subscription cycle.
END_OF_DISCOUNT_MIGRATION: Created after a discount of limited duration expires. This purchase order is created to represent the updated costs without the discount.
METERED_USAGE: A purchase order created to accumulate usage fees during a billing period. The order is only valid for the billing period but it is updated with usage lines over the course of the billing period. A metered purchase order is invoiced in arrears at the end of the billing cycle.

Responses

Status Meaning Description Definition
200 OK OK OrderListing
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 = {
    'Content-Type':'application/json',
    'Accept':'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 inputBody = '{
  "description": "List of parameters which needs to be update",
  "type": "array",
  "items": {
    "type": "object",
    "title": "Parameter",
    "properties": {
      "name": {
        "nullable": true,
        "type": "string"
      },
      "value": {
        "nullable": true,
        "type": "string"
      }
    },
    "example": {
      "name": "...",
      "value": "..."
    }
  }
}';
const headers = {
    'Content-Type':'application/json',
    'Accept':'application/json'
};
fetch('https://{marketplaceURL}/api/billing/v1/orders/{orderId}/parameters',
{
  method: 'PUT',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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

Reconciliation

Retrieve ledger lines

Example request

curl -X GET https://{marketplaceURL}/api/v3/reconciliation/ledgerLines?context=type,string,enum,RESELLER_MANAGER \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \

GET https://{marketplaceURL}/api/v3/reconciliation/ledgerLines?context=type,string,enum,RESELLER_MANAGER HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json

var headers = {
    'Content-Type':'application/json',
    'Accept':'application/json'
};
$.ajax({
  url: 'https://{marketplaceURL}/api/v3/reconciliation/ledgerLines',
  method: 'get',
  data: '?context=type,string,enum,RESELLER_MANAGER',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})

const request = require('node-fetch');

const headers = {
    'Content-Type':'application/json',
    'Accept':'application/json'
};
fetch('https://{marketplaceURL}/api/v3/reconciliation/ledgerLines?context=type,string,enum,RESELLER_MANAGER',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.get('https://{marketplaceURL}/api/v3/reconciliation/ledgerLines', params={
  'context': {
  "type": "string",
  "enum": [
    "RESELLER_MANAGER"
  ]
}
}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

result = RestClient.get 'https://{marketplaceURL}/api/v3/reconciliation/ledgerLines',
  params: {
  'context' => 'string'
}, headers: headers

p JSON.parse(result)

URL obj = new URL("https://{marketplaceURL}/api/v3/reconciliation/ledgerLines?context=type,string,enum,RESELLER_MANAGER");
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'
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
operationType query string of enum:
CREDIT
DEBIT
Filters by ledger line operation type
page query integer Page number to be returned in the result. Default value is 1
reconciliationType query string of enum:
ITEM
TAX
DISCOUNT
TERMINATION_FEE
ADJUSTMENT
RESELLER_MARKUP
CHANNEL_MARKUP
APPDIRECT_FEE
Filters by ledger line reconciliation type
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
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

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

Change subscription details

Example request

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

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

var headers = {
    'Content-Type':'application/json',
    'Accept':'application/json'
};
$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions/{subscriptionId}',
  method: 'put',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})

const request = require('node-fetch');
const inputBody = '{
  "allOf": [
    {
      "title": "Subscription",
      "properties": {
        "assignedUsers": {
          "description": "Number of users assigned to subscription",
          "nullable": true,
          "type": "number"
        },
        "company": {
          "allOf": [
            {
              "title": "LinkWS",
              "properties": {
                "href": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                }
              },
              "example": {
                "href": "...",
                "id": "..."
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Link to company information"
            }
          ]
        },
        "creationDate": {
          "description": "Subscription creation date",
          "nullable": true,
          "type": "number"
        },
        "edition": {
          "allOf": [
            {
              "title": "LinkWS",
              "properties": {
                "href": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                }
              },
              "example": {
                "href": "...",
                "id": "..."
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Link to edition information"
            }
          ]
        },
        "endDate": {
          "description": "Subscription end date",
          "nullable": true,
          "type": "number"
        },
        "externalAccountId": {
          "description": "External account identifier (from vendor)",
          "nullable": true,
          "type": "string"
        },
        "externalId": {
          "description": "External ID for a subscription",
          "nullable": true,
          "type": "string"
        },
        "id": {
          "description": "ID",
          "nullable": true,
          "type": "string"
        },
        "internalId": {
          "description": "The UUID for a subscription",
          "nullable": true,
          "type": "string"
        },
        "maxUsers": {
          "description": "Maximum number of users allowed to be assigned to subscription",
          "nullable": true,
          "type": "number"
        },
        "order": {
          "allOf": [
            {
              "allOf": [
                {
                  "description": "Resource links",
                  "title": "BaseOrder",
                  "properties": {
                    "_embedded": {},
                    "company": {},
                    "currency": {},
                    "endDate": {},
                    "endOfDiscountDate": {},
                    "frequency": {},
                    "id": {},
                    "links": {},
                    "nextBillingDate": {},
                    "parentSubscriptionId": {},
                    "referenceCode": {},
                    "salesSupportCompany": {},
                    "salesSupportUser": {},
                    "serviceStartDate": {},
                    "startDate": {},
                    "status": {},
                    "totalPrice": {},
                    "type": {},
                    "user": {}
                  },
                  "example": {
                    "_embedded": {},
                    "company": {},
                    "currency": "...",
                    "endDate": 12345,
                    "endOfDiscountDate": 12345,
                    "frequency": "...",
                    "id": 12345,
                    "links": [],
                    "nextBillingDate": 12345,
                    "parentSubscriptionId": 12345,
                    "referenceCode": "...",
                    "salesSupportCompany": {},
                    "salesSupportUser": {},
                    "serviceStartDate": 12345,
                    "startDate": 12345,
                    "status": "...",
                    "totalPrice": 12345,
                    "type": "...",
                    "user": {}
                  },
                  "nullable": true,
                  "type": "object"
                },
                {
                  "title": "Order",
                  "properties": {
                    "activated": {},
                    "contract": {},
                    "customAttributes": {},
                    "discount": {},
                    "discountId": {},
                    "nextOrder": {},
                    "oneTimeOrders": {},
                    "orderLines": {},
                    "parameters": {},
                    "paymentPlan": {},
                    "paymentPlanId": {},
                    "previousOrder": {}
                  },
                  "example": {
                    "_embedded": {},
                    "activated": true,
                    "company": {},
                    "contract": {},
                    "currency": "...",
                    "customAttributes": [],
                    "discount": {},
                    "discountId": 12345,
                    "endDate": 12345,
                    "endOfDiscountDate": 12345,
                    "frequency": "...",
                    "id": 12345,
                    "links": [],
                    "nextBillingDate": 12345,
                    "nextOrder": {},
                    "oneTimeOrders": [],
                    "orderLines": [],
                    "parameters": [],
                    "paymentPlan": {},
                    "paymentPlanId": 12345,
                    "previousOrder": {},
                    "referenceCode": "...",
                    "salesSupportUser": {},
                    "startDate": 12345,
                    "status": "...",
                    "totalPrice": 12345,
                    "type": "...",
                    "user": {}
                  },
                  "nullable": true,
                  "type": "object"
                }
              ]
            },
            {
              "description": "Current order"
            }
          ]
        },
        "product": {
          "allOf": [
            {
              "title": "LinkWS",
              "properties": {
                "href": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                }
              },
              "example": {
                "href": "...",
                "id": "..."
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Link to product information"
            }
          ]
        },
        "redirectUrl": {
          "description": "Interactive endpoint URL",
          "nullable": true,
          "type": "string"
        },
        "status": {
          "description": "Subscription status (Valid values are INITIALIZED, FAILED, FREE_TRIAL, FREE_TRIAL_EXPIRED, ACTIVE, SUSPENDED, or CANCELLED.)",
          "nullable": true,
          "type": "string"
        },
        "upcomingOrder": {
          "allOf": [
            {
              "allOf": [
                {
                  "description": "Resource links",
                  "title": "BaseOrder",
                  "properties": {
                    "_embedded": {},
                    "company": {},
                    "currency": {},
                    "endDate": {},
                    "endOfDiscountDate": {},
                    "frequency": {},
                    "id": {},
                    "links": {},
                    "nextBillingDate": {},
                    "parentSubscriptionId": {},
                    "referenceCode": {},
                    "salesSupportCompany": {},
                    "salesSupportUser": {},
                    "serviceStartDate": {},
                    "startDate": {},
                    "status": {},
                    "totalPrice": {},
                    "type": {},
                    "user": {}
                  },
                  "example": {
                    "_embedded": {},
                    "company": {},
                    "currency": "...",
                    "endDate": 12345,
                    "endOfDiscountDate": 12345,
                    "frequency": "...",
                    "id": 12345,
                    "links": [],
                    "nextBillingDate": 12345,
                    "parentSubscriptionId": 12345,
                    "referenceCode": "...",
                    "salesSupportCompany": {},
                    "salesSupportUser": {},
                    "serviceStartDate": 12345,
                    "startDate": 12345,
                    "status": "...",
                    "totalPrice": 12345,
                    "type": "...",
                    "user": {}
                  },
                  "nullable": true,
                  "type": "object"
                },
                {
                  "title": "Order",
                  "properties": {
                    "activated": {},
                    "contract": {},
                    "customAttributes": {},
                    "discount": {},
                    "discountId": {},
                    "nextOrder": {},
                    "oneTimeOrders": {},
                    "orderLines": {},
                    "parameters": {},
                    "paymentPlan": {},
                    "paymentPlanId": {},
                    "previousOrder": {}
                  },
                  "example": {
                    "_embedded": {},
                    "activated": true,
                    "company": {},
                    "contract": {},
                    "currency": "...",
                    "customAttributes": [],
                    "discount": {},
                    "discountId": 12345,
                    "endDate": 12345,
                    "endOfDiscountDate": 12345,
                    "frequency": "...",
                    "id": 12345,
                    "links": [],
                    "nextBillingDate": 12345,
                    "nextOrder": {},
                    "oneTimeOrders": [],
                    "orderLines": [],
                    "parameters": [],
                    "paymentPlan": {},
                    "paymentPlanId": 12345,
                    "previousOrder": {},
                    "referenceCode": "...",
                    "salesSupportUser": {},
                    "startDate": 12345,
                    "status": "...",
                    "totalPrice": 12345,
                    "type": "...",
                    "user": {}
                  },
                  "nullable": true,
                  "type": "object"
                }
              ]
            },
            {
              "description": "Upcoming order"
            }
          ]
        },
        "user": {
          "allOf": [
            {
              "title": "LinkWS",
              "properties": {
                "href": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                }
              },
              "example": {
                "href": "...",
                "id": "..."
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Link to user information"
            }
          ]
        }
      },
      "example": {
        "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": "...",
          "customAttributes": [
            {
              "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": "..."
          },
          "oneTimeOrders": [
            {
              "_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": {}
            }
          ],
          "orderLines": [
            {},
            {}
          ],
          "parameters": [
            {
              "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": "...",
          "customAttributes": [
            {
              "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": "..."
          },
          "oneTimeOrders": [
            {
              "_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": {}
            }
          ],
          "orderLines": [
            {},
            {}
          ],
          "parameters": [
            {
              "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": "..."
        }
      },
      "nullable": true,
      "type": "object"
    },
    {
      "description": "Subscription data object"
    }
  ]
}';
const headers = {
    'Content-Type':'application/json',
    'Accept':'application/json'
};
fetch('https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions/{subscriptionId}',
{
  method: 'PUT',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

URL obj = new URL("https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions/{subscriptionId}");
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());

Request body

{
  "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": "...",
    "customAttributes": [
      {
        "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": "..."
    },
    "oneTimeOrders": [
      {
        "_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": {}
      }
    ],
    "orderLines": [
      {},
      {}
    ],
    "parameters": [
      {
        "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": "...",
    "customAttributes": [
      {
        "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": "..."
    },
    "oneTimeOrders": [
      {
        "_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": {}
      }
    ],
    "orderLines": [
      {},
      {}
    ],
    "parameters": [
      {
        "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": "..."
  }
}

Example response

{
  "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": "fdad1b12-c13f-416e-97a2-6330451da1b9",
  "id": "1b577640-9b77-47bc-beb8-ed59accb4836",
  "maxUsers": 10,
  "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": 3,
    "links": [
      {
        "href": "http://appdirect/api/billing/v1/subscriptions/1b577640-9b77-47bc-beb8-ed59accb4836",
        "rel": "subscription"
      }
    ],
    "nextBillingDate": 1483599600000,
    "nextOrder": null,
    "oneTimeOrders": [
      {
        "company": null,
        "currency": "USD",
        "endDate": 1483599600000,
        "endOfDiscountDate": null,
        "frequency": "MONTHLY",
        "id": 2,
        "links": [],
        "nextBillingDate": 1483599600000,
        "paymentPlan": {
          "href": "http://appdirect/api/marketplace/v1/products/2/editions/2/paymentPlans/2",
          "id": "2"
        },
        "referenceCode": null,
        "salesSupportUser": null,
        "startDate": 1480921200000,
        "status": "ONE_TIME",
        "totalPrice": 0,
        "type": "CREDIT",
        "user": null
      }
    ],
    "orderLines": [
      {
        "description": "Test App 1 - null - Per User Fee",
        "id": 3,
        "listingPrice": 10,
        "price": 10,
        "quantity": 10,
        "totalPrice": 100,
        "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": {
      "href": "http://appdirect/api/billing/v1/orders/1",
      "id": "1"
    },
    "referenceCode": null,
    "salesSupportUser": null,
    "startDate": 1480921200000,
    "status": "ACTIVE",
    "totalPrice": 0,
    "type": "MIGRATION",
    "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"
  }
}

PUT/billing/v1/companies/{companyId}/users/{userId}/subscriptions/{subscriptionId}

Change the specified subscription for the specified user and company with the provided data.
You cannot perform assisted sales, in which the buyer purchases a product for or on behalf of someone else, through the API.
When you use the Change Subscription Details request to update a subscription that was created though the user interface as an assisted sale, a new order is created for the specified user ID and company. Because the new order is not created as an assisted sale, the salesSupportUser parameter is returned with a value of null.

Parameters

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

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)

externalId string

External ID for a subscription

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
200 OK OK Subscription
400 Bad Request Bad Request
404 Not Found Not Found
409 Conflict Conflict

Create a subscription

Example request

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

POST 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 = {
    'Content-Type':'application/json',
    'Accept':'application/json'
};
$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions',
  method: 'post',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})

const request = require('node-fetch');
const inputBody = '{
  "allOf": [
    {
      "title": "Subscription",
      "properties": {
        "assignedUsers": {
          "description": "Number of users assigned to subscription",
          "nullable": true,
          "type": "number"
        },
        "company": {
          "allOf": [
            {
              "title": "LinkWS",
              "properties": {
                "href": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                }
              },
              "example": {
                "href": "...",
                "id": "..."
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Link to company information"
            }
          ]
        },
        "creationDate": {
          "description": "Subscription creation date",
          "nullable": true,
          "type": "number"
        },
        "edition": {
          "allOf": [
            {
              "title": "LinkWS",
              "properties": {
                "href": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                }
              },
              "example": {
                "href": "...",
                "id": "..."
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Link to edition information"
            }
          ]
        },
        "endDate": {
          "description": "Subscription end date",
          "nullable": true,
          "type": "number"
        },
        "externalAccountId": {
          "description": "External account identifier (from vendor)",
          "nullable": true,
          "type": "string"
        },
        "externalId": {
          "description": "External ID for a subscription",
          "nullable": true,
          "type": "string"
        },
        "id": {
          "description": "ID",
          "nullable": true,
          "type": "string"
        },
        "internalId": {
          "description": "The UUID for a subscription",
          "nullable": true,
          "type": "string"
        },
        "maxUsers": {
          "description": "Maximum number of users allowed to be assigned to subscription",
          "nullable": true,
          "type": "number"
        },
        "order": {
          "allOf": [
            {
              "description": "Resource links",
              "title": "Order",
              "properties": {
                "_embedded": {
                  "additionalProperties": {
                    "nullable": true,
                    "type": "object"
                  },
                  "nullable": true,
                  "type": "object"
                },
                "activated": {
                  "description": "True if the subscription has been activated",
                  "type": "boolean"
                },
                "company": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to company information."
                },
                "contract": {
                  "title": "OrderContract",
                  "properties": {
                    "cancellationPeriodLimit": {},
                    "endOfContractDate": {},
                    "endOfContractGracePeriod": {},
                    "gracePeriodEndDate": {},
                    "minimumServiceLength": {},
                    "renewal": {},
                    "terminationFee": {}
                  },
                  "example": {
                    "cancellationPeriodLimit": null,
                    "endOfContractDate": 1588789800000,
                    "endOfContractGracePeriod": null,
                    "gracePeriodEndDate": null,
                    "minimumServiceLength": 24,
                    "renewal": null,
                    "terminationFee": {}
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "The contract terms of the order, if applicable. If the order does not have contract terms, this field is null."
                },
                "currency": {
                  "description": "Currency.",
                  "nullable": true,
                  "type": "string"
                },
                "customAttributes": {
                  "description": "List of custom attributes associated with this order",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "title": "CustomAttribute",
                    "properties": {},
                    "example": {}
                  }
                },
                "discount": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to the discount applied to this order (optional)"
                },
                "discountId": {
                  "description": "The unique identifier for the discount applied to this order",
                  "nullable": true,
                  "type": "number"
                },
                "endDate": {
                  "description": "Order end date.",
                  "nullable": true,
                  "type": "number"
                },
                "endOfDiscountDate": {
                  "description": "Discount end date.",
                  "nullable": true,
                  "type": "number"
                },
                "frequency": {
                  "description": "Frequency.",
                  "nullable": true,
                  "type": "string"
                },
                "id": {
                  "description": "ID.",
                  "nullable": true,
                  "type": "number"
                },
                "links": {
                  "description": "Resource links",
                  "type": "array",
                  "items": {
                    "title": "Link",
                    "properties": {},
                    "example": {},
                    "nullable": true,
                    "type": "object"
                  }
                },
                "nextBillingDate": {
                  "description": "Next billing date for the order",
                  "nullable": true,
                  "type": "number"
                },
                "nextOrder": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to the next order for this subscription"
                },
                "oneTimeOrders": {
                  "description": "List of one time orders associated with this subscription order",
                  "type": "array",
                  "items": {
                    "description": "Resource links",
                    "title": "OrderListing",
                    "properties": {},
                    "example": {},
                    "nullable": true,
                    "type": "object"
                  }
                },
                "orderLines": {
                  "description": "List of order lines for this subscription order",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "title": "OrderLine",
                    "properties": {},
                    "example": {}
                  }
                },
                "parameters": {
                  "description": "List of custom parameters associated with this order",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "title": "Parameter",
                    "properties": {},
                    "example": {}
                  }
                },
                "parentSubscriptionId": {
                  "description": "Parent subscription ID of an add-on subscription",
                  "nullable": true,
                  "type": "number"
                },
                "paymentPlan": {
                  "description": "Payment plan for this order",
                  "type": "object",
                  "title": "PaymentPlan",
                  "properties": {
                    "allowCustomUsage": {
                      "description": "Custom usage allowed",
                      "type": "boolean"
                    },
                    "contract": {},
                    "cost": {
                      "description": "List of plan costs",
                      "type": "array",
                      "items": {}
                    },
                    "discount": {},
                    "frequency": {
                      "description": "Billing frequency: MONTHLY, QUARTERLY, SIX_MONTHS, YEARLY, TWO_YEARS, THREE_YEARS, DAILY",
                      "type": "string"
                    },
                    "href": {
                      "description": "URL to payment plan details",
                      "type": "string"
                    },
                    "id": {
                      "description": "ID",
                      "type": "number"
                    },
                    "isPrimaryPrice": {
                      "description": "Is primary price",
                      "type": "boolean"
                    },
                    "keepBillDateOnUsageChange": {
                      "description": "Keep bill date on usage change",
                      "type": "boolean"
                    },
                    "separatePrepaid": {
                      "description": "Separate prepaid",
                      "type": "boolean"
                    },
                    "tld": {
                      "description": "If plan is part of a domain reseller product, this is the tld this plan offers",
                      "type": "string"
                    },
                    "uuid": {
                      "description": "Unique identifier",
                      "nullable": true,
                      "type": "string"
                    }
                  },
                  "example": {
                    "allowCustomUsage": true,
                    "contract": {},
                    "cost": [],
                    "discount": {},
                    "frequency": "...",
                    "href": "...",
                    "id": 12345,
                    "isPrimaryPrice": true,
                    "keepBillDateOnUsageChange": true,
                    "separatePrepaid": true,
                    "tld": "...",
                    "uuid": "..."
                  }
                },
                "paymentPlanId": {
                  "description": "The unique identifier for the payment plan for this order",
                  "nullable": true,
                  "type": "number"
                },
                "previousOrder": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to the previous order for this subscription"
                },
                "referenceCode": {
                  "description": "Reference code",
                  "nullable": true,
                  "type": "string"
                },
                "salesSupportCompany": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to sales support company information"
                },
                "salesSupportUser": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to sales support user information"
                },
                "serviceStartDate": {
                  "description": "Service start date for the order",
                  "nullable": true,
                  "type": "number"
                },
                "startDate": {
                  "description": "Order start date",
                  "nullable": true,
                  "type": "number"
                },
                "status": {
                  "description": "Order status",
                  "nullable": true,
                  "type": "string"
                },
                "totalPrice": {
                  "description": "Total price for the order",
                  "nullable": true,
                  "type": "number"
                },
                "type": {
                  "description": "Type.",
                  "nullable": true,
                  "type": "string"
                },
                "user": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to user information"
                }
              },
              "example": {
                "_embedded": {
                  "property1": {},
                  "property2": {}
                },
                "activated": true,
                "company": {
                  "href": "...",
                  "id": "..."
                },
                "contract": {},
                "currency": "...",
                "customAttributes": [
                  {
                    "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": "..."
                },
                "oneTimeOrders": [
                  {
                    "_embedded": {},
                    "company": {},
                    "currency": "...",
                    "endDate": 12345,
                    "endOfDiscountDate": 12345,
                    "frequency": "...",
                    "id": 12345,
                    "links": [],
                    "nextBillingDate": 12345,
                    "paymentPlan": {},
                    "referenceCode": "...",
                    "salesSupportUser": {},
                    "startDate": 12345,
                    "status": "...",
                    "totalPrice": 12345,
                    "type": "...",
                    "user": {}
                  },
                  {
                    "_embedded": {},
                    "company": {},
                    "currency": "...",
                    "endDate": 12345,
                    "endOfDiscountDate": 12345,
                    "frequency": "...",
                    "id": 12345,
                    "links": [],
                    "nextBillingDate": 12345,
                    "paymentPlan": {},
                    "referenceCode": "...",
                    "salesSupportUser": {},
                    "startDate": 12345,
                    "status": "...",
                    "totalPrice": 12345,
                    "type": "...",
                    "user": {}
                  }
                ],
                "orderLines": [
                  {},
                  {}
                ],
                "parameters": [
                  {
                    "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": [
                    {},
                    {}
                  ],
                  "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": "..."
                }
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Current order"
            }
          ]
        },
        "product": {
          "allOf": [
            {
              "title": "LinkWS",
              "properties": {
                "href": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                }
              },
              "example": {
                "href": "...",
                "id": "..."
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Link to product information"
            }
          ]
        },
        "redirectUrl": {
          "description": "Interactive endpoint URL",
          "nullable": true,
          "type": "string"
        },
        "status": {
          "description": "Subscription status (Valid values are INITIALIZED, FAILED, FREE_TRIAL, FREE_TRIAL_EXPIRED, ACTIVE, SUSPENDED, or CANCELLED.)",
          "nullable": true,
          "type": "string"
        },
        "upcomingOrder": {
          "allOf": [
            {
              "description": "Resource links",
              "title": "Order",
              "properties": {
                "_embedded": {
                  "additionalProperties": {
                    "nullable": true,
                    "type": "object"
                  },
                  "nullable": true,
                  "type": "object"
                },
                "activated": {
                  "description": "True if the subscription has been activated",
                  "type": "boolean"
                },
                "company": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to company information."
                },
                "contract": {
                  "title": "OrderContract",
                  "properties": {
                    "cancellationPeriodLimit": {
                      "description": "Cancellation period limit",
                      "nullable": true,
                      "type": "number"
                    },
                    "endOfContractDate": {
                      "description": "End date for contract",
                      "type": "number"
                    },
                    "endOfContractGracePeriod": {
                      "description": "Grace period for end of contract",
                      "nullable": true,
                      "type": "number"
                    },
                    "gracePeriodEndDate": {
                      "description": "End date for grace period",
                      "nullable": true,
                      "type": "number"
                    },
                    "minimumServiceLength": {
                      "description": "Minimum service length of contract",
                      "type": "number"
                    },
                    "renewal": {},
                    "terminationFee": {}
                  },
                  "example": {
                    "cancellationPeriodLimit": null,
                    "endOfContractDate": 1588789800000,
                    "endOfContractGracePeriod": null,
                    "gracePeriodEndDate": null,
                    "minimumServiceLength": 24,
                    "renewal": null,
                    "terminationFee": {}
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "The contract terms of the order, if applicable. If the order does not have contract terms, this field is null."
                },
                "currency": {
                  "description": "Currency.",
                  "nullable": true,
                  "type": "string"
                },
                "customAttributes": {
                  "description": "List of custom attributes associated with this order",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "title": "CustomAttribute",
                    "properties": {},
                    "example": {}
                  }
                },
                "discount": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to the discount applied to this order (optional)"
                },
                "discountId": {
                  "description": "The unique identifier for the discount applied to this order",
                  "nullable": true,
                  "type": "number"
                },
                "endDate": {
                  "description": "Order end date.",
                  "nullable": true,
                  "type": "number"
                },
                "endOfDiscountDate": {
                  "description": "Discount end date.",
                  "nullable": true,
                  "type": "number"
                },
                "frequency": {
                  "description": "Frequency.",
                  "nullable": true,
                  "type": "string"
                },
                "id": {
                  "description": "ID.",
                  "nullable": true,
                  "type": "number"
                },
                "links": {
                  "description": "Resource links",
                  "type": "array",
                  "items": {
                    "title": "Link",
                    "properties": {},
                    "example": {},
                    "nullable": true,
                    "type": "object"
                  }
                },
                "nextBillingDate": {
                  "description": "Next billing date for the order",
                  "nullable": true,
                  "type": "number"
                },
                "nextOrder": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to the next order for this subscription"
                },
                "oneTimeOrders": {
                  "description": "List of one time orders associated with this subscription order",
                  "type": "array",
                  "items": {
                    "description": "Resource links",
                    "title": "OrderListing",
                    "properties": {},
                    "example": {},
                    "nullable": true,
                    "type": "object"
                  }
                },
                "orderLines": {
                  "description": "List of order lines for this subscription order",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "title": "OrderLine",
                    "properties": {},
                    "example": {}
                  }
                },
                "parameters": {
                  "description": "List of custom parameters associated with this order",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "title": "Parameter",
                    "properties": {},
                    "example": {}
                  }
                },
                "parentSubscriptionId": {
                  "description": "Parent subscription ID of an add-on subscription",
                  "nullable": true,
                  "type": "number"
                },
                "paymentPlan": {
                  "description": "Payment plan for this order",
                  "type": "object",
                  "title": "PaymentPlan",
                  "properties": {
                    "allowCustomUsage": {
                      "description": "Custom usage allowed",
                      "type": "boolean"
                    },
                    "contract": {},
                    "cost": {
                      "description": "List of plan costs",
                      "type": "array",
                      "items": {}
                    },
                    "discount": {},
                    "frequency": {
                      "description": "Billing frequency: MONTHLY, QUARTERLY, SIX_MONTHS, YEARLY, TWO_YEARS, THREE_YEARS, DAILY",
                      "type": "string"
                    },
                    "href": {
                      "description": "URL to payment plan details",
                      "type": "string"
                    },
                    "id": {
                      "description": "ID",
                      "type": "number"
                    },
                    "isPrimaryPrice": {
                      "description": "Is primary price",
                      "type": "boolean"
                    },
                    "keepBillDateOnUsageChange": {
                      "description": "Keep bill date on usage change",
                      "type": "boolean"
                    },
                    "separatePrepaid": {
                      "description": "Separate prepaid",
                      "type": "boolean"
                    },
                    "tld": {
                      "description": "If plan is part of a domain reseller product, this is the tld this plan offers",
                      "type": "string"
                    },
                    "uuid": {
                      "description": "Unique identifier",
                      "nullable": true,
                      "type": "string"
                    }
                  },
                  "example": {
                    "allowCustomUsage": true,
                    "contract": {},
                    "cost": [],
                    "discount": {},
                    "frequency": "...",
                    "href": "...",
                    "id": 12345,
                    "isPrimaryPrice": true,
                    "keepBillDateOnUsageChange": true,
                    "separatePrepaid": true,
                    "tld": "...",
                    "uuid": "..."
                  }
                },
                "paymentPlanId": {
                  "description": "The unique identifier for the payment plan for this order",
                  "nullable": true,
                  "type": "number"
                },
                "previousOrder": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to the previous order for this subscription"
                },
                "referenceCode": {
                  "description": "Reference code",
                  "nullable": true,
                  "type": "string"
                },
                "salesSupportCompany": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to sales support company information"
                },
                "salesSupportUser": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to sales support user information"
                },
                "serviceStartDate": {
                  "description": "Service start date for the order",
                  "nullable": true,
                  "type": "number"
                },
                "startDate": {
                  "description": "Order start date",
                  "nullable": true,
                  "type": "number"
                },
                "status": {
                  "description": "Order status",
                  "nullable": true,
                  "type": "string"
                },
                "totalPrice": {
                  "description": "Total price for the order",
                  "nullable": true,
                  "type": "number"
                },
                "type": {
                  "description": "Type.",
                  "nullable": true,
                  "type": "string"
                },
                "user": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to user information"
                }
              },
              "example": {
                "_embedded": {
                  "property1": {},
                  "property2": {}
                },
                "activated": true,
                "company": {
                  "href": "...",
                  "id": "..."
                },
                "contract": {},
                "currency": "...",
                "customAttributes": [
                  {
                    "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": "..."
                },
                "oneTimeOrders": [
                  {
                    "_embedded": {},
                    "company": {},
                    "currency": "...",
                    "endDate": 12345,
                    "endOfDiscountDate": 12345,
                    "frequency": "...",
                    "id": 12345,
                    "links": [],
                    "nextBillingDate": 12345,
                    "paymentPlan": {},
                    "referenceCode": "...",
                    "salesSupportUser": {},
                    "startDate": 12345,
                    "status": "...",
                    "totalPrice": 12345,
                    "type": "...",
                    "user": {}
                  },
                  {
                    "_embedded": {},
                    "company": {},
                    "currency": "...",
                    "endDate": 12345,
                    "endOfDiscountDate": 12345,
                    "frequency": "...",
                    "id": 12345,
                    "links": [],
                    "nextBillingDate": 12345,
                    "paymentPlan": {},
                    "referenceCode": "...",
                    "salesSupportUser": {},
                    "startDate": 12345,
                    "status": "...",
                    "totalPrice": 12345,
                    "type": "...",
                    "user": {}
                  }
                ],
                "orderLines": [
                  {},
                  {}
                ],
                "parameters": [
                  {
                    "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": [
                    {},
                    {}
                  ],
                  "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": "..."
                }
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Upcoming order"
            }
          ]
        },
        "user": {
          "allOf": [
            {
              "title": "LinkWS",
              "properties": {
                "href": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                }
              },
              "example": {
                "href": "...",
                "id": "..."
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Link to user information"
            }
          ]
        }
      },
      "example": {
        "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": "...",
          "customAttributes": [
            {
              "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": "..."
          },
          "oneTimeOrders": [
            {
              "_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": {}
            }
          ],
          "orderLines": [
            {},
            {}
          ],
          "parameters": [
            {
              "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": "...",
          "customAttributes": [
            {
              "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": "..."
          },
          "oneTimeOrders": [
            {
              "_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": {}
            }
          ],
          "orderLines": [
            {},
            {}
          ],
          "parameters": [
            {
              "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": "..."
        }
      },
      "nullable": true,
      "type": "object"
    },
    {
      "description": "Subscription data object"
    }
  ]
}';
const headers = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

URL obj = new URL("https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
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());

Request body

{
  "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": "...",
    "customAttributes": [
      {
        "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": "..."
    },
    "oneTimeOrders": [
      {
        "_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": {}
      }
    ],
    "orderLines": [
      {},
      {}
    ],
    "parameters": [
      {
        "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": "...",
    "customAttributes": [
      {
        "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": "..."
    },
    "oneTimeOrders": [
      {
        "_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": {}
      }
    ],
    "orderLines": [
      {},
      {}
    ],
    "parameters": [
      {
        "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": "..."
  }
}

Example response

{
  "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
sendNotification query boolean true Send notification of the subscription's creation. Default value is true.
*userId path string User ID

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)

externalId string

External ID for a subscription

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 changed subscription details

Example request

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

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

var headers = {
    'Content-Type':'application/json',
    'Accept':'application/json'
};
$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions/{subscriptionId}/preview',
  method: 'put',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})

const request = require('node-fetch');
const inputBody = '{
  "allOf": [
    {
      "title": "Subscription",
      "properties": {
        "assignedUsers": {
          "description": "Number of users assigned to subscription",
          "nullable": true,
          "type": "number"
        },
        "company": {
          "allOf": [
            {
              "title": "LinkWS",
              "properties": {
                "href": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                }
              },
              "example": {
                "href": "...",
                "id": "..."
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Link to company information"
            }
          ]
        },
        "creationDate": {
          "description": "Subscription creation date",
          "nullable": true,
          "type": "number"
        },
        "edition": {
          "allOf": [
            {
              "title": "LinkWS",
              "properties": {
                "href": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                }
              },
              "example": {
                "href": "...",
                "id": "..."
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Link to edition information"
            }
          ]
        },
        "endDate": {
          "description": "Subscription end date",
          "nullable": true,
          "type": "number"
        },
        "externalAccountId": {
          "description": "External account identifier (from vendor)",
          "nullable": true,
          "type": "string"
        },
        "externalId": {
          "description": "External ID for a subscription",
          "nullable": true,
          "type": "string"
        },
        "id": {
          "description": "ID",
          "nullable": true,
          "type": "string"
        },
        "internalId": {
          "description": "The UUID for a subscription",
          "nullable": true,
          "type": "string"
        },
        "maxUsers": {
          "description": "Maximum number of users allowed to be assigned to subscription",
          "nullable": true,
          "type": "number"
        },
        "order": {
          "allOf": [
            {
              "description": "Resource links",
              "title": "Order",
              "properties": {
                "_embedded": {
                  "additionalProperties": {
                    "nullable": true,
                    "type": "object"
                  },
                  "nullable": true,
                  "type": "object"
                },
                "activated": {
                  "description": "True if the subscription has been activated",
                  "type": "boolean"
                },
                "company": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to company information."
                },
                "contract": {
                  "title": "OrderContract",
                  "properties": {
                    "cancellationPeriodLimit": {},
                    "endOfContractDate": {},
                    "endOfContractGracePeriod": {},
                    "gracePeriodEndDate": {},
                    "minimumServiceLength": {},
                    "renewal": {},
                    "terminationFee": {}
                  },
                  "example": {
                    "cancellationPeriodLimit": null,
                    "endOfContractDate": 1588789800000,
                    "endOfContractGracePeriod": null,
                    "gracePeriodEndDate": null,
                    "minimumServiceLength": 24,
                    "renewal": null,
                    "terminationFee": {}
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "The contract terms of the order, if applicable. If the order does not have contract terms, this field is null."
                },
                "currency": {
                  "description": "Currency.",
                  "nullable": true,
                  "type": "string"
                },
                "customAttributes": {
                  "description": "List of custom attributes associated with this order",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "title": "CustomAttribute",
                    "properties": {},
                    "example": {}
                  }
                },
                "discount": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to the discount applied to this order (optional)"
                },
                "discountId": {
                  "description": "The unique identifier for the discount applied to this order",
                  "nullable": true,
                  "type": "number"
                },
                "endDate": {
                  "description": "Order end date.",
                  "nullable": true,
                  "type": "number"
                },
                "endOfDiscountDate": {
                  "description": "Discount end date.",
                  "nullable": true,
                  "type": "number"
                },
                "frequency": {
                  "description": "Frequency.",
                  "nullable": true,
                  "type": "string"
                },
                "id": {
                  "description": "ID.",
                  "nullable": true,
                  "type": "number"
                },
                "links": {
                  "description": "Resource links",
                  "type": "array",
                  "items": {
                    "title": "Link",
                    "properties": {},
                    "example": {},
                    "nullable": true,
                    "type": "object"
                  }
                },
                "nextBillingDate": {
                  "description": "Next billing date for the order",
                  "nullable": true,
                  "type": "number"
                },
                "nextOrder": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to the next order for this subscription"
                },
                "oneTimeOrders": {
                  "description": "List of one time orders associated with this subscription order",
                  "type": "array",
                  "items": {
                    "description": "Resource links",
                    "title": "OrderListing",
                    "properties": {},
                    "example": {},
                    "nullable": true,
                    "type": "object"
                  }
                },
                "orderLines": {
                  "description": "List of order lines for this subscription order",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "title": "OrderLine",
                    "properties": {},
                    "example": {}
                  }
                },
                "parameters": {
                  "description": "List of custom parameters associated with this order",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "title": "Parameter",
                    "properties": {},
                    "example": {}
                  }
                },
                "parentSubscriptionId": {
                  "description": "Parent subscription ID of an add-on subscription",
                  "nullable": true,
                  "type": "number"
                },
                "paymentPlan": {
                  "description": "Payment plan for this order",
                  "type": "object",
                  "title": "PaymentPlan",
                  "properties": {
                    "allowCustomUsage": {
                      "description": "Custom usage allowed",
                      "type": "boolean"
                    },
                    "contract": {},
                    "cost": {
                      "description": "List of plan costs",
                      "type": "array",
                      "items": {}
                    },
                    "discount": {},
                    "frequency": {
                      "description": "Billing frequency: MONTHLY, QUARTERLY, SIX_MONTHS, YEARLY, TWO_YEARS, THREE_YEARS, DAILY",
                      "type": "string"
                    },
                    "href": {
                      "description": "URL to payment plan details",
                      "type": "string"
                    },
                    "id": {
                      "description": "ID",
                      "type": "number"
                    },
                    "isPrimaryPrice": {
                      "description": "Is primary price",
                      "type": "boolean"
                    },
                    "keepBillDateOnUsageChange": {
                      "description": "Keep bill date on usage change",
                      "type": "boolean"
                    },
                    "separatePrepaid": {
                      "description": "Separate prepaid",
                      "type": "boolean"
                    },
                    "tld": {
                      "description": "If plan is part of a domain reseller product, this is the tld this plan offers",
                      "type": "string"
                    },
                    "uuid": {
                      "description": "Unique identifier",
                      "nullable": true,
                      "type": "string"
                    }
                  },
                  "example": {
                    "allowCustomUsage": true,
                    "contract": {},
                    "cost": [],
                    "discount": {},
                    "frequency": "...",
                    "href": "...",
                    "id": 12345,
                    "isPrimaryPrice": true,
                    "keepBillDateOnUsageChange": true,
                    "separatePrepaid": true,
                    "tld": "...",
                    "uuid": "..."
                  }
                },
                "paymentPlanId": {
                  "description": "The unique identifier for the payment plan for this order",
                  "nullable": true,
                  "type": "number"
                },
                "previousOrder": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to the previous order for this subscription"
                },
                "referenceCode": {
                  "description": "Reference code",
                  "nullable": true,
                  "type": "string"
                },
                "salesSupportCompany": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to sales support company information"
                },
                "salesSupportUser": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to sales support user information"
                },
                "serviceStartDate": {
                  "description": "Service start date for the order",
                  "nullable": true,
                  "type": "number"
                },
                "startDate": {
                  "description": "Order start date",
                  "nullable": true,
                  "type": "number"
                },
                "status": {
                  "description": "Order status",
                  "nullable": true,
                  "type": "string"
                },
                "totalPrice": {
                  "description": "Total price for the order",
                  "nullable": true,
                  "type": "number"
                },
                "type": {
                  "description": "Type.",
                  "nullable": true,
                  "type": "string"
                },
                "user": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to user information"
                }
              },
              "example": {
                "_embedded": {
                  "property1": {},
                  "property2": {}
                },
                "activated": true,
                "company": {
                  "href": "...",
                  "id": "..."
                },
                "contract": {},
                "currency": "...",
                "customAttributes": [
                  {
                    "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": "..."
                },
                "oneTimeOrders": [
                  {
                    "_embedded": {},
                    "company": {},
                    "currency": "...",
                    "endDate": 12345,
                    "endOfDiscountDate": 12345,
                    "frequency": "...",
                    "id": 12345,
                    "links": [],
                    "nextBillingDate": 12345,
                    "paymentPlan": {},
                    "referenceCode": "...",
                    "salesSupportUser": {},
                    "startDate": 12345,
                    "status": "...",
                    "totalPrice": 12345,
                    "type": "...",
                    "user": {}
                  },
                  {
                    "_embedded": {},
                    "company": {},
                    "currency": "...",
                    "endDate": 12345,
                    "endOfDiscountDate": 12345,
                    "frequency": "...",
                    "id": 12345,
                    "links": [],
                    "nextBillingDate": 12345,
                    "paymentPlan": {},
                    "referenceCode": "...",
                    "salesSupportUser": {},
                    "startDate": 12345,
                    "status": "...",
                    "totalPrice": 12345,
                    "type": "...",
                    "user": {}
                  }
                ],
                "orderLines": [
                  {},
                  {}
                ],
                "parameters": [
                  {
                    "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": [
                    {},
                    {}
                  ],
                  "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": "..."
                }
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Current order"
            }
          ]
        },
        "product": {
          "allOf": [
            {
              "title": "LinkWS",
              "properties": {
                "href": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                }
              },
              "example": {
                "href": "...",
                "id": "..."
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Link to product information"
            }
          ]
        },
        "redirectUrl": {
          "description": "Interactive endpoint URL",
          "nullable": true,
          "type": "string"
        },
        "status": {
          "description": "Subscription status (Valid values are INITIALIZED, FAILED, FREE_TRIAL, FREE_TRIAL_EXPIRED, ACTIVE, SUSPENDED, or CANCELLED.)",
          "nullable": true,
          "type": "string"
        },
        "upcomingOrder": {
          "allOf": [
            {
              "description": "Resource links",
              "title": "Order",
              "properties": {
                "_embedded": {
                  "additionalProperties": {
                    "nullable": true,
                    "type": "object"
                  },
                  "nullable": true,
                  "type": "object"
                },
                "activated": {
                  "description": "True if the subscription has been activated",
                  "type": "boolean"
                },
                "company": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to company information."
                },
                "contract": {
                  "title": "OrderContract",
                  "properties": {
                    "cancellationPeriodLimit": {
                      "description": "Cancellation period limit",
                      "nullable": true,
                      "type": "number"
                    },
                    "endOfContractDate": {
                      "description": "End date for contract",
                      "type": "number"
                    },
                    "endOfContractGracePeriod": {
                      "description": "Grace period for end of contract",
                      "nullable": true,
                      "type": "number"
                    },
                    "gracePeriodEndDate": {
                      "description": "End date for grace period",
                      "nullable": true,
                      "type": "number"
                    },
                    "minimumServiceLength": {
                      "description": "Minimum service length of contract",
                      "type": "number"
                    },
                    "renewal": {},
                    "terminationFee": {}
                  },
                  "example": {
                    "cancellationPeriodLimit": null,
                    "endOfContractDate": 1588789800000,
                    "endOfContractGracePeriod": null,
                    "gracePeriodEndDate": null,
                    "minimumServiceLength": 24,
                    "renewal": null,
                    "terminationFee": {}
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "The contract terms of the order, if applicable. If the order does not have contract terms, this field is null."
                },
                "currency": {
                  "description": "Currency.",
                  "nullable": true,
                  "type": "string"
                },
                "customAttributes": {
                  "description": "List of custom attributes associated with this order",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "title": "CustomAttribute",
                    "properties": {},
                    "example": {}
                  }
                },
                "discount": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to the discount applied to this order (optional)"
                },
                "discountId": {
                  "description": "The unique identifier for the discount applied to this order",
                  "nullable": true,
                  "type": "number"
                },
                "endDate": {
                  "description": "Order end date.",
                  "nullable": true,
                  "type": "number"
                },
                "endOfDiscountDate": {
                  "description": "Discount end date.",
                  "nullable": true,
                  "type": "number"
                },
                "frequency": {
                  "description": "Frequency.",
                  "nullable": true,
                  "type": "string"
                },
                "id": {
                  "description": "ID.",
                  "nullable": true,
                  "type": "number"
                },
                "links": {
                  "description": "Resource links",
                  "type": "array",
                  "items": {
                    "title": "Link",
                    "properties": {},
                    "example": {},
                    "nullable": true,
                    "type": "object"
                  }
                },
                "nextBillingDate": {
                  "description": "Next billing date for the order",
                  "nullable": true,
                  "type": "number"
                },
                "nextOrder": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to the next order for this subscription"
                },
                "oneTimeOrders": {
                  "description": "List of one time orders associated with this subscription order",
                  "type": "array",
                  "items": {
                    "description": "Resource links",
                    "title": "OrderListing",
                    "properties": {},
                    "example": {},
                    "nullable": true,
                    "type": "object"
                  }
                },
                "orderLines": {
                  "description": "List of order lines for this subscription order",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "title": "OrderLine",
                    "properties": {},
                    "example": {}
                  }
                },
                "parameters": {
                  "description": "List of custom parameters associated with this order",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "title": "Parameter",
                    "properties": {},
                    "example": {}
                  }
                },
                "parentSubscriptionId": {
                  "description": "Parent subscription ID of an add-on subscription",
                  "nullable": true,
                  "type": "number"
                },
                "paymentPlan": {
                  "description": "Payment plan for this order",
                  "type": "object",
                  "title": "PaymentPlan",
                  "properties": {
                    "allowCustomUsage": {
                      "description": "Custom usage allowed",
                      "type": "boolean"
                    },
                    "contract": {},
                    "cost": {
                      "description": "List of plan costs",
                      "type": "array",
                      "items": {}
                    },
                    "discount": {},
                    "frequency": {
                      "description": "Billing frequency: MONTHLY, QUARTERLY, SIX_MONTHS, YEARLY, TWO_YEARS, THREE_YEARS, DAILY",
                      "type": "string"
                    },
                    "href": {
                      "description": "URL to payment plan details",
                      "type": "string"
                    },
                    "id": {
                      "description": "ID",
                      "type": "number"
                    },
                    "isPrimaryPrice": {
                      "description": "Is primary price",
                      "type": "boolean"
                    },
                    "keepBillDateOnUsageChange": {
                      "description": "Keep bill date on usage change",
                      "type": "boolean"
                    },
                    "separatePrepaid": {
                      "description": "Separate prepaid",
                      "type": "boolean"
                    },
                    "tld": {
                      "description": "If plan is part of a domain reseller product, this is the tld this plan offers",
                      "type": "string"
                    },
                    "uuid": {
                      "description": "Unique identifier",
                      "nullable": true,
                      "type": "string"
                    }
                  },
                  "example": {
                    "allowCustomUsage": true,
                    "contract": {},
                    "cost": [],
                    "discount": {},
                    "frequency": "...",
                    "href": "...",
                    "id": 12345,
                    "isPrimaryPrice": true,
                    "keepBillDateOnUsageChange": true,
                    "separatePrepaid": true,
                    "tld": "...",
                    "uuid": "..."
                  }
                },
                "paymentPlanId": {
                  "description": "The unique identifier for the payment plan for this order",
                  "nullable": true,
                  "type": "number"
                },
                "previousOrder": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to the previous order for this subscription"
                },
                "referenceCode": {
                  "description": "Reference code",
                  "nullable": true,
                  "type": "string"
                },
                "salesSupportCompany": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to sales support company information"
                },
                "salesSupportUser": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to sales support user information"
                },
                "serviceStartDate": {
                  "description": "Service start date for the order",
                  "nullable": true,
                  "type": "number"
                },
                "startDate": {
                  "description": "Order start date",
                  "nullable": true,
                  "type": "number"
                },
                "status": {
                  "description": "Order status",
                  "nullable": true,
                  "type": "string"
                },
                "totalPrice": {
                  "description": "Total price for the order",
                  "nullable": true,
                  "type": "number"
                },
                "type": {
                  "description": "Type.",
                  "nullable": true,
                  "type": "string"
                },
                "user": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to user information"
                }
              },
              "example": {
                "_embedded": {
                  "property1": {},
                  "property2": {}
                },
                "activated": true,
                "company": {
                  "href": "...",
                  "id": "..."
                },
                "contract": {},
                "currency": "...",
                "customAttributes": [
                  {
                    "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": "..."
                },
                "oneTimeOrders": [
                  {
                    "_embedded": {},
                    "company": {},
                    "currency": "...",
                    "endDate": 12345,
                    "endOfDiscountDate": 12345,
                    "frequency": "...",
                    "id": 12345,
                    "links": [],
                    "nextBillingDate": 12345,
                    "paymentPlan": {},
                    "referenceCode": "...",
                    "salesSupportUser": {},
                    "startDate": 12345,
                    "status": "...",
                    "totalPrice": 12345,
                    "type": "...",
                    "user": {}
                  },
                  {
                    "_embedded": {},
                    "company": {},
                    "currency": "...",
                    "endDate": 12345,
                    "endOfDiscountDate": 12345,
                    "frequency": "...",
                    "id": 12345,
                    "links": [],
                    "nextBillingDate": 12345,
                    "paymentPlan": {},
                    "referenceCode": "...",
                    "salesSupportUser": {},
                    "startDate": 12345,
                    "status": "...",
                    "totalPrice": 12345,
                    "type": "...",
                    "user": {}
                  }
                ],
                "orderLines": [
                  {},
                  {}
                ],
                "parameters": [
                  {
                    "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": [
                    {},
                    {}
                  ],
                  "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": "..."
                }
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Upcoming order"
            }
          ]
        },
        "user": {
          "allOf": [
            {
              "title": "LinkWS",
              "properties": {
                "href": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                }
              },
              "example": {
                "href": "...",
                "id": "..."
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Link to user information"
            }
          ]
        }
      },
      "example": {
        "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": "...",
          "customAttributes": [
            {
              "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": "..."
          },
          "oneTimeOrders": [
            {
              "_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": {}
            }
          ],
          "orderLines": [
            {},
            {}
          ],
          "parameters": [
            {
              "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": "...",
          "customAttributes": [
            {
              "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": "..."
          },
          "oneTimeOrders": [
            {
              "_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": {}
            }
          ],
          "orderLines": [
            {},
            {}
          ],
          "parameters": [
            {
              "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": "..."
        }
      },
      "nullable": true,
      "type": "object"
    },
    {
      "description": "Subscription data object"
    }
  ]
}';
const headers = {
    'Content-Type':'application/json',
    'Accept':'application/json'
};
fetch('https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions/{subscriptionId}/preview',
{
  method: 'PUT',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

result = RestClient.put 'https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions/{subscriptionId}/preview',
  params: {
  }, headers: headers

p JSON.parse(result)

URL obj = new URL("https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions/{subscriptionId}/preview");
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());

Request body

{
  "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": "...",
    "customAttributes": [
      {
        "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": "..."
    },
    "oneTimeOrders": [
      {
        "_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": {}
      }
    ],
    "orderLines": [
      {},
      {}
    ],
    "parameters": [
      {
        "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": "...",
    "customAttributes": [
      {
        "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": "..."
    },
    "oneTimeOrders": [
      {
        "_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": {}
      }
    ],
    "orderLines": [
      {},
      {}
    ],
    "parameters": [
      {
        "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": "..."
  }
}

Example response

{
  "assignedUsers": 1,
  "company": null,
  "creationDate": 1481002406580,
  "edition": null,
  "endDate": null,
  "externalAccountId": "d2f4acf1-fb5a-4c4a-921f-75c4b6bfff08",
  "id": "1b577640-9b77-47bc-beb8-ed59accb4836",
  "maxUsers": 1,
  "order": {
    "activated": false,
    "company": null,
    "contract": null,
    "currency": "USD",
    "discount": null,
    "discountId": null,
    "endDate": null,
    "endOfDiscountDate": null,
    "frequency": "MONTHLY",
    "id": null,
    "links": [
      {
        "href": "http://appdirect/api/billing/v1/subscriptions/1b577640-9b77-47bc-beb8-ed59accb4836",
        "rel": "subscription"
      }
    ],
    "nextBillingDate": 1483599600000,
    "nextOrder": null,
    "oneTimeOrders": [
      {
        "company": null,
        "currency": "USD",
        "endDate": 1483599600000,
        "endOfDiscountDate": null,
        "frequency": "MONTHLY",
        "id": null,
        "links": [],
        "nextBillingDate": 1483599600000,
        "paymentPlan": {
          "href": "http://appdirect/api/marketplace/v1/products/2/editions/2/paymentPlans/2",
          "id": "2"
        },
        "referenceCode": null,
        "salesSupportUser": null,
        "startDate": 1480921200000,
        "status": "INITIALIZED",
        "totalPrice": -10,
        "type": "CREDIT",
        "user": null
      }
    ],
    "orderLines": [
      {
        "description": "Test App 1 - null - Per User Fee",
        "listingPrice": 10,
        "price": 10,
        "quantity": 10,
        "totalPrice": 100,
        "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": "PENDING_REMOTE_CREATION",
    "totalPrice": 100,
    "type": "MIGRATION",
    "user": null
  },
  "product": null,
  "redirectUrl": null,
  "status": "ACTIVE",
  "upcomingOrder": null,
  "user": null
}

PUT/billing/v1/companies/{companyId}/users/{userId}/subscriptions/{subscriptionId}/preview

Preview the changes for the given subscription using the provided data

Parameters

Parameter Type Data Type Default Description
*companyId path string User's company ID
*subscriptionId path string Subscription ID
*userId path string User ID

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)

externalId string

External ID for a subscription

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
200 OK OK Subscription
400 Bad Request Bad Request
404 Not Found Not Found

Preview create a subscription

Example request

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

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

var headers = {
    'Content-Type':'application/json',
    'Accept':'application/json'
};
$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions/preview',
  method: 'post',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})

const request = require('node-fetch');
const inputBody = '{
  "allOf": [
    {
      "title": "Subscription",
      "properties": {
        "assignedUsers": {
          "description": "Number of users assigned to subscription",
          "nullable": true,
          "type": "number"
        },
        "company": {
          "allOf": [
            {
              "title": "LinkWS",
              "properties": {
                "href": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                }
              },
              "example": {
                "href": "...",
                "id": "..."
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Link to company information"
            }
          ]
        },
        "creationDate": {
          "description": "Subscription creation date",
          "nullable": true,
          "type": "number"
        },
        "edition": {
          "allOf": [
            {
              "title": "LinkWS",
              "properties": {
                "href": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                }
              },
              "example": {
                "href": "...",
                "id": "..."
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Link to edition information"
            }
          ]
        },
        "endDate": {
          "description": "Subscription end date",
          "nullable": true,
          "type": "number"
        },
        "externalAccountId": {
          "description": "External account identifier (from vendor)",
          "nullable": true,
          "type": "string"
        },
        "externalId": {
          "description": "External ID for a subscription",
          "nullable": true,
          "type": "string"
        },
        "id": {
          "description": "ID",
          "nullable": true,
          "type": "string"
        },
        "internalId": {
          "description": "The UUID for a subscription",
          "nullable": true,
          "type": "string"
        },
        "maxUsers": {
          "description": "Maximum number of users allowed to be assigned to subscription",
          "nullable": true,
          "type": "number"
        },
        "order": {
          "allOf": [
            {
              "description": "Resource links",
              "title": "Order",
              "properties": {
                "_embedded": {
                  "additionalProperties": {
                    "nullable": true,
                    "type": "object"
                  },
                  "nullable": true,
                  "type": "object"
                },
                "activated": {
                  "description": "True if the subscription has been activated",
                  "type": "boolean"
                },
                "company": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to company information."
                },
                "contract": {
                  "title": "OrderContract",
                  "properties": {
                    "cancellationPeriodLimit": {},
                    "endOfContractDate": {},
                    "endOfContractGracePeriod": {},
                    "gracePeriodEndDate": {},
                    "minimumServiceLength": {},
                    "renewal": {},
                    "terminationFee": {}
                  },
                  "example": {
                    "cancellationPeriodLimit": null,
                    "endOfContractDate": 1588789800000,
                    "endOfContractGracePeriod": null,
                    "gracePeriodEndDate": null,
                    "minimumServiceLength": 24,
                    "renewal": null,
                    "terminationFee": {}
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "The contract terms of the order, if applicable. If the order does not have contract terms, this field is null."
                },
                "currency": {
                  "description": "Currency.",
                  "nullable": true,
                  "type": "string"
                },
                "customAttributes": {
                  "description": "List of custom attributes associated with this order",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "title": "CustomAttribute",
                    "properties": {},
                    "example": {}
                  }
                },
                "discount": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to the discount applied to this order (optional)"
                },
                "discountId": {
                  "description": "The unique identifier for the discount applied to this order",
                  "nullable": true,
                  "type": "number"
                },
                "endDate": {
                  "description": "Order end date.",
                  "nullable": true,
                  "type": "number"
                },
                "endOfDiscountDate": {
                  "description": "Discount end date.",
                  "nullable": true,
                  "type": "number"
                },
                "frequency": {
                  "description": "Frequency.",
                  "nullable": true,
                  "type": "string"
                },
                "id": {
                  "description": "ID.",
                  "nullable": true,
                  "type": "number"
                },
                "links": {
                  "description": "Resource links",
                  "type": "array",
                  "items": {
                    "title": "Link",
                    "properties": {},
                    "example": {},
                    "nullable": true,
                    "type": "object"
                  }
                },
                "nextBillingDate": {
                  "description": "Next billing date for the order",
                  "nullable": true,
                  "type": "number"
                },
                "nextOrder": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to the next order for this subscription"
                },
                "oneTimeOrders": {
                  "description": "List of one time orders associated with this subscription order",
                  "type": "array",
                  "items": {
                    "description": "Resource links",
                    "title": "OrderListing",
                    "properties": {},
                    "example": {},
                    "nullable": true,
                    "type": "object"
                  }
                },
                "orderLines": {
                  "description": "List of order lines for this subscription order",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "title": "OrderLine",
                    "properties": {},
                    "example": {}
                  }
                },
                "parameters": {
                  "description": "List of custom parameters associated with this order",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "title": "Parameter",
                    "properties": {},
                    "example": {}
                  }
                },
                "parentSubscriptionId": {
                  "description": "Parent subscription ID of an add-on subscription",
                  "nullable": true,
                  "type": "number"
                },
                "paymentPlan": {
                  "description": "Payment plan for this order",
                  "type": "object",
                  "title": "PaymentPlan",
                  "properties": {
                    "allowCustomUsage": {
                      "description": "Custom usage allowed",
                      "type": "boolean"
                    },
                    "contract": {},
                    "cost": {
                      "description": "List of plan costs",
                      "type": "array",
                      "items": {}
                    },
                    "discount": {},
                    "frequency": {
                      "description": "Billing frequency: MONTHLY, QUARTERLY, SIX_MONTHS, YEARLY, TWO_YEARS, THREE_YEARS, DAILY",
                      "type": "string"
                    },
                    "href": {
                      "description": "URL to payment plan details",
                      "type": "string"
                    },
                    "id": {
                      "description": "ID",
                      "type": "number"
                    },
                    "isPrimaryPrice": {
                      "description": "Is primary price",
                      "type": "boolean"
                    },
                    "keepBillDateOnUsageChange": {
                      "description": "Keep bill date on usage change",
                      "type": "boolean"
                    },
                    "separatePrepaid": {
                      "description": "Separate prepaid",
                      "type": "boolean"
                    },
                    "tld": {
                      "description": "If plan is part of a domain reseller product, this is the tld this plan offers",
                      "type": "string"
                    },
                    "uuid": {
                      "description": "Unique identifier",
                      "nullable": true,
                      "type": "string"
                    }
                  },
                  "example": {
                    "allowCustomUsage": true,
                    "contract": {},
                    "cost": [],
                    "discount": {},
                    "frequency": "...",
                    "href": "...",
                    "id": 12345,
                    "isPrimaryPrice": true,
                    "keepBillDateOnUsageChange": true,
                    "separatePrepaid": true,
                    "tld": "...",
                    "uuid": "..."
                  }
                },
                "paymentPlanId": {
                  "description": "The unique identifier for the payment plan for this order",
                  "nullable": true,
                  "type": "number"
                },
                "previousOrder": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to the previous order for this subscription"
                },
                "referenceCode": {
                  "description": "Reference code",
                  "nullable": true,
                  "type": "string"
                },
                "salesSupportCompany": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to sales support company information"
                },
                "salesSupportUser": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to sales support user information"
                },
                "serviceStartDate": {
                  "description": "Service start date for the order",
                  "nullable": true,
                  "type": "number"
                },
                "startDate": {
                  "description": "Order start date",
                  "nullable": true,
                  "type": "number"
                },
                "status": {
                  "description": "Order status",
                  "nullable": true,
                  "type": "string"
                },
                "totalPrice": {
                  "description": "Total price for the order",
                  "nullable": true,
                  "type": "number"
                },
                "type": {
                  "description": "Type.",
                  "nullable": true,
                  "type": "string"
                },
                "user": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to user information"
                }
              },
              "example": {
                "_embedded": {
                  "property1": {},
                  "property2": {}
                },
                "activated": true,
                "company": {
                  "href": "...",
                  "id": "..."
                },
                "contract": {},
                "currency": "...",
                "customAttributes": [
                  {
                    "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": "..."
                },
                "oneTimeOrders": [
                  {
                    "_embedded": {},
                    "company": {},
                    "currency": "...",
                    "endDate": 12345,
                    "endOfDiscountDate": 12345,
                    "frequency": "...",
                    "id": 12345,
                    "links": [],
                    "nextBillingDate": 12345,
                    "paymentPlan": {},
                    "referenceCode": "...",
                    "salesSupportUser": {},
                    "startDate": 12345,
                    "status": "...",
                    "totalPrice": 12345,
                    "type": "...",
                    "user": {}
                  },
                  {
                    "_embedded": {},
                    "company": {},
                    "currency": "...",
                    "endDate": 12345,
                    "endOfDiscountDate": 12345,
                    "frequency": "...",
                    "id": 12345,
                    "links": [],
                    "nextBillingDate": 12345,
                    "paymentPlan": {},
                    "referenceCode": "...",
                    "salesSupportUser": {},
                    "startDate": 12345,
                    "status": "...",
                    "totalPrice": 12345,
                    "type": "...",
                    "user": {}
                  }
                ],
                "orderLines": [
                  {},
                  {}
                ],
                "parameters": [
                  {
                    "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": [
                    {},
                    {}
                  ],
                  "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": "..."
                }
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Current order"
            }
          ]
        },
        "product": {
          "allOf": [
            {
              "title": "LinkWS",
              "properties": {
                "href": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                }
              },
              "example": {
                "href": "...",
                "id": "..."
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Link to product information"
            }
          ]
        },
        "redirectUrl": {
          "description": "Interactive endpoint URL",
          "nullable": true,
          "type": "string"
        },
        "status": {
          "description": "Subscription status (Valid values are INITIALIZED, FAILED, FREE_TRIAL, FREE_TRIAL_EXPIRED, ACTIVE, SUSPENDED, or CANCELLED.)",
          "nullable": true,
          "type": "string"
        },
        "upcomingOrder": {
          "allOf": [
            {
              "description": "Resource links",
              "title": "Order",
              "properties": {
                "_embedded": {
                  "additionalProperties": {
                    "nullable": true,
                    "type": "object"
                  },
                  "nullable": true,
                  "type": "object"
                },
                "activated": {
                  "description": "True if the subscription has been activated",
                  "type": "boolean"
                },
                "company": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to company information."
                },
                "contract": {
                  "title": "OrderContract",
                  "properties": {
                    "cancellationPeriodLimit": {
                      "description": "Cancellation period limit",
                      "nullable": true,
                      "type": "number"
                    },
                    "endOfContractDate": {
                      "description": "End date for contract",
                      "type": "number"
                    },
                    "endOfContractGracePeriod": {
                      "description": "Grace period for end of contract",
                      "nullable": true,
                      "type": "number"
                    },
                    "gracePeriodEndDate": {
                      "description": "End date for grace period",
                      "nullable": true,
                      "type": "number"
                    },
                    "minimumServiceLength": {
                      "description": "Minimum service length of contract",
                      "type": "number"
                    },
                    "renewal": {},
                    "terminationFee": {}
                  },
                  "example": {
                    "cancellationPeriodLimit": null,
                    "endOfContractDate": 1588789800000,
                    "endOfContractGracePeriod": null,
                    "gracePeriodEndDate": null,
                    "minimumServiceLength": 24,
                    "renewal": null,
                    "terminationFee": {}
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "The contract terms of the order, if applicable. If the order does not have contract terms, this field is null."
                },
                "currency": {
                  "description": "Currency.",
                  "nullable": true,
                  "type": "string"
                },
                "customAttributes": {
                  "description": "List of custom attributes associated with this order",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "title": "CustomAttribute",
                    "properties": {},
                    "example": {}
                  }
                },
                "discount": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to the discount applied to this order (optional)"
                },
                "discountId": {
                  "description": "The unique identifier for the discount applied to this order",
                  "nullable": true,
                  "type": "number"
                },
                "endDate": {
                  "description": "Order end date.",
                  "nullable": true,
                  "type": "number"
                },
                "endOfDiscountDate": {
                  "description": "Discount end date.",
                  "nullable": true,
                  "type": "number"
                },
                "frequency": {
                  "description": "Frequency.",
                  "nullable": true,
                  "type": "string"
                },
                "id": {
                  "description": "ID.",
                  "nullable": true,
                  "type": "number"
                },
                "links": {
                  "description": "Resource links",
                  "type": "array",
                  "items": {
                    "title": "Link",
                    "properties": {},
                    "example": {},
                    "nullable": true,
                    "type": "object"
                  }
                },
                "nextBillingDate": {
                  "description": "Next billing date for the order",
                  "nullable": true,
                  "type": "number"
                },
                "nextOrder": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to the next order for this subscription"
                },
                "oneTimeOrders": {
                  "description": "List of one time orders associated with this subscription order",
                  "type": "array",
                  "items": {
                    "description": "Resource links",
                    "title": "OrderListing",
                    "properties": {},
                    "example": {},
                    "nullable": true,
                    "type": "object"
                  }
                },
                "orderLines": {
                  "description": "List of order lines for this subscription order",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "title": "OrderLine",
                    "properties": {},
                    "example": {}
                  }
                },
                "parameters": {
                  "description": "List of custom parameters associated with this order",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "title": "Parameter",
                    "properties": {},
                    "example": {}
                  }
                },
                "parentSubscriptionId": {
                  "description": "Parent subscription ID of an add-on subscription",
                  "nullable": true,
                  "type": "number"
                },
                "paymentPlan": {
                  "description": "Payment plan for this order",
                  "type": "object",
                  "title": "PaymentPlan",
                  "properties": {
                    "allowCustomUsage": {
                      "description": "Custom usage allowed",
                      "type": "boolean"
                    },
                    "contract": {},
                    "cost": {
                      "description": "List of plan costs",
                      "type": "array",
                      "items": {}
                    },
                    "discount": {},
                    "frequency": {
                      "description": "Billing frequency: MONTHLY, QUARTERLY, SIX_MONTHS, YEARLY, TWO_YEARS, THREE_YEARS, DAILY",
                      "type": "string"
                    },
                    "href": {
                      "description": "URL to payment plan details",
                      "type": "string"
                    },
                    "id": {
                      "description": "ID",
                      "type": "number"
                    },
                    "isPrimaryPrice": {
                      "description": "Is primary price",
                      "type": "boolean"
                    },
                    "keepBillDateOnUsageChange": {
                      "description": "Keep bill date on usage change",
                      "type": "boolean"
                    },
                    "separatePrepaid": {
                      "description": "Separate prepaid",
                      "type": "boolean"
                    },
                    "tld": {
                      "description": "If plan is part of a domain reseller product, this is the tld this plan offers",
                      "type": "string"
                    },
                    "uuid": {
                      "description": "Unique identifier",
                      "nullable": true,
                      "type": "string"
                    }
                  },
                  "example": {
                    "allowCustomUsage": true,
                    "contract": {},
                    "cost": [],
                    "discount": {},
                    "frequency": "...",
                    "href": "...",
                    "id": 12345,
                    "isPrimaryPrice": true,
                    "keepBillDateOnUsageChange": true,
                    "separatePrepaid": true,
                    "tld": "...",
                    "uuid": "..."
                  }
                },
                "paymentPlanId": {
                  "description": "The unique identifier for the payment plan for this order",
                  "nullable": true,
                  "type": "number"
                },
                "previousOrder": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to the previous order for this subscription"
                },
                "referenceCode": {
                  "description": "Reference code",
                  "nullable": true,
                  "type": "string"
                },
                "salesSupportCompany": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to sales support company information"
                },
                "salesSupportUser": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to sales support user information"
                },
                "serviceStartDate": {
                  "description": "Service start date for the order",
                  "nullable": true,
                  "type": "number"
                },
                "startDate": {
                  "description": "Order start date",
                  "nullable": true,
                  "type": "number"
                },
                "status": {
                  "description": "Order status",
                  "nullable": true,
                  "type": "string"
                },
                "totalPrice": {
                  "description": "Total price for the order",
                  "nullable": true,
                  "type": "number"
                },
                "type": {
                  "description": "Type.",
                  "nullable": true,
                  "type": "string"
                },
                "user": {
                  "title": "LinkWS",
                  "properties": {
                    "href": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "href": "...",
                    "id": "..."
                  },
                  "nullable": true,
                  "type": "object",
                  "description": "Link to user information"
                }
              },
              "example": {
                "_embedded": {
                  "property1": {},
                  "property2": {}
                },
                "activated": true,
                "company": {
                  "href": "...",
                  "id": "..."
                },
                "contract": {},
                "currency": "...",
                "customAttributes": [
                  {
                    "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": "..."
                },
                "oneTimeOrders": [
                  {
                    "_embedded": {},
                    "company": {},
                    "currency": "...",
                    "endDate": 12345,
                    "endOfDiscountDate": 12345,
                    "frequency": "...",
                    "id": 12345,
                    "links": [],
                    "nextBillingDate": 12345,
                    "paymentPlan": {},
                    "referenceCode": "...",
                    "salesSupportUser": {},
                    "startDate": 12345,
                    "status": "...",
                    "totalPrice": 12345,
                    "type": "...",
                    "user": {}
                  },
                  {
                    "_embedded": {},
                    "company": {},
                    "currency": "...",
                    "endDate": 12345,
                    "endOfDiscountDate": 12345,
                    "frequency": "...",
                    "id": 12345,
                    "links": [],
                    "nextBillingDate": 12345,
                    "paymentPlan": {},
                    "referenceCode": "...",
                    "salesSupportUser": {},
                    "startDate": 12345,
                    "status": "...",
                    "totalPrice": 12345,
                    "type": "...",
                    "user": {}
                  }
                ],
                "orderLines": [
                  {},
                  {}
                ],
                "parameters": [
                  {
                    "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": [
                    {},
                    {}
                  ],
                  "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": "..."
                }
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Upcoming order"
            }
          ]
        },
        "user": {
          "allOf": [
            {
              "title": "LinkWS",
              "properties": {
                "href": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                }
              },
              "example": {
                "href": "...",
                "id": "..."
              },
              "nullable": true,
              "type": "object"
            },
            {
              "description": "Link to user information"
            }
          ]
        }
      },
      "example": {
        "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": "...",
          "customAttributes": [
            {
              "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": "..."
          },
          "oneTimeOrders": [
            {
              "_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": {}
            }
          ],
          "orderLines": [
            {},
            {}
          ],
          "parameters": [
            {
              "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": "...",
          "customAttributes": [
            {
              "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": "..."
          },
          "oneTimeOrders": [
            {
              "_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": {}
            }
          ],
          "orderLines": [
            {},
            {}
          ],
          "parameters": [
            {
              "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": "..."
        }
      },
      "nullable": true,
      "type": "object"
    },
    {
      "description": "Subscription data object"
    }
  ]
}';
const headers = {
    'Content-Type':'application/json',
    'Accept':'application/json'
};
fetch('https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions/preview',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

URL obj = new URL("https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions/preview");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
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());

Request body

{
  "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": "...",
    "customAttributes": [
      {
        "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": "..."
    },
    "oneTimeOrders": [
      {
        "_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": {}
      }
    ],
    "orderLines": [
      {},
      {}
    ],
    "parameters": [
      {
        "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": "...",
    "customAttributes": [
      {
        "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": "..."
    },
    "oneTimeOrders": [
      {
        "_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": {}
      }
    ],
    "orderLines": [
      {},
      {}
    ],
    "parameters": [
      {
        "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": "..."
  }
}

Example response

{
  "assignedUsers": null,
  "company": null,
  "creationDate": null,
  "edition": null,
  "endDate": null,
  "externalAccountId": null,
  "id": null,
  "maxUsers": null,
  "order": {
    "activated": false,
    "company": null,
    "contract": null,
    "currency": "USD",
    "discount": null,
    "discountId": null,
    "endDate": null,
    "endOfDiscountDate": null,
    "frequency": "MONTHLY",
    "id": null,
    "links": [],
    "nextBillingDate": 1483599600000,
    "nextOrder": null,
    "oneTimeOrders": [],
    "orderLines": [
      {
        "description": "Test App 1 - null - Per User Fee",
        "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": "PENDING_REMOTE_CREATION",
    "totalPrice": 10,
    "type": "NEW",
    "user": null
  },
  "product": null,
  "redirectUrl": null,
  "status": null,
  "upcomingOrder": null,
  "user": null
}

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

Preview creating 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

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)

externalId string

External ID for a subscription

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

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 = {
    'Content-Type':'application/json',
    'Accept':'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 = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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
applicationIds query number Filters subscriptions by internal application ID
count query integer 250 Number of results to fetch. Used for paging.
currency query string of enum:
USD
CAD
EUR
JPY
GBP
KRW
CHF
SEK
SGD
MYR
AUD
MXN
INR
BRL
DKK
NZD
NOK
ZAR
PHP
CNY
SAR
GTQ
IDR
ARS
COP
PEN
Filters subscriptions by currency
frequency query string of enum:
ONE_TIME
MONTHLY
QUARTERLY
SIX_MONTHS
YEARLY
TWO_YEARS
THREE_YEARS
DAILY
Filters subscriptions by pricing frequency
fromCreationDate query number Filters results to only include subscriptions that were created on or after the specified date
orderReferenceCode query string Filters subscriptions by order reference code
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.
startDateFrom query number Filters results to only include subscriptions that were created on or after the specified date
startDateTo query number Filters results to only include subscriptions that were created on or before the specified date
status query string of enum:
INITIALIZED
PENDING_USER_APPROVAL
PENDING_REMOTE_CREATION
PENDING_MANUAL_RECOVERY
PENDING_ASYNCHRONOUS_CREATION
FREE_TRIAL
ACTIVE
FINISHED
ONE_TIME
CANCELLED
SUSPENDED
FREE_TRIAL_EXPIRED
FREE_TRIAL_CANCELLED
DELETED
FAILED
UPCOMING
PENDING_MIGRATION_ACTIVATION
PENDING_DELAYED_PROVISIONING
Filters subscriptions by order status
*subscriptionId path string Subscription ID.
toCreationDate query number Filters results to only include subscriptions that were created on or before the specified date
type query string of enum:
NEW
MIGRATION
ADOPTION
FREE_TRIAL_ACTIVATION
TERMINATION_FEE
END_OF_CONTRACT_MIGRATION
REFUND
CREDIT
ONE_TIME_FEE
ADDITIONAL_FEE
END_OF_DISCOUNT_MIGRATION
METERED_USAGE
BUNDLED
Filters subscriptions by subscription type

Responses

Status Meaning Description Definition
200 OK OK OrderDetailedListing

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 = {
    'Content-Type':'application/json',
    'Accept':'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 = {
    'Content-Type':'application/json',
    'Accept':'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);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)

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
applicationIds query number Filters subscriptions by internal application ID
bundleApplicationId query number Filters subscriptions by internal bundle ID
*companyId path string User's company ID
count query integer 250 Number of results to fetch. Used for paging.
discountId query number Filters subscriptions by internal discount ID
editionId query number Filters subscriptions by internal edition ID
expand query string Expands filtered subscription results to include details about the specified query parameters, one or more of "order", "product", or "edition".
fromDate query number Filters results to only include subscriptions that were created on or after the specified date
lastModified query number Filters subscriptions by last modified date
orderReferenceCode query string Filters subscriptions by order reference code
paymentPlanId query number Filters subscriptions by internal payment plan ID
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.
status query string Filters subscriptions by order status
toDate query number Filters results to only include subscriptions that were created on or before the specified date
*userId path string User ID

Responses

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

Manage subscription lifecycle

Example request

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

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

var headers = {
    'Content-Type':'application/json',
    'Accept':'application/json'
};
$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}',
  method: 'patch',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})

const request = require('node-fetch');
const inputBody = '{
  "allOf": [
    {
      "title": "SubscriptionUpdate",
      "required": [
        "status"
      ],
      "properties": {
        "externalId": {
          "description": "The external ID to add or update in the subscription. Only set an external ID if required.",
          "type": "string"
        },
        "status": {
          "description": "(Required) The desired subscription lifecycle status. Set to SUSPENDED to suspend an active subscription, or ACTIVE to reactivate a suspended subscription.",
          "type": "string",
          "enum": [
            "ACTIVE",
            "SUSPENDED"
          ]
        },
        "suspensionReasonMessage": {
          "description": "Reason for subscription suspension. Only used, and required, when setting the status to SUSPENDED.",
          "type": "string"
        }
      },
      "example": {
        "status": "SUSPENDED",
        "suspensionReasonMessage": "The customer is undergoing an internal investigation. All subscriptions are suspended."
      },
      "nullable": true,
      "type": "object"
    },
    {
      "description": "Subscription data object"
    }
  ]
}';
const headers = {
    'Content-Type':'application/json',
    'Accept':'application/json'
};
fetch('https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}',
{
  method: 'PATCH',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

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

result = RestClient.patch 'https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}',
  params: {
  }, headers: headers

p JSON.parse(result)

URL obj = new URL("https://{marketplaceURL}/api/billing/v1/subscriptions/{subscriptionId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PATCH");
int responseCode = con.getResponseCode();
BufferedReader in