Skip to main content
API for billings (admins)
Daria Mamchenkova avatar
Written by Daria Mamchenkova
Updated over 6 months ago

Before you begin

API for billings

Affise API provides you with different methods to work with billings. For example, you can get payment invoice information, create a payment invoice, remove it, etc. In this article, you will find examples of the most popular API requests (methods) for billings with cURL examples and examples of the response.

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

Get payments list

Use this method to get the list of payments according to their properties, which you can indicate in your API request.

The method: GET /3.1/payments.

The request for getting payments list with specified period:

https://api-rocketcompany.affise.com/3.1/payments?date_from=2022-08-08&date_to=2022-12-12

Create payment invoice

Use this method to generate the billing for the certain sum of money for the certain affiliate according to its properties, which you can indicate in your API request.

The method: POST /3.1/payments/create-for-affiliate.

The cURL request for creation of a payment invoice with the following properties:

  • the affiliate ID

  • the payment invoice sum

  • the currency ID

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'

Generate payment invoices for affiliates

Use this method to generate the billing for a certain time period according to its properties, which you can indicate in your API request.

The method: POST /3.1/payments/generate.

The cURL request for creation a payment invoice for affiliates with the following properties:

  • the date

  • the affiliate ID

  • the excluded affiliate ID

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'

Update payment invoice

Use this method to update the payment invoice according to its properties, which you can indicate in your API request.

The method: POST /3.1/payments/{ID}.

The cURL request for payment invoice updating with the following properties:

  • the payment account information

  • the Paid partly status

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'

Add correction value for payment invoice

Use this method to add correction value for payment invoice according to its properties, which you can indicate in your API request.

The method: POST /3.1/payments/{ID}/add-correction.

The cURL request for correction value adding with the following properties:

  • the revenue = 22

  • the comment

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'

Remove several payment invoices

Use this method to remove several payment invoices according to their properties, which you can indicate in your API request.

The method: POST /3.1/payments/bulk-delete.

⚠️ 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 cURL request for several payment invoices removing with the payment invoice ids = 2925 and 2924:

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'

Edit payment systems

Use this method to edit payment systems for an affiliate according to their properties, which you can indicate in your API request.

The method: POST /3.0/admin/partner/{ID}.

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

The cURL request for editing payment systems with affiliates systems ID = 13, currency code = USD, and advanced fields = 1b765:

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'

Please contact the Affise Customer Support team regarding all raised questions via the e-mail: [email protected].

Did this answer your question?