Skip to main content
Handling Affiliate Billing via API

Manage affiliate billing using API, including retrieving open balances, settling balances, and reviewing settlements.

David Rolenc avatar
Written by David Rolenc
Updated this week

Affiliate billing is a critical aspect of managing partnerships and ensuring timely payouts to your affiliates. With Trackdesk, handling affiliate billing can be efficiently managed via API endpoints. This article provides a detailed flow of the process to handle affiliate billing using Trackdesk's API. Each step involves specific API calls, which are explained below.

Note that the handling of billing via API is available starting from the Business plan and above.

Overview of the Billing Flow

The process of handling affiliate billing via API consists of the following steps:

  1. Retrieve Open Balances: Identify all outstanding balances for affiliates.

  2. Settle Balances: Create settlements for the outstanding balances.

  3. Review Account Settlements: Fetch previously created account settlements to ensure proper tracking.

  4. Review Settlements: Review settlements that have been created to ensure accuracy.

  5. Delete Settlements or Account Settlements (if necessary): Manage and delete any incorrect settlements if required.

Below, we dive into each step in detail, including the API endpoints used and their purposes.

Retrieve Open Balances

To begin, use the GET /api/node/billing/v1/open-balances endpoint to retrieve a list of open balances for affiliates. Open balances represent amounts owed to affiliates that have not yet been settled.

Key Details:

  • This API call returns a list of all affiliates with outstanding balances.

  • Use this data to identify affiliates who need to be paid and their corresponding amounts.

Settle Balances

After reviewing open balances, you can settle the outstanding amounts. Use the POST /api/node/billing/v1/settle-balances endpoint to accomplish this.

Key Details:

  • This API call creates settlements for the specified open balances.

  • You will need to provide details such as affiliate IDs and the amount to be settled.

  • After successful execution, this endpoint generates new settlement records.

Review Account Settlements

Use the GET /api/node/billing/v1/account-settlements endpoint to retrieve this information.

Key Details:

  • This API call lists all existing account settlements, providing a history of previous actions.

  • Reviewing this information helps avoid duplicate settlements and ensures proper tracking.

Review Settlements

To verify the accuracy of the created settlements, use the GET /api/node/billing/v1/settlements endpoint to retrieve a list of all settlements. Additionally, you can use the GET /api/node/billing/v1/settlements/{id} endpoint to view details of a specific settlement.

Endpoints:

Key Details:

  • Use the general GET /settlements endpoint to review all settlements.

  • If you need to examine a specific settlement, the {id} parameter allows you to fetch detailed information for that settlement.

Delete Settlements or Account Settlements (if necessary)

In some cases, you may need to delete settlements or account settlements due to errors or adjustments. The following endpoints allow for this:

Endpoints:

Key Details:

  • Use the DELETE /account-settlements/{id} endpoint to remove an account settlement.

  • Use the DELETE /settlements/{id} endpoint to delete a settlement.

  • Ensure that you correctly specify the settlement ID to avoid unintended deletions.

Summary of API Endpoints

Here is a quick reference for the endpoints used in the affiliate billing flow:

Conclusion

Handling affiliate billing via API is a streamlined and efficient process using Trackdesk's endpoints. By following the steps outlined above, you can ensure accurate management of affiliate payouts and maintain clean billing records. Refer to the linked API documentation for additional details about request and response structures, parameters, and examples.

Did this answer your question?