Closing a Bill Using an API

Objective

After completing this lesson, you will be able to close a bill using an API.

Closing a Bill Using an API

Subscription bills require routine closing each month after a billing cycle.

Normally, a bill is automatically closed at the end of a monthly billing cycle. Sometimes a bill requires manual closing. A bill may require closing at different times for any number of reasons, including when testing an integration. Rather than wait for a bill to automatically close, use an API to manually manage the closing process.

Let’s look at how to manually close a bill with an API. Watch the following video to manually close a bill.

Note

Remember to follow proper handling and security practices when using a bearer token in a REST client.

Summary

Using APIs and events to coordinate the integration of systems simplifies the entire subscription billing process to retrieve bill information, set access rights, cancel subscriptions, generate usage data, update bills, close bills, and many other SAP Subscription Billing-related activities.

Learning Journey Summary

Figure summarizing the content of this lesson: APIs and Events, Systems, and Bills.

SAP Subscription Billing APIs and events can be likened to the orchestration of a symphony, as they play complementary roles in coordinating the integration of systems and managing subscription billing processes. The musical composition represents the underlying business logic and rules governing the performance. In SAP Subscription Billing, the orchestration of events and APIs aligns with the overall business logic, ensuring that the timing, sequence, and collaboration of systems adhere to predefined rules and operational requirements. This synchronizes the interactions between systems, much like the intricate harmony and synchronization found in musical compositions.

Now that you’ve had a chance to explore a few of the many capabilities of APIs and events and how they integrate systems with SAP Subscription Billing, it’s time to put your knowledge to action.

Close the Bill Manually Using the REST API

Business Scenario

After checking the bill, your next task is to close the bill manually to trigger the replication process towards the SAP S/4HANA system to generate invoices. Usually the bills are closed automatically, but your task as a developer is to test the integration and close the bill manually via API to accelerate the process.

Steps

  1. Create a new Request in Bruno.

    Use the following data:

    FieldValue
    Name<of your choice>
    MethodPost
    AuthBearer Token

    1. Choose + in the tab.

    2. Give it a name of your choice, for example, Close Bill Manually.

    3. For the URL, change the method to POST and enter the URL: https://eu10.revenue.cloud.sap/api/bill/v2/bills/ID/closing.

    4. Replace the ID with the Bill ID you have noted down in the exercise Send a GET Bill Request to Retrieve Bill Information on Your Subscription.

    5. Choose Create.

    6. Replace the ID in the URL with the Bill ID from the exercise Send a GET Request to Retrieve Usage Data Information.

    7. Open the Auth tab and select BearerToken.

    8. Enter the Bearer Token from the exercise Generate a Bearer Token to Get Authorization for the APIs.

    9. Choose Send to close the bill.