By continuing to use our website, you consent to the use of cookies. Please refer our cookie policy for more details.

    Getting Started With Zuora SDK – The Right Way

    Zuora is the ultimate choice when it comes to subscription-based businesses.

    And to ease your efforts when using Zuora Billing services, Zuora Software Development Kit (Zuora SDK) is the key. Zuora SDK comes with a language idiomatic programming interface that cuts down on the implementation effort.

    Being a user-friendly object model, the edge that you get with Zuora SDK is that you can keep the flexibility of the platform intact and streamline any integration with Zuora.

    Zuora SDK for Java: What You Need to Know

    The Zuora SDK for Java comprises a set of libraries that can be accessed by Java developers as and when required. The available set of libraries enables you to use Zuora Billing services with utmost ease and comfort. The Zuora SDK for Java is built on an easy-to-use lightweight object model for you to understand each concept faster. With the Zuora SDK, you can make the process of building your applications a breeze.

    Here are some recommended objects and methods available in Zuora’s SDK for Java:

    • Product, Plan, and Price
    • Account and Contact
    • Subscription
    • Billing Document
    • Payment Method, Payment, and Refund

    Steps to Install Zuora SDK

    You can find the Zuora SDK in the Maven Central repository. All you have to do is add the following code to the dependencies in the pom.xml file of your project. After this step, Zuora SDK becomes available to you:



    Authentication of Zuora SDK

    In order to authenticate Zuora SDK, you need to follow the below-mentioned parameters:

    • Client ID
    • Client Secret
    • Endpoint (Base URL)

    After this, perform the following steps to complete the authentication process:

    1. Determine the Base URL for REST Endpoint:
    2. Different Zuora environments have different base URLs. These environment-based variables can be used to manage base URLs. The credentials that you have for various Zuora environments can also be managed easily with the help of these base URLs. Remember, when working with the SDK, you must choose the endpoint base URL that you want to use.

      Tenant Base URL for REST endpoint
      US Production
      US API Sandbox
      US Central Sandbox
      US Performance Test
      US Cloud Production
      US Cloud API Sandbox
      EU Production
      EU Sandbox
      EU Central Sandbox
    3. Create Client ID and Client Secret in Zuora Tenant:
    4. To generate Client ID and Client Secret in your Zuora tenant, you can:

      a. Create a dedicated user for conducting API calls
      b. Create an OAuth client for the user

    5. Incorporate Authentication Parameters in Your Code:
    6. Add the following snippet to your code to authenticate:

      • String CLIENT_ID = "{CLIENT_ID}";
      • String ENDPOINT = "{ENDPOINT_BASE}";
      • ZuoraClient zuoraClient = new ZuoraClient(CLIENT_ID, CLIENT_SECRET, ENDPOINT);


      Make sure that you include these authentication parameters in your code to finish the process smoothly, without any friction.

      Working With Zuora SDK

      This section gives insights into the key objects and code samples used in Zuora SDK for some common use cases.

      – Create a Product and Plan
      – Create a Subscription for an Account
      – Edit Contact Information for an Account
      – Retrieve Customer’s Subscriptions
      – Create Payment Pages

    1. Retrieve Payment Methods for an Account
    2. To redirect all the payment methods that are associated with a user’s account, you can apply the zuoraClient.accounts().getPaymentMethods() code. Here’s an example of how SDK retrieves all payment methods for an account.

      Account account = zuoraClient.accounts().get(“A-000001”);
      List<PaymentMethod> paymentMethods = account.getPaymentMethods();


    3. Retrieve Invoices for an Account
    4. Subscribers get the option to view the invoices associated with their accounts, by using the zuoraClient.accounts().getInvoices() code. This retrieves all invoices associated with a customer’s account.

      Account account = zuoraClient.accounts().get(“A-000001”);
      List<BillingDocument> invoices = account.getInvoices();


    5. Retrieve Credit Memos for an Account
    6. In order to enable subscribers to get a hawk-eye view of the credit memos linked with their account, you can use the zuoraClient.billingDocuments().findByAccount() code. This way, you will be able to retrieve all credit memos associated with a customer’s account.

      Account account = zuoraClient.accounts().get(“A-000001”);
      List<BillingDocument> creditMemos = zuoraClient.billingDocuments()


    7. Retrieve a Credit Memo
    8. To extract a credit memo, you can apply the code: zuoraClient.BillingDocuments.get() to (number = “CM00000012”).

      Account account = zuoraClient.accounts().get(“A-000001”);
      List<Payment> payments = account.getPayments();


    9. Add a Product to a Subscription
    10. If subscribers decide to add a product to their subscription, you need to pick a plan for the product.

      ProductCreateRequest productCreateRequest = ProductCreateRequest.builder().name("Gold").build();
      Product product = zuoraClient.products().create(productCreateRequest);
      Plan plan = zuoraClient.products().getPlan(“Gold Membership Plan”);
      plan.getItems().stream().filter(item -> item.getName() == "Gold Monthly Price"). item.setUnitAmounts(Collections.singletonMap(Currency.getInstance("USD"), 200.0));
      Subscription subscription = zuoraClient.subscriptions().get(“S00007412”);
      Subscription subscription = zuoraClient.subscriptions().addPlan(subscription, plan,;


    11. Remove a Product from a Subscription
    12. In the event where an end subscriber wishes to delete or omit a product from a subscription, they can do it and delete a subscription from the plan using the below-mentioned code:

      Subscription subscription = zuoraClient.subscriptions().get(“S00007412”);
      List<SubscriptionPlan> subscriptionPlans = zuoraClient.subscriptions()
      Subscription subscription = zuoraClient.subscriptions()
      .removeSubscriptionPlan(subscription, subscriptionPlans.get(0));


    13. Renew a Subscription
    14. As the expiration date of a subscription approaches, you can request a renewal at the end as its current expiration by applying this code:

      Subscription subscription = zuoraClient.subscriptions()
      subscription = zuoraClient.subscriptions().renew(subscription.getId());


    15. Cancel a Subscription
    16. In this use case, if a subscriber wants to cancel their subscription, they can use this code:

      Subscription subscription = zuoraClient.subscriptions()
      Subscription subscription = zuoraClient.subscriptions().cancel(subscription);


    17. Update Product Quantity on a Subscription
    18. You can update the subscription product quantity or quality. But a customer can do this only when the product’s price is not an average price, flat fee, or a discount.

      Subscription subscription = zuoraClient.subscriptions().get(“S00007412”);
      SubscriptionItem subscriptionItem = subscriptions.getSubscriptionPlans().get(0).getItems().get(0);
      SubscriptionItemRequest subscriptionItemRequest = subscriptionItem.toBuilder().setQuantity(60.0).build();
      Subscription subscription = zuoraClient.subscriptions().updateSubscriptionItem(subscription, subscriptionItemRequest,;


    Wrapping Up

    Zuora enables you to plug your platform into your tech stack with ease. With SDKs in your corner, you can eliminate friction, developers can spend less time configuring and more time executing. In this article, we looked at how to integrate with Zuora’s SDK so that you can make developing with Zuora a breeze.

    Need assistance leveraging Zuora SDK the right way? Feel free to drop us a line at [email protected] and we’ll take it from there.