Time to read: 7 min

The article covers the following topics:

You can manage Billing for Affiliates via API. The article contains the most common billing API methods and the errors you might face when working with them.

⚠️ The Billing via API feature is available only for certain plans. Contact your Affise account manager to get the feature.

To read more about generating billings for affiliates, go here.

General info

To get started with API, you need to find your API-key. To do it, just navigate to the Users tab > Users management > User edit page.

Only the General manager has permission to get the User edit page.

You can find it in Settings tab > Settings > Tracking domains > Default URL's tab.

Find out more about where you can find your/Affiliate's API-key and API URL here.

API Request Structure: GET/POST + api domain + path + ? + api-key=189471975956279174174.

❗ The system uses the header content-type - application/x-www-form-urlencoded on an ongoing basis, and content-type - multipart/form-data for uploading files (logo, creative files).

[GET] Get payments list

To get payments list via API, you need to navigate to the Billing API section in the API Doc and choose the Get payments list method (go here):

You can see parameters that can be used to get a payments list.

These parameters are required:

  • date_from - the first day of the period you want billings to be shown up (format YYYY-MM-DD)

  • date_to - the last day of the period you want billings to be shown up (format YYYY-MM-DD)

You can also add additional parameters:

  • id - payment invoice ID

  • status - payment invoice status

  • aid - affiliate ID

  • manager_id - affilaite manager ID

  • payment_system - payment system title

  • payment_account - payment account details

Below you can find an example of how to get a payments list via API:

1) Make sure that you entered headers correctly:

2) Enter the required and all needed parameters in the Params section:

If you entered everything correctly, you will receive the following response:

[POST] Create payment invoice

This method allows you to generate the billing for the certain sum of money for the certain affiliate.

To create payment invoice via API, you need to navigate to the Billing API section in the API Doc and choose the Create payment invoice method (go here):

These parameters are required:

  • aid - affiliate ID

  • sum - payment invoice sum

  • currency - currency ID

You can also add the additional parameter:

  • note - note for payment invoice

Below you can find an example of how to create payment invoice via API:

1) Make sure that you entered headers correctly:

2) Enter the needed parameters in the body section:

If you entered everything correctly, you will receive the status '1' response.

The example of user editing via cURL request:

curl --location --request POST 'https://api-rocketcompany.affise.com/3.1/payments/create-for-affiliate' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'api-key: 5c9f6bbe709c5b331a9630b1fb1db0ed' \
--header 'Cookie: PHPSESSID=alcje7al4vd7p27ev26s1gclqm' \
--data-urlencode 'aid=2' \
--data-urlencode 'sum=2' \
--data-urlencode 'currency=150'

[POST] Generate payment invoices for affiliates

This method allows you to generate the billing for the certain period of time.

To generate payment invoices for affiliates via API, you need to navigate to the Billing API section in the API Doc and choose the Generate payment invoices for affiliates method (go here):

The following parameter is required:

  • date - this field is responsible for the date, which payouts in conversions will be counted. The system sets up the current by default. You may choose any other date in the past.

You can also add additional parameters:

  • aid - affiliate ID

  • note - note for payment invoice

  • exclude_aids - exclude affiliate IDs

Below you can find an example of how to generate payment invoices for affiliates via API:

1) Make sure that you entered headers correctly:

2) Enter the needed parameters in the body section:

If you entered everything correctly, you will receive the status '1' response.

The example of payment invoices generating via cURL request:

curl --location --request POST 'https://api-rocketcompany.affise.com/3.1/payments/generate' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'api-key: 5c9f6bbe709c5b331a9630b1fb1db0ed' \
--header 'Cookie: PHPSESSID=alcje7al4vd7p27ev26s1gclqm' \
--data-urlencode 'date=2022-05-23' \
--data-urlencode 'aid=2' \
--data-urlencode 'exclude_aids[]=8'

[POST] Update payment invoice

To update payment invoice via API, you need to navigate to the Billing API section in the API Doc and choose the Update payment invoice method (go here):

You can add the following parameters (you have to specify at least one parameter):

  • payment_account - payment account details

  • status - payment invoice status

  • comment - comment for payment invoice

  • note - note for payment invoice

Below you can find an example of how to update payment invoice via API:

1) Make sure that you entered headers correctly:

2) Enter the needed parameters in the body section:

If you entered everything correctly, you will receive the status '1' response.

The example of payment invoices generating via cURL request:

curl --location --request POST 'https://api-rocketcompany.affise.com/3.1/payments/2926' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'api-key: 5c9f6bbe709c5b331a9630b1fb1db0ed' \
--header 'Cookie: PHPSESSID=7e3nrlm566d1vdqdioiaflrhhn' \
--data-urlencode 'payment_account=payment account' \
--data-urlencode 'status=3' \
--data-urlencode 'comment=example' \
--data-urlencode 'note=example'

[POST] Add correction value for payment invoice

To add correction value for payment invoice via API, you need to navigate to the Billing API section in the API Doc and choose the Add correction value for payment invoice method (go here):

Read more about the correction option here.

These parameters are required:

  • revenue - the sum of money you want to add to the payment

  • comment - comment for correction payment

Below you can find an example of how to add correction value for payment invoice via API:

1) Make sure that you entered headers correctly:

2) Enter the needed parameters in the body section:

If you entered everything correctly, you will receive the status '1' response.

The example of payment invoices generating via cURL request:

curl --location --request POST 'https://api-rocketcompany.affise.com/3.1/payments/2921/add-correction' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'api-key: 5c9f6bbe709c5b331a9630b1fb1db0ed' \
--header 'Cookie: PHPSESSID=alcje7al4vd7p27ev26s1gclqm' \
--data-urlencode 'revenue=22' \
--data-urlencode 'comment=example'

[POST] Remove several payment invoices

To remove several payment invoices via API, you need to navigate to the Billing API section in the API Doc and choose the Remove several payment invoices method (go here):

❗ You can remove the billing with any status, except Complete. If you try to remove the billing with the Complete status, you get the following error:

The following parameter is required:

  • ids - Payment invoice ID

Below you can find an example of how to remove several payment invoices via API:

1) Make sure that you entered headers correctly:

2) Enter the needed parameters in the body section:

If you entered everything correctly, you will receive the status '1' response.

The example of payment invoices generating via cURL request:

curl --location --request POST 'https://api-rocketcompany.affise.com/3.1/payments/bulk-delete' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'api-key: 5c9f6bbe709c5b331a9630b1fb1db0ed' \
--header 'Cookie: PHPSESSID=7e3nrlm566d1vdqdioiaflrhhn' \
--data-urlencode 'ids[0]=2925' \
--data-urlencode 'ids[1]=2924'

[POST] Edit payment systems

To edit payment systems for an affiliate via API, you need to navigate to the Affiliate managing (admin methods) section in the API Doc and choose the Edit affiliate method (go here):

❗ The option of editing is available only when the billing has any status, except Complete.

Below you can find an example of how to edit a payment system for an affiliate via API:

1) Make sure that you entered headers correctly:

2) Enter the needed parameters in the body section:

The example of payment invoices generating via cURL request:

curl --location --request POST 'https://api-rocketcompany.affise.com/3.0/admin/partner/2' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'api-key: 5c9f6bbe709c5b331a9630b1fb1db0ed' \
--header 'Cookie: PHPSESSID=7e3nrlm566d1vdqdioiaflrhhn' \
--data-urlencode 'payment_systems[0][system_id]=13' \
--data-urlencode 'payment_systems[0][currency]=USD' \
--data-urlencode 'payment_systems[0][fields][4]=1b765'

Common errors

When creating a billing via API, you may face the following errors:

1) The affiliate [*affiliate ID] does not have a payment system

Check if you added the payment system on the platform level: Settings > Content > Payment systems. If no - add the payment system there. If yes - check whether you chose it on the Affiliate edit page.

❗ Keep in mind that in the Payment systems (Settings > Content > Payment systems) you have to set at least one field for all presented payment systems. The field can be empty.

2) The affiliate [*affiliate ID] does not have paid conversions

It means that the affiliate does not have conversions at all or does not have unpaid approved conversions for the period of time, which the billing is being created for.

The affiliate should have at least one paid conversion to make it possible to create a billing.

3) Minimum payment - *amount of money and currency

The error means that you try to generate the billing using the second form for the sum of money, less than set up in Settings > Content > Currencies.

Generate the billing for an equal or bigger sum of money that specified in the Min payment field or make the minimal payment less.

4) Payment has status finished

You get this error message when you try to update the billing with the Completed status. You cannot update the billings with the Completed status.

You may also find the following articles helpful:


If you have more questions on how to manage billing via API, feel free to contact the Affise Support Team via [email protected] or your Dedicated Account Manager.

Did this answer your question?