xero-php-oauth2 AppStore SDK Docs

# Xero AppStore API

## SDK Documentation

# AppStore

# getSubscription

Retrieves a subscription for a given subscriptionId

    /subscriptions/{subscriptionId}

### Usage and SDK Samples

    <?php
    require_once(__DIR__ . '/vendor/autoload.php');

    // Configure OAuth2 access token for authorization: OAuth2
    $config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );

    $apiInstance = new XeroAPI\XeroPHP\Api\AppStoreApi(
        new GuzzleHttp\Client(),
        $config
    );
    $subscriptionId = ""00000000-0000-0000-0000-000000000000"";

    try {
      $result = $apiInstance->getSubscription($subscriptionId);
    } catch (Exception $e) {
      echo 'Exception when calling AppStoreApi->getSubscription: ', $e->getMessage(), PHP_EOL;
    }
    ?>

## Scopes

marketplace.billing | Grant read-only access to fixed assets

## Parameters

Path parameters

Name | Description
--- | ---
subscriptionId* | UUID (uuid) Unique identifier for Subscription object Required

# getUsageRecords

Gets all usage records related to the subscription

    /subscriptions/{subscriptionId}/usage-records

### Usage and SDK Samples

    <?php
    require_once(__DIR__ . '/vendor/autoload.php');

    // Configure OAuth2 access token for authorization: OAuth2
    $config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );

    $apiInstance = new XeroAPI\XeroPHP\Api\AppStoreApi(
        new GuzzleHttp\Client(),
        $config
    );
    $subscriptionId = ""00000000-0000-0000-0000-000000000000"";

    try {
      $result = $apiInstance->getUsageRecords($subscriptionId);
    } catch (Exception $e) {
      echo 'Exception when calling AppStoreApi->getUsageRecords: ', $e->getMessage(), PHP_EOL;
    }
    ?>

## Scopes

marketplace.billing | Grant read-only access to fixed assets

## Parameters

Path parameters

Name | Description
--- | ---
subscriptionId* | UUID (uuid) Unique identifier for Subscription object Required

# postUsageRecords

Send metered usage belonging to this subscription and subscription item

    /subscriptions/{subscriptionId}/items/{subscriptionItemId}/usage-records

### Usage and SDK Samples

    <?php
    require_once(__DIR__ . '/vendor/autoload.php');

    // Configure OAuth2 access token for authorization: OAuth2
    $config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );

    $apiInstance = new XeroAPI\XeroPHP\Api\AppStoreApi(
        new GuzzleHttp\Client(),
        $config
    );
    $subscriptionId = ""00000000-0000-0000-0000-000000000000"";
    $subscriptionItemId = ""00000000-0000-0000-0000-000000000000"";
    $idempotencyKey = "KEY_VALUE";

    try {
      $result = $apiInstance->postUsageRecords($subscriptionId, $subscriptionItemId, $createUsageRecord, $idempotencyKey);
    } catch (Exception $e) {
      echo 'Exception when calling AppStoreApi->postUsageRecords: ', $e->getMessage(), PHP_EOL;
    }
    ?>

## Scopes

marketplace.billing | Grant read-only access to fixed assets

## Parameters

Path parameters

Name | Description
--- | ---
subscriptionId* | UUID (uuid) Unique identifier for Subscription object Required
subscriptionItemId* | UUID (uuid) The unique identifier of the subscriptionItem Required

Header parameters

Name | Description
--- | ---
Idempotency-Key | String This allows you to safely retry requests without the risk of duplicate processing. 128 character max.

Body parameters

Name | Description
--- | ---
createUsageRecord * | CreateUsageRecord Contains the quantity for the usage record to create Required

# putUsageRecords

Update and existing metered usage belonging to this subscription and subscription item

    /subscriptions/{subscriptionId}/items/{subscriptionItemId}/usage-records/{usageRecordId}

### Usage and SDK Samples

    <?php
    require_once(__DIR__ . '/vendor/autoload.php');

    // Configure OAuth2 access token for authorization: OAuth2
    $config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );

    $apiInstance = new XeroAPI\XeroPHP\Api\AppStoreApi(
        new GuzzleHttp\Client(),
        $config
    );
    $subscriptionId = ""00000000-0000-0000-0000-000000000000"";
    $subscriptionItemId = ""00000000-0000-0000-0000-000000000000"";
    $usageRecordId = ""00000000-0000-0000-0000-000000000000"";
    $idempotencyKey = "KEY_VALUE";

    try {
      $result = $apiInstance->putUsageRecords($subscriptionId, $subscriptionItemId, $usageRecordId, $updateUsageRecord, $idempotencyKey);
    } catch (Exception $e) {
      echo 'Exception when calling AppStoreApi->putUsageRecords: ', $e->getMessage(), PHP_EOL;
    }
    ?>

## Scopes

marketplace.billing | Grant read-only access to fixed assets

## Parameters

Path parameters

Name | Description
--- | ---
subscriptionId* | UUID (uuid) Unique identifier for Subscription object Required
subscriptionItemId* | UUID (uuid) The unique identifier of the subscriptionItem Required
usageRecordId* | UUID (uuid) The unique identifier of the usage record Required

Header parameters

Name | Description
--- | ---
Idempotency-Key | String This allows you to safely retry requests without the risk of duplicate processing. 128 character max.

Body parameters

Name | Description
--- | ---
updateUsageRecord * | UpdateUsageRecord Contains the quantity for the usage record to update Required