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

AppMarket 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.

The AppMarket API Reference lists various APIs that you can use to manage and interact with your marketplace.

Use the following URL format to send API calls:

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

For example:

https://myMarketplace.com/api/marketplace/v1/bundles

Generated on 2018-05-23 15:35:05 EST

Bundles

List all bundles

This call lists all bundles on the marketplace.

Example request


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

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



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

};

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

};

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

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

result = RestClient.get 'https://{marketplaceURL}/api/marketplace/v1/bundles',

params: {
},
headers: headers

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

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

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/marketplace/v1/bundles");
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

[
  {
    "addon": false,
    "billingFrequency": "MONTHLY",
    "blurb": "Bundle Blurb",
    "bundleUrls": [],
    "bundledProducts": [],
    "buyable": false,
    "collectLeads": false,
    "description": "Bundle Description",
    "developerName": "Appdirect",
    "discountDetails": null,
    "downloadFileSize": null,
    "featured": false,
    "featuredSliderPosition": null,
    "free": false,
    "freeTrialOrEditionPresent": true,
    "hasLyncToPhone": false,
    "hidePricings": false,
    "href": "http://localhost/api/marketplace/v1/bundles/257",
    "iconUrl": null,
    "id": 257,
    "lastModified": 1461792752644,
    "name": "MockApp3891706169852983393",
    "numRatings": null,
    "overview": null,
    "overviewImageUrl": null,
    "popular": false,
    "popularity": null,
    "productType": "BUNDLE",
    "profileLogoUrl": null,
    "publishedOn": 1461792752534,
    "rating": null,
    "referable": false,
    "sortRank": 5,
    "staffPick": false,
    "staffPickSliderPosition": null,
    "startingPrice": "$0.00/User/Mo",
    "supportedLanguages": [
      "en"
    ],
    "tags": [],
    "url": "http://localhost/apps/257",
    "uuid": "df44129f-3c03-40eb-a112-b04e455b8c3f",
    "vendorName": "Appdirect"
  }
]

GET /marketplace/v1/bundles

List all bundles This call lists all bundles on the marketplace.

Responses

Status Meaning Description Definition
200 OK List of product bundle. BundleListing

Retrieve a bundle

This call returns all details about a specific bundle.

Example request


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

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



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

};

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

};

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

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

result = RestClient.get 'https://{marketplaceURL}/api/marketplace/v1/bundles/{bundleId}',

params: {
},
headers: headers

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

r = requests.get('https://{marketplaceURL}/api/marketplace/v1/bundles/{bundleId}',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/marketplace/v1/bundles/{bundleId}");
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

{
  "billingFrequency": null,
  "blurb": "Bundle Blurb",
  "bundledProducts": [],
  "buyable": false,
  "changeSubscriptionAllowed": true,
  "collectLeads": false,
  "collectLeadsWithPurchaseEnabled": false,
  "description": "Bundle Description",
  "discountDetails": null,
  "downloadFileSize": null,
  "featured": false,
  "featuredSliderPosition": null,
  "free": false,
  "freeTrialOrEditionPresent": false,
  "href": "http://localhost/api/marketplace/v1/bundles/245",
  "iconUrl": null,
  "id": 245,
  "lastModified": 1461792750786,
  "name": "MockApp-4393604041692298141",
  "newSubscriptionEnabled": true,
  "numRatings": null,
  "overview": null,
  "overviewImageUrl": null,
  "popular": false,
  "popularity": null,
  "productType": "BUNDLE",
  "profileLogoUrl": null,
  "provider": {
    "name": "Appdirect",
    "url": "appdirect.com",
    "uuid": "b863d403-f8a7-4d38-9f89-c5fa021c2b7e"
  },
  "publishedOn": 1461792750665,
  "rating": null,
  "referable": false,
  "staffPick": false,
  "staffPickSliderPosition": null,
  "startingPrice": null,
  "supportedLanguages": [
    "en"
  ],
  "tags": [],
  "url": "http://localhost/apps/245"
}

GET /marketplace/v1/bundles/{bundleId}

Retrieve a bundle This call returns all details about a specific bundle.

Parameters

Parameter Type Data Type Default Description
*bundleId path number Bundle product id

Responses

Status Meaning Description Definition
200 OK Bundle application read. Bundle
404 Not Found Bundle application not found.

Retrieve a bundle status

This call returns the current state of the bundle.

Example request


curl -X get https://{marketplaceURL}/api/marketplace/v1/bundles/{bundleId}/status \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/marketplace/v1/bundles/{bundleId}/status HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



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

};

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

};

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

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

result = RestClient.get 'https://{marketplaceURL}/api/marketplace/v1/bundles/{bundleId}/status',

params: {
},
headers: headers

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

r = requests.get('https://{marketplaceURL}/api/marketplace/v1/bundles/{bundleId}/status',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/marketplace/v1/bundles/{bundleId}/status");
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,
    "companyEntitlementId": null,
    "companyEntitlementPending": false,
    "companyWide": false,
    "editionId": null,
    "editionPricingId": null,
    "freeTrialAllowed": true,
    "freeTrialDaysLeft": 0,
    "ownerAdmin": false,
    "ownerFullName": null,
    "ownerId": null,
    "ownerUuid": null,
    "partOfExistingBundle": false,
    "pending": false,
    "pendingAppType": "REQUESTED",
    "requested": false
  }
]

GET /marketplace/v1/bundles/{bundleId}/status

Retrieve a bundle status This call returns the current state of the bundle.

Parameters

Parameter Type Data Type Default Description
*bundleId path number Bundle product id

Responses

Status Meaning Description Definition
200 OK Bundle application status read. UserAppInfo
404 Not Found Bundle application not found.

Companies

Read a company

Example request


curl -X get https://{marketplaceURL}/api/account/v2/companies/{companyUuid} \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/account/v2/companies/{companyUuid} HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



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

};

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

};

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

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

result = RestClient.get 'https://{marketplaceURL}/api/account/v2/companies/{companyUuid}',

params: {
},
headers: headers

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

r = requests.get('https://{marketplaceURL}/api/account/v2/companies/{companyUuid}',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/account/v2/companies/{companyUuid}");
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

{
  "customAttributes": [
    {
      "attributeType": "TEXT",
      "hint": "US West, US Central, or US East",
      "label": "Geographic Region",
      "name": "Geographic Region",
      "value": "US"
    },
    {
      "attributeType": "MULTISELECT",
      "hint": "",
      "label": "Label Names",
      "name": "Company Details",
      "valueKeys": [
        "great option"
      ]
    }
  ],
  "defaultRole": "USER",
  "enabled": true,
  "links": [
    {
      "href": "http://appdirect/api/account/v2/companies/d689b970-f3f9-42a6-a974-90e2bdadf860",
      "rel": "self"
    },
    {
      "href": "http://appdirect/api/account/v2/companies/d689b970-f3f9-42a6-a974-90e2bdadf860/memberships",
      "rel": "memberships"
    }
  ],
  "name": "Company 7078259907",
  "phoneNumber": "9259221234",
  "picture": "http://localhost:8080/profilePics/http://cdn/company.png",
  "reseller": false,
  "uuid": "d689b970-f3f9-42a6-a974-90e2bdadf860",
  "vendor": false
}

GET /account/v2/companies/{companyUuid}

Retrieve a marketplace company.

Required Scope and Authorization Rules

Scope Rule
ROLE_CHANNEL_ADMIN Allows access as a Marketplace Manager for the marketplace.
ROLE_CHANNEL_SUPPORT Allows access as a Customer Support agent for the marketplace.
ROLE_CORPORATE_ADMIN Allows access as a Network Manager for the marketplace.
ROLE_PARTNER_READ Allows access to read all marketplace data.
ROLE_RESELLER Allows access as a Reseller for the company.
ROLE_SALES_SUPPORT Allows access as a Sales Support agent for the marketplace.
ROLE_USER Allows access as an end user in the company.

Parameters

Parameter Type Data Type Default Description
*companyUuid path string Unique identifier of company in the API request

Responses

Status Meaning Description Definition
200 OK Success CompanyAccountV2
401 Unauthorized Unauthorized
404 Not Found Company not found

Read activities

Example request


curl -X get https://{marketplaceURL}/api/account/v2/companies/{companyUuid}/activities \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

GET https://{marketplaceURL}/api/account/v2/companies/{companyUuid}/activities HTTP/1.1
Host: appdirect.com
Content-Type: application/json
Accept: application/json



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

};

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

};

fetch('https://{marketplaceURL}/api/account/v2/companies/{companyUuid}/activities',
{
  method: 'GET',headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

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

result = RestClient.get 'https://{marketplaceURL}/api/account/v2/companies/{companyUuid}/activities',

params: {
},
headers: headers

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

r = requests.get('https://{marketplaceURL}/api/account/v2/companies/{companyUuid}/activities',

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/account/v2/companies/{companyUuid}/activities");
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": [
    {
      "actor": {
        "activated": false,
        "deleted": false,
        "email": "c2801919@appdirect.com",
        "externalId": null,
        "id": 1344,
        "name": "C2801919_first last",
        "personalInfoMasked": false,
        "profileLinkMasked": false,
        "roleChanges": null,
        "type": "USER",
        "userRemovedFromCompanyObject": false,
        "userRemovedFromCompanyTarget": false,
        "uuid": "966216bb-bb4e-4766-8849-fd72eead20ce"
      },
      "context": {
        "description": "Documentation Center 283",
        "header": "Documentation Center 283",
        "imageUrl": "https://d33na3ni6eqf5j.cloudfront.net/importable_app_resources/81858cea-627f-45ee-8906-67d5a23dd3bf/list.png?b5960593b97c0fdd95bc9b81c08e70bb"
      },
      "links": [],
      "object": {
        "companyLinkMasked": false,
        "externalId": null,
        "id": 26,
        "name": "Company 6032459369",
        "type": "COMPANY",
        "uuid": "222cf5ff-7795-4ece-b612-83ef6b72bb30"
      },
      "origin": "MARKETPLACE",
      "subject": {
        "activated": true,
        "deleted": false,
        "email": "susan.doe@company5087848592.com",
        "externalId": null,
        "id": 30,
        "name": "Susan Doe",
        "personalInfoMasked": false,
        "profileLinkMasked": false,
        "type": "USER",
        "userRemovedFromCompanyObject": false,
        "userRemovedFromCompanyTarget": false,
        "uuid": "8487f55b-05be-4c0e-97d8-021e5ca4008b"
      },
      "target": {
        "companyLinkMasked": false,
        "externalId": null,
        "id": 194379,
        "name": "Matts Company",
        "type": "COMPANY",
        "uuid": "a0504b87-f21f-40fe-9de1-e8479776a26f"
      },
      "timestamp": [
        2016,
        12,
        2,
        17,
        25,
        56,
        414
      ],
      "verb": "COMPANY_ACTIVATED"
    },
    {
      "actor": {
        "activated": false,
        "deleted": false,
        "email": "c3945627346@appdirect.com",
        "externalId": null,
        "id": 1434,
        "name": "Adam Smith",
        "personalInfoMasked": false,
        "profileLinkMasked": false,
        "roleChanges": null,
        "type": "USER",
        "userRemovedFromCompanyObject": false,
        "userRemovedFromCompanyTarget": false,
        "uuid": "ac6216bb-bb4e-4766-8849-fd72eead20ce"
      },
      "context": {
        "description": "Documentation Center 283",
        "header": "Documentation Center 283",
        "imageUrl": "https://d33na3ni6eqf5j.cloudfront.net/importable_app_resources/81858cea-627f-45ee-8906-67d5a23dd3bf/list.png?b5960593b97c0fdd95bc9b81c08e70bb"
      },
      "links": [],
      "object": {
        "companyLinkMasked": false,
        "externalId": null,
        "id": 26,
        "name": "Company 6032459369",
        "type": "COMPANY",
        "uuid": "222cf5ff-7795-4ece-b612-83ef6b72bb30"
      },
      "origin": null,
      "subject": {
        "activated": true,
        "deleted": false,
        "email": "susan.doe@company5087848592.com",
        "externalId": null,
        "id": 30,
        "name": "Susan Doe",
        "personalInfoMasked": false,
        "profileLinkMasked": false,
        "type": "USER",
        "userRemovedFromCompanyObject": false,
        "userRemovedFromCompanyTarget": false,
        "uuid": "8487f55b-05be-4c0e-97d8-021e5ca4008b"
      },
      "target": {
        "companyLinkMasked": false,
        "externalId": null,
        "id": 149379,
        "name": "Global Company",
        "type": "COMPANY",
        "uuid": "70904b87-a2bf-40fe-9de1-e8479776a26f"
      },
      "timestamp": [
        2016,
        12,
        2,
        17,
        25,
        56,
        401
      ],
      "verb": "USER_JOINED"
    }
  ],
  "links": [],
  "page": {
    "number": 0,
    "size": 2,
    "totalElements": 2,
    "totalPages": 1
  }
}

GET /account/v2/companies/{companyUuid}/activities

Retrieve company or user activities.

The displayType parameter dictates whether activities for the given user or activities for the whole company are returned.

Required Scope and Authorization Rules

Scope Rule
ROLE_CHANNEL_ADMIN Allows access as a Marketplace Manager for the marketplace.
ROLE_CHANNEL_SUPPORT Allows access as a Customer Support agent for the marketplace.
ROLE_CORPORATE_ADMIN Allows access as a Network Manager for the marketplace.
ROLE_PARTNER_READ Allows access to read all marketplace data.
ROLE_RESELLER Allows access as a Reseller for the company.
ROLE_SALES_SUPPORT Allows access as a Sales Support agent for the marketplace.
ROLE_USER Allows access as an end user in the company.

Parameters

Parameter Type Data Type Default Description
*companyUuid path string Unique identifier of company in the API request
displayType query string of enum:
EVERYONE
ONLY_ME
ONLY_ME Scope
page query integer 0 Zero-based page index
size query integer 12 The size of the page to be returned

Responses

Status Meaning Description Definition
200 OK Success PagedActivityAccountV2
401 Unauthorized Unauthorized
404 Not Found Company not found

List all invoices for a company

Example request


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

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



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

};

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

};

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

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

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

params: {
},
headers: headers

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

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

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/companies/{companyId}/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/644eb32e-4afa-4699-9dae-5d3394320968",
      "id": "644eb32e-4afa-4699-9dae-5d3394320968"
    },
    "creationDate": 1481002410613,
    "currency": "USD",
    "dueDate": 1481353200000,
    "invoiceId": 20,
    "links": [
      {
        "href": "http://appdirect/api/account/v2/users/a18c91e8-d5d5-4fb8-915c-726535a0bc8a",
        "rel": "user"
      },
      {
        "href": "http://appdirect/api/account/v2/companies/644eb32e-4afa-4699-9dae-5d3394320968",
        "rel": "company"
      },
      {
        "href": "http://appdirect/api/billing/v1/invoices/20",
        "rel": "self"
      }
    ],
    "referenceNumber": null,
    "status": "PAID",
    "total": 10,
    "user": {
      "href": "http://appdirect/api/account/v1/users/a18c91e8-d5d5-4fb8-915c-726535a0bc8a",
      "id": "a18c91e8-d5d5-4fb8-915c-726535a0bc8a"
    }
  }
]

GET /billing/v1/companies/{companyId}/invoices

List all of the invoices for the given company

Parameters

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

Responses

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

List all purchase orders for a company

Example request


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

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



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

};

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

};

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

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

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

params: {
},
headers: headers

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

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

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/companies/{companyId}/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/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": 10,
      "type": "NEW",
      "user": {
        "href": "http://appdirect/api/account/v1/users/c47d0fd7-b67a-4e07-84f8-f93dfafbeecc",
        "id": "c47d0fd7-b67a-4e07-84f8-f93dfafbeecc"
      }
    }
  ],
  "total": 1
}

GET /billing/v1/companies/{companyId}/orders

List all of the purchase orders for the given company

Parameters

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

Responses

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

List all payments for a company

Example request


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

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



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

};

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

};

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

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

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

params: {
},
headers: headers

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

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

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/companies/{companyId}/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/644eb32e-4afa-4699-9dae-5d3394320968",
      "id": "644eb32e-4afa-4699-9dae-5d3394320968"
    },
    "currency": "USD",
    "date": 1481002410613,
    "gatewayResponse": {
      "avs": true,
      "code": null,
      "cvv": true,
      "message": null
    },
    "links": [
      {
        "href": "http://appdirect/api/billing/v1/payments/21",
        "rel": "self"
      }
    ],
    "method": "CREDIT_CARD",
    "paymentNumber": 21,
    "result": "SUCCESSFUL",
    "transactionId": "123456abcdef",
    "user": {
      "href": "http://appdirect/api/account/v1/users/a18c91e8-d5d5-4fb8-915c-726535a0bc8a",
      "id": "a18c91e8-d5d5-4fb8-915c-726535a0bc8a"
    }
  }
]

GET /billing/v1/companies/{companyId}/payments

List all of the payments for the given company

Parameters

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

Responses

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

List all subscriptions for a company

Example request


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

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



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

};

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

};

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

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

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

params: {
},
headers: headers

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

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

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/companies/{companyId}/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}/subscriptions

List all of the subscriptions for the given company

Parameters

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

Responses

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

List all invoices for a user

Example request


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

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



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

};

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

};

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

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

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

params: {
},
headers: headers

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

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

params={
},
headers = headers)

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

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

Example response

Headers:
  X-Total-Count: 1
[
  {
    "company": {
      "href": "http://appdirect/api/account/v1/companies/644eb32e-4afa-4699-9dae-5d3394320968",
      "id": "644eb32e-4afa-4699-9dae-5d3394320968"
    },
    "creationDate": 1481002410613,
    "currency": "USD",
    "dueDate": 1481353200000,
    "invoiceId": 20,
    "links": [
      {
        "href": "http://appdirect/api/account/v2/users/a18c91e8-d5d5-4fb8-915c-726535a0bc8a",
        "rel": "user"
      },
      {
        "href": "http://appdirect/api/account/v2/companies/644eb32e-4afa-4699-9dae-5d3394320968",
        "rel": "company"
      },
      {
        "href": "http://appdirect/api/billing/v1/invoices/20",
        "rel": "self"
      }
    ],
    "referenceNumber": null,
    "status": "PAID",
    "total": 10,
    "user": {
      "href": "http://appdirect/api/account/v1/users/a18c91e8-d5d5-4fb8-915c-726535a0bc8a",
      "id": "a18c91e8-d5d5-4fb8-915c-726535a0bc8a"
    }
  }
]

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

List all of the invoices for the given user

Parameters

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

Responses

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

List all purchase orders for a user

Example request


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

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



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

};

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

};

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

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

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

params: {
},
headers: headers

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

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

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/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/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"
      }
    }
  ],
  "total": 1
}

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

List all of the purchase orders for the given user

Parameters

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

Responses

Status Meaning Description Definition
200 OK Response.

List all payment instruments for a user

Example request


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

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



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

};

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

};

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

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

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

params: {
},
headers: headers

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

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

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/paymentInstruments");
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/7ee20d50-8147-482e-839c-775c02e73c45",
      "id": "7ee20d50-8147-482e-839c-775c02e73c45"
    },
    "createdOn": 1481002402567,
    "creditCard": {
      "expirationMonth": 12,
      "expirationYear": 2016,
      "name": "John Doe",
      "number": "12655615611",
      "securityCode": "111",
      "type": "VISA"
    },
    "default": false,
    "id": "e3f7f37b-1e0b-4f05-a8b2-aae74e2f5f2d",
    "parameters": {
      "creditsAccountId": 41111111111111110,
      "externalId": "a1a5-a1da6sa2-asf6fa5-1asfs6-6a5sf16asf",
      "invoicingEmail": "invoicing@gmail.com",
      "issuer": "VISA",
      "maskedPan": "thisIsaMaskedPan",
      "paymentMethod": "CREDIT_CARD",
      "paymentToken": "28c21248-bae0-492c-ab32-8f2dda5fb87d",
      "processUrl": "http://processUrl.com"
    },
    "paymentMethod": "CREDIT_CARD",
    "user": {
      "href": "http://appdirect/api/account/v1/users/952105f7-ad15-4fa3-bdbf-f25736a0dc48",
      "id": "952105f7-ad15-4fa3-bdbf-f25736a0dc48"
    }
  }
]

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

List all of the payment instruments for the given user

Parameters

Parameter Type Data Type Default Description
*companyId path string User's company UUID
*userId path string User UUID

Responses

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

List all payments for a user

Example request


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

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



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

};

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

};

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

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

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

params: {
},
headers: headers

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

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

params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/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/644eb32e-4afa-4699-9dae-5d3394320968",
      "id": "644eb32e-4afa-4699-9dae-5d3394320968"
    },
    "currency": "USD",
    "date": 1481002410613,
    "gatewayResponse": {
      "avs": true,
      "code": null,
      "cvv": true,
      "message": null
    },
    "links": [
      {
        "href": "http://appdirect/api/billing/v1/payments/21",
        "rel": "self"
      }
    ],
    "method": "CREDIT_CARD",
    "paymentNumber": 21,
    "result": "SUCCESSFUL",
    "transactionId": "123456abcdef",
    "user": {
      "href": "http://appdirect/api/account/v1/users/a18c91e8-d5d5-4fb8-915c-726535a0bc8a",
      "id": "a18c91e8-d5d5-4fb8-915c-726535a0bc8a"
    }
  }
]

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

List all of the payments for the given user

Parameters

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

Responses

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

List all subscriptions for a user

Example request


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

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



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

};

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

};

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

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

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

params: {
},
headers: headers

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

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

params={
},
headers = headers)

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

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

Example response

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

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

List all of the subscriptions for the given user

Parameters

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

Responses

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

Create a payment instrument

Example request


curl -X post \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data-binary @- https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/paymentInstruments <<EOF
{
  "accountDisplay": "...",
  "billingAddress": {
    "city": "...",
    "companyName": "...",
    "country": "...",
    "fax": "...",
    "faxExtension": "...",
    "firstName": "...",
    "lastName": "...",
    "phone": "...",
    "phoneExtension": "...",
    "poBox": "...",
    "salutation": "...",
    "state": "...",
    "street1": "...",
    "street2": "...",
    "zip": "..."
  },
  "company": {
    "href": "...",
    "id": "..."
  },
  "createdOn": 12345,
  "creditCard": {
    "expirationMonth": 12345,
    "expirationYear": 12345,
    "name": "...",
    "number": "...",
    "securityCode": "...",
    "type": "AMEX"
  },
  "id": "...",
  "isDefault": true,
  "parameters": {
    "approvedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    },
    "billingId": "...",
    "creditsAccountId": 12345,
    "externalId": "...",
    "gatewayKey": "...",
    "invoicingEmail": "...",
    "issuer": "...",
    "manoTEOBillingId": "...",
    "maskedPan": "...",
    "paymentMethod": "...",
    "paymentToken": "...",
    "processUrl": "...",
    "transactionId": "...",
    "unapprovedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    }
  },
  "paymentMethod": "MANO_TEO_BILL",
  "user": {
    "href": "...",
    "id": "..."
  },
  "vatId": "..."
}
EOF

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

{
  "accountDisplay": "...",
  "billingAddress": {
    "city": "...",
    "companyName": "...",
    "country": "...",
    "fax": "...",
    "faxExtension": "...",
    "firstName": "...",
    "lastName": "...",
    "phone": "...",
    "phoneExtension": "...",
    "poBox": "...",
    "salutation": "...",
    "state": "...",
    "street1": "...",
    "street2": "...",
    "zip": "..."
  },
  "company": {
    "href": "...",
    "id": "..."
  },
  "createdOn": 12345,
  "creditCard": {
    "expirationMonth": 12345,
    "expirationYear": 12345,
    "name": "...",
    "number": "...",
    "securityCode": "...",
    "type": "AMEX"
  },
  "id": "...",
  "isDefault": true,
  "parameters": {
    "approvedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    },
    "billingId": "...",
    "creditsAccountId": 12345,
    "externalId": "...",
    "gatewayKey": "...",
    "invoicingEmail": "...",
    "issuer": "...",
    "manoTEOBillingId": "...",
    "maskedPan": "...",
    "paymentMethod": "...",
    "paymentToken": "...",
    "processUrl": "...",
    "transactionId": "...",
    "unapprovedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    }
  },
  "paymentMethod": "MANO_TEO_BILL",
  "user": {
    "href": "...",
    "id": "..."
  },
  "vatId": "..."
}


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

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/paymentInstruments',
  method: 'post',
  dataType: 'json',
  data: {
  "accountDisplay": "...",
  "billingAddress": {
    "city": "...",
    "companyName": "...",
    "country": "...",
    "fax": "...",
    "faxExtension": "...",
    "firstName": "...",
    "lastName": "...",
    "phone": "...",
    "phoneExtension": "...",
    "poBox": "...",
    "salutation": "...",
    "state": "...",
    "street1": "...",
    "street2": "...",
    "zip": "..."
  },
  "company": {
    "href": "...",
    "id": "..."
  },
  "createdOn": 12345,
  "creditCard": {
    "expirationMonth": 12345,
    "expirationYear": 12345,
    "name": "...",
    "number": "...",
    "securityCode": "...",
    "type": "AMEX"
  },
  "id": "...",
  "isDefault": true,
  "parameters": {
    "approvedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    },
    "billingId": "...",
    "creditsAccountId": 12345,
    "externalId": "...",
    "gatewayKey": "...",
    "invoicingEmail": "...",
    "issuer": "...",
    "manoTEOBillingId": "...",
    "maskedPan": "...",
    "paymentMethod": "...",
    "paymentToken": "...",
    "processUrl": "...",
    "transactionId": "...",
    "unapprovedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    }
  },
  "paymentMethod": "MANO_TEO_BILL",
  "user": {
    "href": "...",
    "id": "..."
  },
  "vatId": "..."
},

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const inputBody = '{
  "accountDisplay": "...",
  "billingAddress": {
    "city": "...",
    "companyName": "...",
    "country": "...",
    "fax": "...",
    "faxExtension": "...",
    "firstName": "...",
    "lastName": "...",
    "phone": "...",
    "phoneExtension": "...",
    "poBox": "...",
    "salutation": "...",
    "state": "...",
    "street1": "...",
    "street2": "...",
    "zip": "..."
  },
  "company": {
    "href": "...",
    "id": "..."
  },
  "createdOn": 12345,
  "creditCard": {
    "expirationMonth": 12345,
    "expirationYear": 12345,
    "name": "...",
    "number": "...",
    "securityCode": "...",
    "type": "AMEX"
  },
  "id": "...",
  "isDefault": true,
  "parameters": {
    "approvedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    },
    "billingId": "...",
    "creditsAccountId": 12345,
    "externalId": "...",
    "gatewayKey": "...",
    "invoicingEmail": "...",
    "issuer": "...",
    "manoTEOBillingId": "...",
    "maskedPan": "...",
    "paymentMethod": "...",
    "paymentToken": "...",
    "processUrl": "...",
    "transactionId": "...",
    "unapprovedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    }
  },
  "paymentMethod": "MANO_TEO_BILL",
  "user": {
    "href": "...",
    "id": "..."
  },
  "vatId": "..."
}';
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

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

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

result = RestClient.post 'https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/paymentInstruments',
payload={
  "accountDisplay": "...",
  "billingAddress": {
    "city": "...",
    "companyName": "...",
    "country": "...",
    "fax": "...",
    "faxExtension": "...",
    "firstName": "...",
    "lastName": "...",
    "phone": "...",
    "phoneExtension": "...",
    "poBox": "...",
    "salutation": "...",
    "state": "...",
    "street1": "...",
    "street2": "...",
    "zip": "..."
  },
  "company": {
    "href": "...",
    "id": "..."
  },
  "createdOn": 12345,
  "creditCard": {
    "expirationMonth": 12345,
    "expirationYear": 12345,
    "name": "...",
    "number": "...",
    "securityCode": "...",
    "type": "AMEX"
  },
  "id": "...",
  "isDefault": true,
  "parameters": {
    "approvedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    },
    "billingId": "...",
    "creditsAccountId": 12345,
    "externalId": "...",
    "gatewayKey": "...",
    "invoicingEmail": "...",
    "issuer": "...",
    "manoTEOBillingId": "...",
    "maskedPan": "...",
    "paymentMethod": "...",
    "paymentToken": "...",
    "processUrl": "...",
    "transactionId": "...",
    "unapprovedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    }
  },
  "paymentMethod": "MANO_TEO_BILL",
  "user": {
    "href": "...",
    "id": "..."
  },
  "vatId": "..."
}
params: {
},
headers: headers

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

r = requests.post('https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/paymentInstruments',
json={
  "accountDisplay": "...",
  "billingAddress": {
    "city": "...",
    "companyName": "...",
    "country": "...",
    "fax": "...",
    "faxExtension": "...",
    "firstName": "...",
    "lastName": "...",
    "phone": "...",
    "phoneExtension": "...",
    "poBox": "...",
    "salutation": "...",
    "state": "...",
    "street1": "...",
    "street2": "...",
    "zip": "..."
  },
  "company": {
    "href": "...",
    "id": "..."
  },
  "createdOn": 12345,
  "creditCard": {
    "expirationMonth": 12345,
    "expirationYear": 12345,
    "name": "...",
    "number": "...",
    "securityCode": "...",
    "type": "AMEX"
  },
  "id": "...",
  "isDefault": true,
  "parameters": {
    "approvedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    },
    "billingId": "...",
    "creditsAccountId": 12345,
    "externalId": "...",
    "gatewayKey": "...",
    "invoicingEmail": "...",
    "issuer": "...",
    "manoTEOBillingId": "...",
    "maskedPan": "...",
    "paymentMethod": "...",
    "paymentToken": "...",
    "processUrl": "...",
    "transactionId": "...",
    "unapprovedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    }
  },
  "paymentMethod": "MANO_TEO_BILL",
  "user": {
    "href": "...",
    "id": "..."
  },
  "vatId": "..."
}
params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/paymentInstruments");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
String inputBody = "{" +
  "\"accountDisplay\": \"...\"," +
  "\"billingAddress\": {" +
    "\"city\": \"...\"," +
    "\"companyName\": \"...\"," +
    "\"country\": \"...\"," +
    "\"fax\": \"...\"," +
    "\"faxExtension\": \"...\"," +
    "\"firstName\": \"...\"," +
    "\"lastName\": \"...\"," +
    "\"phone\": \"...\"," +
    "\"phoneExtension\": \"...\"," +
    "\"poBox\": \"...\"," +
    "\"salutation\": \"...\"," +
    "\"state\": \"...\"," +
    "\"street1\": \"...\"," +
    "\"street2\": \"...\"," +
    "\"zip\": \"...\"" +
  "}," +
  "\"company\": {" +
    "\"href\": \"...\"," +
    "\"id\": \"...\"" +
  "}," +
  "\"createdOn\": 12345," +
  "\"creditCard\": {" +
    "\"expirationMonth\": 12345," +
    "\"expirationYear\": 12345," +
    "\"name\": \"...\"," +
    "\"number\": \"...\"," +
    "\"securityCode\": \"...\"," +
    "\"type\": \"AMEX\"" +
  "}," +
  "\"id\": \"...\"," +
  "\"isDefault\": true," +
  "\"parameters\": {" +
    "\"approvedTBillInfo\": {" +
      "\"company\": \"...\"," +
      "\"createdByCompany\": 12345," +
      "\"createdByUser\": 12345," +
      "\"createdOn\": 12345," +
      "\"lastModified\": 12345," +
      "\"nnsa\": \"...\"," +
      "\"rejected\": true," +
      "\"repFirstName\": \"...\"," +
      "\"repLastName\": \"...\"," +
      "\"repPONumber\": \"...\"," +
      "\"tan\": \"...\"" +
    "}," +
    "\"billingId\": \"...\"," +
    "\"creditsAccountId\": 12345," +
    "\"externalId\": \"...\"," +
    "\"gatewayKey\": \"...\"," +
    "\"invoicingEmail\": \"...\"," +
    "\"issuer\": \"...\"," +
    "\"manoTEOBillingId\": \"...\"," +
    "\"maskedPan\": \"...\"," +
    "\"paymentMethod\": \"...\"," +
    "\"paymentToken\": \"...\"," +
    "\"processUrl\": \"...\"," +
    "\"transactionId\": \"...\"," +
    "\"unapprovedTBillInfo\": {" +
      "\"company\": \"...\"," +
      "\"createdByCompany\": 12345," +
      "\"createdByUser\": 12345," +
      "\"createdOn\": 12345," +
      "\"lastModified\": 12345," +
      "\"nnsa\": \"...\"," +
      "\"rejected\": true," +
      "\"repFirstName\": \"...\"," +
      "\"repLastName\": \"...\"," +
      "\"repPONumber\": \"...\"," +
      "\"tan\": \"...\"" +
    "}" +
  "}," +
  "\"paymentMethod\": \"MANO_TEO_BILL\"," +
  "\"user\": {" +
    "\"href\": \"...\"," +
    "\"id\": \"...\"" +
  "}," +
  "\"vatId\": \"...\"" +
"}";

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

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

Example response

{
  "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/7ee20d50-8147-482e-839c-775c02e73c45",
    "id": "7ee20d50-8147-482e-839c-775c02e73c45"
  },
  "createdOn": 1481002402567,
  "creditCard": {
    "expirationMonth": 12,
    "expirationYear": 2016,
    "name": "John Doe",
    "number": "12655615611",
    "securityCode": "111",
    "type": "VISA"
  },
  "default": false,
  "id": "e3f7f37b-1e0b-4f05-a8b2-aae74e2f5f2d",
  "parameters": {
    "creditsAccountId": 41111111111111110,
    "externalId": "a1a5-a1da6sa2-asf6fa5-1asfs6-6a5sf16asf",
    "invoicingEmail": "invoicing@gmail.com",
    "issuer": "VISA",
    "maskedPan": "thisIsaMaskedPan",
    "paymentMethod": "CREDIT_CARD",
    "paymentToken": "28c21248-bae0-492c-ab32-8f2dda5fb87d",
    "processUrl": "http://processUrl.com"
  },
  "paymentMethod": "CREDIT_CARD",
  "user": {
    "href": "http://appdirect/api/account/v1/users/952105f7-ad15-4fa3-bdbf-f25736a0dc48",
    "id": "952105f7-ad15-4fa3-bdbf-f25736a0dc48"
  }
}

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

Create a payment instrument for the given user and company using the provided data

Parameters

Parameter Type Data Type Default Description
*companyId path string User's company UUID
*userId path string User UUID

Body Parameters

Payment instrument data object

PaymentInstrument object:

Property Type Description
accountDisplay string Account display text.
billingAddress BillingAddress Billing address.
company LinkWS Link to company information.
createdOn number Payment instrument creation date.
creditCard CreditCard Credit card information.
id string ID
isDefault boolean True if this payment instrument is the default.
parameters CustomParameters Custom parameters for this payment instrument.
paymentMethod PaymentMethod Payment method. Most often CREDIT_CARD, PAYPAL, or MANUAL. Other options are supported.
user LinkWS Link to user information.
vatId string VAT ID.

Responses

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

Create a subscription

Example request


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

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

{
  "assignedUsers": 12345,
  "company": {
    "href": "...",
    "id": "..."
  },
  "creationDate": 12345,
  "edition": {
    "href": "...",
    "id": "..."
  },
  "endDate": 12345,
  "externalAccountId": "...",
  "id": "...",
  "internalId": "...",
  "maxUsers": 12345,
  "order": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {},
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "product": {
    "href": "...",
    "id": "..."
  },
  "redirectUrl": "...",
  "status": "...",
  "upcomingOrder": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {},
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "user": {
    "href": "...",
    "id": "..."
  }
}


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

};

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

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

};

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

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

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

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

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

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

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

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

Example response

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

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

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

Parameters

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

Body Parameters

Subscription data object

Subscription object:

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

Responses

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

Preview create a subscription

Example request


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

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

{
  "assignedUsers": 12345,
  "company": {
    "href": "...",
    "id": "..."
  },
  "creationDate": 12345,
  "edition": {
    "href": "...",
    "id": "..."
  },
  "endDate": 12345,
  "externalAccountId": "...",
  "id": "...",
  "internalId": "...",
  "maxUsers": 12345,
  "order": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {},
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "product": {
    "href": "...",
    "id": "..."
  },
  "redirectUrl": "...",
  "status": "...",
  "upcomingOrder": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {},
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "user": {
    "href": "...",
    "id": "..."
  }
}


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

};

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

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

};

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

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

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

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

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

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

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

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

Example response

{
  "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 UUID
*userId path string User UUID

Body Parameters

Subscription data object

Subscription object:

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

Responses

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

Update a payment instrument

Example request


curl -X put \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data-binary @- https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/paymentInstruments/{paymentInstrumentId} <<EOF
{
  "accountDisplay": "...",
  "billingAddress": {
    "city": "...",
    "companyName": "...",
    "country": "...",
    "fax": "...",
    "faxExtension": "...",
    "firstName": "...",
    "lastName": "...",
    "phone": "...",
    "phoneExtension": "...",
    "poBox": "...",
    "salutation": "...",
    "state": "...",
    "street1": "...",
    "street2": "...",
    "zip": "..."
  },
  "company": {
    "href": "...",
    "id": "..."
  },
  "createdOn": 12345,
  "creditCard": {
    "expirationMonth": 12345,
    "expirationYear": 12345,
    "name": "...",
    "number": "...",
    "securityCode": "...",
    "type": "AMEX"
  },
  "id": "...",
  "isDefault": true,
  "parameters": {
    "approvedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    },
    "billingId": "...",
    "creditsAccountId": 12345,
    "externalId": "...",
    "gatewayKey": "...",
    "invoicingEmail": "...",
    "issuer": "...",
    "manoTEOBillingId": "...",
    "maskedPan": "...",
    "paymentMethod": "...",
    "paymentToken": "...",
    "processUrl": "...",
    "transactionId": "...",
    "unapprovedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    }
  },
  "paymentMethod": "MANO_TEO_BILL",
  "user": {
    "href": "...",
    "id": "..."
  },
  "vatId": "..."
}
EOF

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

{
  "accountDisplay": "...",
  "billingAddress": {
    "city": "...",
    "companyName": "...",
    "country": "...",
    "fax": "...",
    "faxExtension": "...",
    "firstName": "...",
    "lastName": "...",
    "phone": "...",
    "phoneExtension": "...",
    "poBox": "...",
    "salutation": "...",
    "state": "...",
    "street1": "...",
    "street2": "...",
    "zip": "..."
  },
  "company": {
    "href": "...",
    "id": "..."
  },
  "createdOn": 12345,
  "creditCard": {
    "expirationMonth": 12345,
    "expirationYear": 12345,
    "name": "...",
    "number": "...",
    "securityCode": "...",
    "type": "AMEX"
  },
  "id": "...",
  "isDefault": true,
  "parameters": {
    "approvedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    },
    "billingId": "...",
    "creditsAccountId": 12345,
    "externalId": "...",
    "gatewayKey": "...",
    "invoicingEmail": "...",
    "issuer": "...",
    "manoTEOBillingId": "...",
    "maskedPan": "...",
    "paymentMethod": "...",
    "paymentToken": "...",
    "processUrl": "...",
    "transactionId": "...",
    "unapprovedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    }
  },
  "paymentMethod": "MANO_TEO_BILL",
  "user": {
    "href": "...",
    "id": "..."
  },
  "vatId": "..."
}


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

};

$.ajax({
  url: 'https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/paymentInstruments/{paymentInstrumentId}',
  method: 'put',
  dataType: 'json',
  data: {
  "accountDisplay": "...",
  "billingAddress": {
    "city": "...",
    "companyName": "...",
    "country": "...",
    "fax": "...",
    "faxExtension": "...",
    "firstName": "...",
    "lastName": "...",
    "phone": "...",
    "phoneExtension": "...",
    "poBox": "...",
    "salutation": "...",
    "state": "...",
    "street1": "...",
    "street2": "...",
    "zip": "..."
  },
  "company": {
    "href": "...",
    "id": "..."
  },
  "createdOn": 12345,
  "creditCard": {
    "expirationMonth": 12345,
    "expirationYear": 12345,
    "name": "...",
    "number": "...",
    "securityCode": "...",
    "type": "AMEX"
  },
  "id": "...",
  "isDefault": true,
  "parameters": {
    "approvedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    },
    "billingId": "...",
    "creditsAccountId": 12345,
    "externalId": "...",
    "gatewayKey": "...",
    "invoicingEmail": "...",
    "issuer": "...",
    "manoTEOBillingId": "...",
    "maskedPan": "...",
    "paymentMethod": "...",
    "paymentToken": "...",
    "processUrl": "...",
    "transactionId": "...",
    "unapprovedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    }
  },
  "paymentMethod": "MANO_TEO_BILL",
  "user": {
    "href": "...",
    "id": "..."
  },
  "vatId": "..."
},

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');
const inputBody = '{
  "accountDisplay": "...",
  "billingAddress": {
    "city": "...",
    "companyName": "...",
    "country": "...",
    "fax": "...",
    "faxExtension": "...",
    "firstName": "...",
    "lastName": "...",
    "phone": "...",
    "phoneExtension": "...",
    "poBox": "...",
    "salutation": "...",
    "state": "...",
    "street1": "...",
    "street2": "...",
    "zip": "..."
  },
  "company": {
    "href": "...",
    "id": "..."
  },
  "createdOn": 12345,
  "creditCard": {
    "expirationMonth": 12345,
    "expirationYear": 12345,
    "name": "...",
    "number": "...",
    "securityCode": "...",
    "type": "AMEX"
  },
  "id": "...",
  "isDefault": true,
  "parameters": {
    "approvedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    },
    "billingId": "...",
    "creditsAccountId": 12345,
    "externalId": "...",
    "gatewayKey": "...",
    "invoicingEmail": "...",
    "issuer": "...",
    "manoTEOBillingId": "...",
    "maskedPan": "...",
    "paymentMethod": "...",
    "paymentToken": "...",
    "processUrl": "...",
    "transactionId": "...",
    "unapprovedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    }
  },
  "paymentMethod": "MANO_TEO_BILL",
  "user": {
    "href": "...",
    "id": "..."
  },
  "vatId": "..."
}';
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json'

};

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

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

result = RestClient.put 'https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/paymentInstruments/{paymentInstrumentId}',
payload={
  "accountDisplay": "...",
  "billingAddress": {
    "city": "...",
    "companyName": "...",
    "country": "...",
    "fax": "...",
    "faxExtension": "...",
    "firstName": "...",
    "lastName": "...",
    "phone": "...",
    "phoneExtension": "...",
    "poBox": "...",
    "salutation": "...",
    "state": "...",
    "street1": "...",
    "street2": "...",
    "zip": "..."
  },
  "company": {
    "href": "...",
    "id": "..."
  },
  "createdOn": 12345,
  "creditCard": {
    "expirationMonth": 12345,
    "expirationYear": 12345,
    "name": "...",
    "number": "...",
    "securityCode": "...",
    "type": "AMEX"
  },
  "id": "...",
  "isDefault": true,
  "parameters": {
    "approvedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    },
    "billingId": "...",
    "creditsAccountId": 12345,
    "externalId": "...",
    "gatewayKey": "...",
    "invoicingEmail": "...",
    "issuer": "...",
    "manoTEOBillingId": "...",
    "maskedPan": "...",
    "paymentMethod": "...",
    "paymentToken": "...",
    "processUrl": "...",
    "transactionId": "...",
    "unapprovedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    }
  },
  "paymentMethod": "MANO_TEO_BILL",
  "user": {
    "href": "...",
    "id": "..."
  },
  "vatId": "..."
}
params: {
},
headers: headers

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

r = requests.put('https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/paymentInstruments/{paymentInstrumentId}',
json={
  "accountDisplay": "...",
  "billingAddress": {
    "city": "...",
    "companyName": "...",
    "country": "...",
    "fax": "...",
    "faxExtension": "...",
    "firstName": "...",
    "lastName": "...",
    "phone": "...",
    "phoneExtension": "...",
    "poBox": "...",
    "salutation": "...",
    "state": "...",
    "street1": "...",
    "street2": "...",
    "zip": "..."
  },
  "company": {
    "href": "...",
    "id": "..."
  },
  "createdOn": 12345,
  "creditCard": {
    "expirationMonth": 12345,
    "expirationYear": 12345,
    "name": "...",
    "number": "...",
    "securityCode": "...",
    "type": "AMEX"
  },
  "id": "...",
  "isDefault": true,
  "parameters": {
    "approvedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    },
    "billingId": "...",
    "creditsAccountId": 12345,
    "externalId": "...",
    "gatewayKey": "...",
    "invoicingEmail": "...",
    "issuer": "...",
    "manoTEOBillingId": "...",
    "maskedPan": "...",
    "paymentMethod": "...",
    "paymentToken": "...",
    "processUrl": "...",
    "transactionId": "...",
    "unapprovedTBillInfo": {
      "company": "...",
      "createdByCompany": 12345,
      "createdByUser": 12345,
      "createdOn": 12345,
      "lastModified": 12345,
      "nnsa": "...",
      "rejected": true,
      "repFirstName": "...",
      "repLastName": "...",
      "repPONumber": "...",
      "tan": "..."
    }
  },
  "paymentMethod": "MANO_TEO_BILL",
  "user": {
    "href": "...",
    "id": "..."
  },
  "vatId": "..."
}
params={
},
headers = headers)

print r.json()
URL obj = new URL("https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/paymentInstruments/{paymentInstrumentId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
String inputBody = "{" +
  "\"accountDisplay\": \"...\"," +
  "\"billingAddress\": {" +
    "\"city\": \"...\"," +
    "\"companyName\": \"...\"," +
    "\"country\": \"...\"," +
    "\"fax\": \"...\"," +
    "\"faxExtension\": \"...\"," +
    "\"firstName\": \"...\"," +
    "\"lastName\": \"...\"," +
    "\"phone\": \"...\"," +
    "\"phoneExtension\": \"...\"," +
    "\"poBox\": \"...\"," +
    "\"salutation\": \"...\"," +
    "\"state\": \"...\"," +
    "\"street1\": \"...\"," +
    "\"street2\": \"...\"," +
    "\"zip\": \"...\"" +
  "}," +
  "\"company\": {" +
    "\"href\": \"...\"," +
    "\"id\": \"...\"" +
  "}," +
  "\"createdOn\": 12345," +
  "\"creditCard\": {" +
    "\"expirationMonth\": 12345," +
    "\"expirationYear\": 12345," +
    "\"name\": \"...\"," +
    "\"number\": \"...\"," +
    "\"securityCode\": \"...\"," +
    "\"type\": \"AMEX\"" +
  "}," +
  "\"id\": \"...\"," +
  "\"isDefault\": true," +
  "\"parameters\": {" +
    "\"approvedTBillInfo\": {" +
      "\"company\": \"...\"," +
      "\"createdByCompany\": 12345," +
      "\"createdByUser\": 12345," +
      "\"createdOn\": 12345," +
      "\"lastModified\": 12345," +
      "\"nnsa\": \"...\"," +
      "\"rejected\": true," +
      "\"repFirstName\": \"...\"," +
      "\"repLastName\": \"...\"," +
      "\"repPONumber\": \"...\"," +
      "\"tan\": \"...\"" +
    "}," +
    "\"billingId\": \"...\"," +
    "\"creditsAccountId\": 12345," +
    "\"externalId\": \"...\"," +
    "\"gatewayKey\": \"...\"," +
    "\"invoicingEmail\": \"...\"," +
    "\"issuer\": \"...\"," +
    "\"manoTEOBillingId\": \"...\"," +
    "\"maskedPan\": \"...\"," +
    "\"paymentMethod\": \"...\"," +
    "\"paymentToken\": \"...\"," +
    "\"processUrl\": \"...\"," +
    "\"transactionId\": \"...\"," +
    "\"unapprovedTBillInfo\": {" +
      "\"company\": \"...\"," +
      "\"createdByCompany\": 12345," +
      "\"createdByUser\": 12345," +
      "\"createdOn\": 12345," +
      "\"lastModified\": 12345," +
      "\"nnsa\": \"...\"," +
      "\"rejected\": true," +
      "\"repFirstName\": \"...\"," +
      "\"repLastName\": \"...\"," +
      "\"repPONumber\": \"...\"," +
      "\"tan\": \"...\"" +
    "}" +
  "}," +
  "\"paymentMethod\": \"MANO_TEO_BILL\"," +
  "\"user\": {" +
    "\"href\": \"...\"," +
    "\"id\": \"...\"" +
  "}," +
  "\"vatId\": \"...\"" +
"}";

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

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

Example response

{
  "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/7ee20d50-8147-482e-839c-775c02e73c45",
    "id": "7ee20d50-8147-482e-839c-775c02e73c45"
  },
  "creditCard": {
    "expirationMonth": 12,
    "expirationYear": 2016,
    "name": "Updated Credit Card name",
    "number": "13688112366",
    "securityCode": "111",
    "type": "VISA"
  },
  "default": false,
  "id": "e3f7f37b-1e0b-4f05-a8b2-aae74e2f5f2d",
  "parameters": {
    "creditsAccountId": 41111111111111110,
    "externalId": "a1a5-a1da6sa2-asf6fa5-1asfs6-6a5sf16asf",
    "invoicingEmail": "invoicing@gmail.com",
    "issuer": "VISA",
    "maskedPan": "thisIsaMaskedPan",
    "paymentMethod": "CREDIT_CARD",
    "paymentToken": "28c21248-bae0-492c-ab32-8f2dda5fb87d",
    "processUrl": "http://processUrl.com"
  },
  "paymentMethod": "CREDIT_CARD",
  "user": {
    "href": "http://appdirect/api/account/v1/users/952105f7-ad15-4fa3-bdbf-f25736a0dc48",
    "id": "952105f7-ad15-4fa3-bdbf-f25736a0dc48"
  }
}

PUT /billing/v1/companies/{companyId}/users/{userId}/paymentInstruments/{paymentInstrumentId}

Update the payment instrument for the given user and company using the provided data

Parameters

Parameter Type Data Type Default Description
*companyId path string User's company UUID
*paymentInstrumentId path string Existing payment instrument UUID
*userId path string User UUID

Body Parameters

Payment instrument data object

PaymentInstrument object:

Property Type Description
accountDisplay string Account display text.
billingAddress BillingAddress Billing address.
company LinkWS Link to company information.
createdOn number Payment instrument creation date.
creditCard CreditCard Credit card information.
id string ID
isDefault boolean True if this payment instrument is the default.
parameters CustomParameters Custom parameters for this payment instrument.
paymentMethod PaymentMethod Payment method. Most often CREDIT_CARD, PAYPAL, or MANUAL. Other options are supported.
user LinkWS Link to user information.
vatId string VAT ID.

Responses

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

Update a subscription

Example request


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

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

{
  "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": {},
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "product": {
    "href": "...",
    "id": "..."
  },
  "redirectUrl": "...",
  "status": "...",
  "upcomingOrder": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {},
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "user": {
    "href": "...",
    "id": "..."
  }
}


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

};

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

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

};

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

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

result = RestClient.put 'https://{marketplaceURL}/api/billing/v1/companies/{companyId}/users/{userId}/subscriptions/{subscriptionId}',
payload={
  "assignedUsers": 12345,
  "company": {
    "href": "...",
    "id": "..."
  },
  "creationDate": 12345,
  "edition": {
    "href": "...",
    "id": "..."
  },
  "endDate": 12345,
  "externalAccountId": "...",
  "id": "...",
  "internalId": "...",
  "maxUsers": 12345,
  "order": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {},
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "product": {
    "href": "...",
    "id": "..."
  },
  "redirectUrl": "...",
  "status": "...",
  "upcomingOrder": {
    "_embedded": {
      "property1": {},
      "property2": {}
    },
    "activated": true,
    "company": {
      "href": "...",
      "id": "..."
    },
    "contract": {},
    "currency": "...",
    "customAttribute": [
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      },
      {
        "attributeType": "TEXT",
        "name": "...",
        "value": "...",
        "valueKeys": [
          "...",
          "..."
        ]
      }
    ],
    "discount": {
      "href": "...",
      "id": "..."
    },
    "discountId": 12345,
    "endDate": 12345,
    "endOfDiscountDate": 12345,
    "frequency": "...",
    "id": 12345,
    "links": [
      {
        "href": "...",
        "rel": "..."
      },
      {
        "href": "...",
        "rel": "..."
      }
    ],
    "nextBillingDate": 12345,
    "nextOrder": {
      "href": "...",
      "id": "..."
    },
    "oneTimeOrder": [
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      },
      {
        "_embedded": {
          "property1": {},
          "property2": {}
        },
        "company": {},
        "currency": "...",
        "endDate": 12345,
        "endOfDiscountDate": 12345,
        "frequency": "...",
        "id": 12345,
        "links": [
          {},
          {}
        ],
        "nextBillingDate": 12345,
        "paymentPlan": {},
        "referenceCode": "...",
        "salesSupportUser": {},
        "startDate": 12345,
        "status": "...",
        "totalPrice": 12345,
        "type": "...",
        "user": {}
      }
    ],
    "orderLine": [
      {},
      {}
    ],
    "parameter": [
      {
        "name": "...",
        "value": "..."
      },
      {
        "name": "...",
        "value": "..."
      }
    ],
    "paymentPlan": {
      "allowCustomUsage": true,
      "contract": {},
      "cost": [
        {},
        {}
      ],
      "discount": {},
      "frequency": "...",
      "href": "...",
      "id": 12345,
      "isPrimaryPrice": true,
      "keepBillDateOnUsageChange": true,
      "primaryPrice": true,
      "separatePrepaid": true,
      "tld": "...",
      "uuid": "..."
    },
    "paymentPlanId": 12345,
    "previousOrder": {
      "href": "...",
      "id": "..."
    },
    "referenceCode": "...",
    "salesSupportUser": {
      "href": "...",
      "id": "..."
    },
    "startDate": 12345,
    "status": "...",
    "totalPrice": 12345,
    "type": "...",
    "user": {
      "href": "...",
      "id": "..."
    }
  },
  "user": {
    "href": "...",
    "id": "..."
  }
}
params: {
},
headers: headers

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

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

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