AddPurchase

Extends \Recombee\RecommApi\Requests\Request

Adds a purchase of a given item made by a given user.

package

Default

Methods

Construct the request

__construct(string $user_id, string $item_id, array $optional = array()) 
Throws
\Recombee\RecommApi\Requests\Exceptions\UnknownOptionalParameterException

UnknownOptionalParameterException if an unknown optional parameter is given in $optional

Arguments

$user_id

string

User who purchased the item

$item_id

string

Purchased item

$optional

array

Optional parameters given as an array containing pairs name of the parameter => value

  • Allowed parameters:
    • timestamp
      • Type: string|float
      • Description: UTC timestamp of the purchase as ISO8601-1 pattern or UTC epoch time. The default value is the current time.
    • cascadeCreate
      • Type: bool
      • Description: Sets whether the given user/item should be created if not present in the database.
    • amount
      • Type: float
      • Description: Amount (number) of purchased items. The default is 1. For example if user-x purchases two item-y during a single order (session...), the amount should equal to 2.
    • price
      • Type: float
      • Description: Price paid by the user for the item. If amount is greater than 1, sum of prices of all the items should be given.
    • profit
      • Type: float
      • Description: Your profit from the purchased item. The profit is natural in e-commerce domain (for example if user-x purchases item-y for $100 and the gross margin is 30 %, then the profit is $30), but is applicable also in other domains (for example at a news company it may be income from displayed advertisement on article page). If amount is greater than 1, sum of profit of all the items should be given.
    • recommId
      • Type: string
      • Description: If this purchase is based on a recommendation request, recommId is the id of the clicked recommendation.

Get body parameters

getBodyParameters() : array
inherited abstract

Response

array

Values of body parameters (name of parameter => value of the parameter)

Returns true if HTTPS must be chosen over HTTP for this request

getEnsureHttps() : boolean
inherited

Response

boolean

true if HTTPS must be chosen

Get used HTTP method

getMethod() : static
inherited abstract

Response

static

Used HTTP method

Get URI to the endpoint

getPath() : string
inherited abstract

Response

string

URI to the endpoint

Get query parameters

getQueryParameters() : array
inherited abstract

Response

array

Values of query parameters (name of parameter => value of the parameter)

Get request timeout

getTimeout() : integer
inherited

Response

integer

Request timeout in milliseconds

Sets if HTTPS must be chosen over HTTP for this request

setEnsureHttps( $ensure_https) 
inherited

Arguments

$ensure_https

Sets request timeout

setTimeout( $timeout) 
inherited

Arguments

$timeout

Properties

User who purchased the item

user_id : string
var

User who purchased the item

Type(s)

string

Purchased item

item_id : string
var

Purchased item

Type(s)

string

UTC timestamp of the purchase as ISO8601-1 pattern or UTC epoch time. The default value is the current time.

timestamp : string|float
var

UTC timestamp of the purchase as ISO8601-1 pattern or UTC epoch time. The default value is the current time.

Type(s)

string|float

Sets whether the given user/item should be created if not present in the database.

cascade_create : boolean
var

Sets whether the given user/item should be created if not present in the database.

Type(s)

boolean

Amount (number) of purchased items. The default is 1. For example if `user-x` purchases two `item-y` during a single order (session...), the `amount` should equal to 2.

amount : float
var

Amount (number) of purchased items. The default is 1. For example if user-x purchases two item-y during a single order (session...), the amount should equal to 2.

Type(s)

float

Price paid by the user for the item. If `amount` is greater than 1, sum of prices of all the items should be given.

price : float
var

Price paid by the user for the item. If amount is greater than 1, sum of prices of all the items should be given.

Type(s)

float

Your profit from the purchased item. The profit is natural in e-commerce domain (for example if `user-x` purchases `item-y` for $100 and the gross margin is 30 %, then the profit is $30), but is applicable also in other domains (for example at a news company it may be income from displayed advertisement on article page). If `amount` is greater than 1, sum of profit of all the items should be given.

profit : float
var

Your profit from the purchased item. The profit is natural in e-commerce domain (for example if user-x purchases item-y for $100 and the gross margin is 30 %, then the profit is $30), but is applicable also in other domains (for example at a news company it may be income from displayed advertisement on article page). If amount is greater than 1, sum of profit of all the items should be given.

Type(s)

float

If this purchase is based on a recommendation request, `recommId` is the id of the clicked recommendation.

recomm_id : string
var

If this purchase is based on a recommendation request, recommId is the id of the clicked recommendation.

Type(s)

string

Array containing values of optional parameters

optional : array
var

Array containing values of optional parameters

Type(s)

array

Timeout of the request in milliseconds

timeout : integer
inherited
var

Timeout of the request in milliseconds

Type(s)

integer

Sets if the HTTPS must be chosen over HTTP for this request

ensure_https : boolean
inherited
var

Sets if the HTTPS must be chosen over HTTP for this request

Type(s)

boolean