REST API - Payout Endpoints

AffiliateWP core 1.9+ offers two, read-only REST endpoints for payouts:

  1. payouts – Retrieves response objects for all payouts on the current site
  2. payouts/{ID} – Retrieves a response object for an payout with the given payout ID

The payout endpoints can be accessed via GET requests at the following locations:

http://example.com/wp-json/affwp/v1/payouts
http://example.com/wp-json/affwp/v1/payouts/ID

All payout endpoints and their various options are also discoverable by visiting the AffiliateWP REST namespace directly:

http://example.com/wp-json/affwp/v1/

Endpoints


The payouts endpoint accepts any valid get_payouts() arguments:

  • number – The number of results to retrieve (if available)
  • offset – The number of results to offset in the query. Default is 0 (no offset)
  • payout_id – The payout ID or array of IDs to query for.
  • affiliate_id – The affiliate ID or array of IDs to query payouts for.
  • referrals – Referral ID or array of referral IDs to retrieve payouts for.
  • amount – Payout amount (float) or min/max range (array) to retrieve payouts for.
  • amount_compare – Comparison operator used with amount. Accepts '>', '<', '>=', '<=', '=', or '!='.
  • status – The payout status. Accepts 'paid' or 'failed'
  • date – The date array or string to query payouts within.
  • order – How to order results. Accepts 'ASC' (ascending) or 'DESC' (descending).
  • orderby – Which field to order the response results by. Default is 'date'
  • fields – Specific fields to return for each payout in the response. Default '*' (all). Accepts 'ids' or any valid column

All valid arguments can also be derived by sending an OPTIONS request to the either endpoint.

The payouts/{ID} endpoint accepts any valid payout ID.

Visibility

All endpoints require the API key and token except for the main affwp/v1 endpoint.

Response

Responses are returned in JSON form.

Example payouts response:

[
  {
    "payout_id": 1,
    "affiliate_id": 22,
    "referrals": "2,3",
    "amount": 1,
    "payout_method": "manaul",
    "status": "paid",
    "date": "2016-08-04 16:54:21",
    "owner": 0,
    "id": 1
  },
  {
    "payout_id": 2,
    "affiliate_id": 22,
    "referrals": "2,3",
    "amount": 1,
    "payout_method": "manaul",
    "status": "paid",
    "date": "2016-08-04 16:54:24",
    "owner": 0,
    "id": 2
  },

Example payouts/{ID} response:

{
  "payout_id": 2,
  "affiliate_id": 22,
  "referrals": "2,3",
  "amount": 1,
  "payout_method": "manaul",
  "status": "paid",
  "date": "2016-08-04 16:54:24",
  "owner": 0,
  "id": 2
}

.