Invoices

Operations for Partner Invoices

Find Partner Invoices

POST /v1/networks/billings/affiliates/invoicestable

This endpoint allows to fetch partner invoices. Different filters can be used to narrow down the set of invoices that will be returned by the endpoint. You can, for example, use the filters to only return the unpaid invoices for a specific affiliate ID.

Paging

This endpoint supports paging. Refer to our User Guide for usage.

search_terms object array

Search terms are optional but can be used to look for specific words.

search_type string

The name of the field used for search. On this endpoint, it can only ever be name. Searching by name will actually search the invoice ID, the partner ID as well as the partner name.

value string

The value to search.

filters object

Filters are also completely optional but are usually used to narrow down the set of invoices returned. They can be used individually or combined in a single request.

network_affiliate_ids int array

One or multiple partner IDs for which the invoices will be returned.

network_affiliate_invoice_ids int array

Return a specific set of invoice IDs.

account_manager_ids int array

One or multiple account manager IDs for which the invoices will be returned.

min_start_time string

Only return invoices with a start date greater or equal to this value. Takes a date in the YYYY-MM-DD format

max_end_time string

Only return invoices with an end date smaller or equal to this value. Takes a date in the YYYY-MM-DD format

min_balance decimal number

Only return invoices with an invoice balance grater than this value.

max_balance decimal number

Only return invoices with an invoice balance smaller than this value.

affiliate_invoice_status string

Only return invoices with a status equal to this value. Can only be paid, unpaid or deleted

is_hidden_affiliate string

Filters based on whether the invoice is visible to the partner or not. Can be visible or hidden

payment_terms int array

Only return invoices for which the payment terms is a number of days contained in this array.

cURL
curl --request POST 'https://api.eflow.team/v1/networks/billings/affiliates/invoicestable' \
--header 'X-Eflow-API-Key: <INSERT API KEY>' \
--header 'Content-Type: application/json' \
--data '<INSERT BODY HERE>'

Example 1 : Find all invoices for partners named “Google” where the invoice period finished before April 4th 2020 :

{
    "search_terms":
    [
        {
			"search_type": "name",
			"value": "Google"
		}
    ],
    "filters":
    {
        "max_end_time": "2020-04-01"
    }
}

Example 2 : Find all unpaid invoices for affiliate ID 8080 :

{
    "search_terms": [],
    "filters":
    {
        "affiliate_invoice_status": "unpaid",
        "network_affiliate_ids":
        [
            8080
        ]
    }
}
Response
{
	"invoices": [
		{
			"network_affiliate_invoice_id": 368,
			"network_id": 1,
			"network_affiliate_id": 27,
			"network_affiliate_name": "Example Affiliate",
			"affiliate_invoice_status": "paid",
			"start_time": "2019-12-01 00:00:00",
			"end_time": "2020-03-06 23:59:59",
			"timezone_id": 55,
			"balance": 0,
			"paid": 200,
			"billed": 200,
			"currency_id": "USD",
			"payment_terms": 20,
			"is_hidden_affiliate": false,
			"public_notes": "",
			"internal_notes": "",
			"payment_type": "masspay",
			"time_created": 1583541215,
			"time_saved": 1599140043
		}
	],
	"paging": {
		"page": 1,
		"page_size": 50,
		"total_count": 1
	}
}

Partner Invoices Summary

POST /v1/networks/billings/affiliates/summary

This endpoint is very similar to the endpoint documented above (“Find Partner Invoices”). The filters are exactly the same, but instead of returning multiple invoices, the endpoint will simply return the “summary” (billed amount, balance, etc.) of the invoices involved.

search_terms object array

Search terms are optional but can be used to look for specific words.

search_type string

The name of the field used for search. On this endpoint, it can only ever be name. Searching by name will actually search the invoice ID, the partner ID as well as the partner name.

value string

The value to search.

filters object

Filters are also completely optional but are usually used to narrow down the set of invoices returned. They can be used individually or combined in a single request.

network_affiliate_ids int array

One or multiple partner IDs for which the invoices will be returned.

network_affiliate_invoice_ids int array

Return a specific set of invoice IDs.

account_manager_ids int array

One or multiple account manager IDs for which the invoices will be returned.

min_start_time string

Only return invoices with a start date greater or equal to this value. Takes a date in the YYYY-MM-DD format

max_end_time string

Only return invoices with an end date smaller or equal to this value. Takes a date in the YYYY-MM-DD format

min_balance decimal number

Only return invoices with an invoice balance grater than this value.

max_balance decimal number

Only return invoices with an invoice balance smaller than this value.

affiliate_invoice_status string

Only return invoices with a status equal to this value. Can only be paid, unpaid or deleted

is_hidden_affiliate string

Filters based on whether the invoice is visible to the partner or not. Can be visible or hidden

payment_terms int array

Only return invoices for which the payment terms is a number of days contained in this array.

cURL
curl --request POST 'https://api.eflow.team/v1/networks/billings/affiliates/summary' \
--header 'X-Eflow-API-Key: <INSERT API KEY>' \
--header 'Content-Type: application/json' \
--data '<INSERT BODY HERE>'

Example 1 : Find the summary for invoices for partners named “Google” where the invoice period finished before April 4th 2020 :

{
    "search_terms":
    [
        {
			"search_type": "name",
			"value": "Google"
		}
    ],
    "filters":
    {
        "max_end_time": "2020-04-01"
    }
}

Example 2 : Find invoice summary for unpaid invoices for affiliate ID 8080 :

{
    "search_terms": [],
    "filters":
    {
        "affiliate_invoice_status": "unpaid",
        "network_affiliate_ids":
        [
            8080
        ]
    }
}
Response
{
	"total_count": 1,
	"balance": 23,
	"billed": 23,
	"paid": 0
}

Find Partner Invoice by ID

GET /v1/networks/billings/affiliates/invoices/:invoiceId

This endpoint allows you fetch the details of a single partner invoice.

Path Parameters

Parameter Description
invoiceId The ID of the partner invoice you want to fetch

cURL
curl --request GET '/v1/networks/billings/affiliates/invoices/553' \
--header 'X-Eflow-API-Key: <INSERT API KEY>'
Response
{
	"network_affiliate_invoice_id": 553,
	"network_id": 1,
	"network_affiliate_id": 27,
	"status": "unpaid",
	"start_time": "2020-09-03 00:00:00",
	"end_time": "2020-09-09 23:59:59",
	"public_notes": "",
	"internal_notes": "",
	"timezone_id": 80,
	"balance": 72.95,
	"currency_id": "USD",
	"is_hidden_affiliate": false,
	"payment_terms": 15,
	"time_created": 1599711451,
	"time_saved": 1626114580,
	"relationship": {
		"details": [
			{
				"network_affiliate_invoice_detail_id": 240,
				"network_affiliate_invoice_id": 553,
				"network_offer_id": 3,
				"network_offer_name": "Example Offer Name",
				"amount": 72.95,
				"invoice_currency_amount": 72.95,
				"currency_id": "USD",
				"notes": "",
				"quantity": 1,
				"time_created": 0,
				"time_saved": 0,
				"referral_history_id": 0
			}
		]
	},
	"details": null,
	"extra_periods": null
}

Create Partner Invoice

POST /v1/networks/billings/affiliates/invoices

This endpoint allows you to create a partner invoice via the API. Note that creating an invoice (whether marked as paid or unpaid) will never in itself trigger a payment.

network_affiliate_id int

The ID of the partner that will be invoiced.

status string

Status of the invoice that will be created. Can be paid, unpaid or deleted

start_time string

Invoice start date in the YYYY-MM-DD format

end_time string

Invoice end date in the YYYY-MM-DD format

public_notes string

Notes that will be visible to both the network employees and the invoiced partner.

internal_notes string

Notes that will be visible to network employees but not the invoiced partner.

is_hidden_affiliate bool

Determines whether the invoice is visible to the partner or not.

payment_terms int

Number of days for the affiliate payment term (i.e. pass 20 for NET 20)

cURL
curl --request POST 'https://api.eflow.team/v1/networks/billings/affiliates/invoices' \
--header 'X-Eflow-API-Key: <INSERT API KEY>' \
--header 'Content-Type: application/json' \
--data '<INSERT BODY HERE>'

Example body :

{
    "network_affiliate_id": 7,
    "start_time": "2021-12-01",
    "end_time": "2021-12-20",
    "status": "unpaid",
    "is_hidden_affiliate": false,
    "payment_terms": 15,
    "public_notes": "public note visible to affiliate",
    "internal_notes": "internal note not visible to affiliate"
}