Welcome to Zuora Product Documentation

Explore our rich library of product information

Use custom endpoints

Learn how to request and utilize custom endpoints within the Subscriber Portal using JavaScript.

Custom endpoints can be requested using JavaScript from any custom panel or custom page in the Subscriber Portal.

custom endpoints flow

When calling a custom endpoint from the Subscriber Portal, the following processes take place:

  1. A caller, for example, a custom webpage, makes a call to the backend system of the Subscriber Portal (Subscriber Portal API Layer).
  2. The portal back-end calls the endpoint of downstream systems such as Zuora, a shipping system, or a validation system. The results are then returned to the Subscriber Portal back-end system.
  3. The response is returned to the caller and the results are displayed in the front-end UI.

For example, a custom panel makes a request to retrieve a list of subscriptions, the Portal calls Zuora to retrieve this information and then returns a list of subscriptions to be displayed on the custom page. The sample call is:

$.ajax({
    url: "api/v1/endpoints/getSubs",  //call the custom endpoint named getSubs
    Type:'post',   //always post the request to custom portal endpoint and the custom endpoint is setup to perform a get/post downstream
    headers: { 
        'access-token': window.localStorage.getItem('accessToken'),
        'client': window.localStorage.getItem('client'),
        'tokenType': window.localStorage.getItem('tokenType'),
        'uid': window.localStorage.getItem('uid'),
        'expiry': window.localStorage.getItem('expiry')
    }
}).then(function(data) {
    //perform desired action with result
}