Share via


Handling Billing Approval Requests

 

Applies To: Windows Azure Pack

When a Windows Azure Pack tenant creates or deletes a subscription or subscription add-on, it may be necessary to approve or deny the request depending on the hoster’s billing business practices. Windows Azure Pack defines REST interfaces for approving subscription and subscription add-on creation and deletion. These are implemented by a billing adapter and once registered are called whenever a tenant creates or deletes a subscription or subscription add-on. The HTTP Response code indicates whether the requested operation is approved or not. A number higher or equal to 400 is denied; A number lower than 400 is accepted. The content of the response body is ignored.

Billing Approval REST API Endpoint

The following are the Billing Approval REST API that a billing adapter needs to implement:

If registered as either Mandatory or Billing, the REST calls are blocking and will be sent as request notifications in real-time to any registrants of the NotificationSubscribers setting in the Usage Service. The notification event state will be pending approval. Depending upon the response(s) of any blocking subscribers, the operation will be approved or rejected. If no blocking subscribers are registered, the event will be auto-approved and will be set to the acknowledged state and exposed via the Usage Service REST API. For more information about Mandatory and Billing subscription types, Configuring the Windows Azure Pack Usage Service.

The actual signal to commit these operations to the Billing System will be events exposed in the REST API, whether registered as a notification subscriber or not; no action should be taken upon the requests sent via this API, as they are only requests.

Important

The Windows Azure Pack RTM release exposes subscription update events on the real-time Billing Approval API and any registrants of that service will need to approve those events automatically.

For more information about registering the Billing Approval REST API endpoint, see Configuring the Windows Azure Pack Usage Service.

Authenticating an Approval Request

The Billing Approval REST API should require at least Basic Authentication.

Processing an Approval Request

The following is an example of a create subscription request sent to a billing adapter. The HTTP response code the billing adapter sends should be 204 to represent approval or 403 to represent denial of the request.

POST /usage/subscriptions HTTP/1.1
Content-Type: application/json; charset=utf-8
Host: 10.121.217.127:8888
Content-Length: 564
Expect: 100-continue
{
  "EventId": 6530,
  "State": 2,
  "Method": "POST",
  "Entity": {
    "SubscriptionID": "0a53e53d-1334-424e-8c63-ade05c361be2",
    "SubscriptionName": "ExamplePlan",
    "AccountAdminLiveEmailId": "user@example.com",
    "ServiceAdminLiveEmailId": null,
    "CoAdminNames": [

    ],
    "AddOnReferences": [

    ],
    "AddOns": [

    ],
    "State": 0,
    "QuotaSyncState": 0,
    "ActivationSyncState": 0,
    "PlanId": "Examphlztfpgi",
    "Services": [

    ],
    "LastErrorMessage": null,
    "Features": null,
    "OfferFriendlyName": null,
    "OfferCategory": null,
    "Created": "0001-01-01T00:00:00Z"
  },
  "EntityParentId": null,
  "NotificationEventTimeCreated": "2013-09-25T00:32:08.8724845Z"
}

If the billing adapter receives an event and returns an error message, the event will not be completed successfully in the Service Management API. If this is not the expected behavior, the Billing Adapter must send back a status code of 200 for each event notification and should log any failures for later processing. Any unknown events that are received should result in a 200 status code being returned.

See Also

Configuring the Windows Azure Pack Usage Service
Implementing a Billing Adapter