Authentication
Request
Must be
"create_purchase_custom".The lead to record the purchase against. Your company must have access to this lead’s channel.
A free-text product name (not linked to the product catalog).
A description of the product or service.
The purchase amount in the channel’s currency.
The date of the purchase. Defaults to the current time if omitted.
An optional list of reward trigger IDs to fire for this purchase. When provided, only these specific triggers are evaluated instead of all active purchase triggers on the channel. Each trigger must belong to the lead’s channel and have an
"Active" status.Response
Returns the created purchase record.Side effects
- Purchase event: An event record is created logging the product name and amount.
- Reward triggers: If
trigger_idsis provided, only those triggers are evaluated. Otherwise, all activepurchasetriggers on the channel fire. Fixed rewards use the trigger’s configured amount; percentage rewards are calculated from thepurchase_amount.
Difference from create_purchase
Use create_purchase when you have a product in your Keen product catalog and want to link the purchase to it by ID. Use create_purchase_custom when you want to specify a product name as free text, or when you need to control which reward triggers fire.
Example
Request
Response
Errors
| Status | Error | Cause |
|---|---|---|
400 | "lead_id required" | The lead_id field is missing. |
401 | "Invalid API key" | Missing or invalid X-Api-Key header. |
403 | "Lead not accessible" | Your company does not have access to this lead’s channel. |