SAP Subscription Billing is a cloud solution for the management and billing of subscriptions. Subscriptions are created mainly via the user interface or via integrations, which can be enabled by predefined packages from SAP or by building custom integrations with the SAP Subscription Billing APIs and Business Events.
If you have a custom integration, this blog post will provide you with a handy trick that will help you preventing duplicate subscriptions from being created by your frontend system. When could this happen? For example, if the same data is sent twice due to a temporary interruption in the network connection.
Example Use Case
Via their online shop, a provider of coffee solutions for businesses and private consumers offers subscription-based deliveries. When a customer signs up for a new subscription, the data required to start billing the subscription is sent from the online shop to SAP Subscription Billing via a custom integration built with the Subscriptions API.
To create subscriptions as triggered by an integrated system, you need the API operation POST on /subscriptions. In the request, apart from the usual data required for the creation (customer, market, product, rate plan, and so on), add the attribute externalUniqueID.
The external unique ID is a string that allows you to uniquely identify subscription data that is sent from an external system. In turn, this allows you to prevent the creation of duplicates. In our example, the string is the subscription order ID from the online shop.
A very basic request containing the external unique ID could look like this:
Every time that you send a request with an external unique ID, the system checks whether a subscription already exists with that ID. If so, the system rejects the request, which prevents the creation of a duplicate subscription for the same order.
Additional Reading Materials
If you’re just getting started with our APIs and business events, the following blog posts are a good starting point: