Skip to content

Affiliate

Paride Azzari edited this page Aug 24, 2024 · 1 revision

Affiliate

Affiliates are contacts of your database that can be transformed into a referral partner. By creating an affiliate you will be able to create an account for this person, that can be accessed via

https://APP_ID.infusionsoft.com/app/authentication/login

At the moment the affiliate program is only available for Keap Ultimate Users.

The Affiliate Model has the following attributes:

[
  "id" => int
  "contact_id" => int
  "parent_id" => ?int
  "code" => string
  "name" => string
  "status" => "active" | "inactive"
  "notify_on_lead" => bool
  "notify_on_sale" => bool
  "track_leads_for" => ?int
]

The method the retrieve, list or create an affiliate, will always return this model in the response.

List

The method list retrieves a list of all the affiliates.

use KeapGeek\Keap\Facades\Keap;

Keap::affiliate()->list([
    'code' => ?string,
    'contact_id' => ?string,
    'name' => ?string,
    'limit' => ?int,
    'offset' => ?int,
    'order' => ?string,
    'order_direction' => ?string,
    'parent_id' => ?string,
    'program_id' => ?string,
    'status' => ?string,
]);

This method accepts different optional parameters, to query on:

  • code is the affiliate parent id
  • contact_id is the contact ID of the affiliate
  • name is the affiliate name
  • limit is the amount of affiliates to return, it defaults to 1000.
  • offset is the first item that starts the set, it defaults to 0.
  • order is the attribute to order items by, it can be id or name.
  • order_direction can be ASCENDING or DESCENDING.
  • parent_id is the affiliate code
  • program_id is the affiliate program ID
  • status is the affiliate status that can be active or inactive.

It returns an array with all the retrieved Affiliate Models.

Count

The method count returns the count of items in the query.

use KeapGeek\Keap\Facades\Keap;

Keap::affiliate()->count([
    'code' => ?string,
    'contact_id' => ?string,
    'name' => ?string,
    'parent_id' => ?string,
    'program_id' => ?string,
    'status' => ?string,
]);

As for the list, this method accepts different optional parameters, to query on:

  • code is the affiliate parent id
  • contact_id is the contact ID of the affiliate
  • name is the affiliate name
  • parent_id is the affiliate code
  • program_id is the affiliate program ID
  • status is the affiliate status that can be active or inactive.

Create

The method create creates a Affiliate Account for the specified person.

use KeapGeek\Keap\Facades\Keap;

Keap::affiliate()->create(
        string $code,     //required
        int $contact_id,  //required
        string $password, //required
        ?string $name = null,
        bool $notify_on_lead = true,
        bool $notify_on_sale = true,
        ?int $parent_id = null,
        bool $active = true,
        ?int $track_leads_for = null
        )

Only the first three arguments are required. With this command you can assign to a specific contact, via contact_id, an affiliate account giving a code as username and a password.

The name is taken from the contacts if not specified in the create method.

Notify on lead or sale allow to select the notification status. Active refers to the status of the affiliate.

The code is the username that will be used for logging into the Affiliate Center, if the status is inactive, he will not be able to log in.

This method will return the affiliate model, with an affiliate id, but without the password field. If $active is true, then status will be active.

Find

The find method allows to retrieve the affiliate model from the affiliate id.

use KeapGeek\Keap\Facades\Keap;

Keap::affiliate()->find($id);

This method returns the affiliate model or null if not found.

Model

The method model retrieves information about the custom fields and properties on the Keap affiliate model.

use KeapGeek\Keap\Facades\Keap;

Keap::affiliate()->model();

This method will return two arrays:

[
    "custom_fields" => [
        ...
    ],
    "optional_properties" => [string],
]

The response includes an array of custom fields, each representing a custom property set in your Keap dashboard. If these custom fields are configured, the response will return an array containing all custom affiliate properties. Each element in this array is itself an array that includes all options and values configured, depending on the type of field selected.

Commissions

This method returns an array of commissions based on affiliate or date range.

use KeapGeek\Keap\Facades\Keap;

Keap::affiliate()->commissions([
    'affiliate_id' => ?int,
    'limit' => ?int,
    'offset' => ?int,
    'order_direction' => ?string,
    'since' => ?string,
    'until' => ?string,
]);

This method accepts different optional parameters, to query on:

  • affiliate_id is the affiliate to retrieve commissions for.
  • limit is the amount of affiliates to return
  • offset is the first item that starts the set
  • order_direction can be ASCENDING or DESCENDING.
  • since is the date to start searching from.
  • until is the date to end searching from.

It returns an array with all the commissions.

You can input any Carbon parsable string in the date fields, since they will automatically be converted into timestamps using Carbon::parse.

Programs

This method returns an array of the commission programs.

use KeapGeek\Keap\Facades\Keap;

Keap::affiliate()->programs([
    'affiliate_id' => ?int,
    'limit' => ?int,
    'offset' => ?int,
    'order' => ?string,
    'order_direction' => ?string,
    'since' => ?string,
    'until' => ?string,
]);

This method accepts different optional parameters, to query on:

  • affiliate_id is the affiliate to retrieve the programs for.
  • limit is the amount of affiliate programs to return
  • offset is the first item that starts the set
  • order is the attribute to order items by, it can be id, name, or priority.
  • order_direction can be ASCENDING or DESCENDING.

It returns an array with all the commission programs.

Redirect Links

This method returns an array of the affiliate redirect links.

use KeapGeek\Keap\Facades\Keap;

Keap::affiliate()->redirects([
    'affiliate_id' => ?int,
    'limit' => ?int,
    'offset' => ?int,
    'order' => ?string, // "id" or "name"
    'order_direction' => ?string, // "ASCENDING" or "DESCENDING
]);

This method accepts different optional parameters, to query on:

  • affiliate_id is the affiliate to retrieve the redirect links for.
  • limit is the amount of affiliate links to return
  • offset is the first item that starts the set
  • order is the attribute to order items by, it can be id or name.
  • order_direction can be ASCENDING or DESCENDING.

It returns an array with all the redirect links.

Summaries

This method returns the summary for the affiliates.

use KeapGeek\Keap\Facades\Keap;

Keap::affiliate()->summaries([
    'affiliate_ids' => [?int],
    'order' => ?string, // see below
    'order_direction' => ?string, // "ASCENDING" or "DESCENDING
]);

This method accepts different optional parameters, to query on:

  • affiliate_ids an array of all the ids to retrieve a summary.
  • order is the attribute to order items by, it can be affiliated_id, amount_earned, balance or clawbacks.
  • order_direction can be ASCENDING or DESCENDING.

It returns an array with all the summaries.

Clawbacks

This method returns all the affiliate clawbacks for an affiliate, given is id.

use KeapGeek\Keap\Facades\Keap;

Keap::affiliate()->clawbacks(int $affiliate_id, [
    'limit' => ?int,
    'offset' => ?int,
    'order_direction' => ?string, // "ASCENDING" or "DESCENDING
    'since' => ?string, //date
    'until' => ?string, //date
]);

This method accepts different optional parameters, to query on:

  • limit is the amount of affiliate links to return
  • offset is the first item that starts the set
  • order_direction can be ASCENDING or DESCENDING, the results are ordered by "DATE_EARNED"
  • since is the date to start searching from.
  • until is the date to end searching from.

You can input any Carbon parsable string in the date fields, since they will automatically be converted into timestamps using Carbon::parse.

It returns an array with all the affiliate clawbacks.

Payments

This method returns all the affiliate payments for an affiliate, given is id.

use KeapGeek\Keap\Facades\Keap;

Keap::affiliate()->payments(int $affiliate_id, [
    'limit' => ?int,
    'offset' => ?int,
    'order' => ?int, // "ID", "DATE" or "AMOUNT"
    'order_direction' => ?string, // "ASCENDING" or "DESCENDING
    'since' => ?string, //date
    'until' => ?string, //date
]);

This method accepts different optional parameters, to query on:

  • limit is the amount of affiliate links to return
  • offset is the first item that starts the set
  • order is the attribute to order items by. It can be "ID", "DATE" or "AMOUNT".
  • order_direction can be ASCENDING or DESCENDING.
  • since is the date to start searching from.
  • until is the date to end searching from.

You can input any Carbon parsable string in the date fields, since they will automatically be converted into timestamps using Carbon::parse.

It returns an array with all the affiliate payments.

Clone this wiki locally