POST
/merchants/{id}/transactions
Create a new transaction
Merchants
Description
Create a new transaction for a specific merchant.
Authentication Required: User must be authenticated and have the 'merchant' feature flag.
Authorization: Merchant users can only create transactions for their own merchant account.
Parameters
id
integer
path
required
Merchant ID
Request Body
requiredapplication/json
redirect_idinteger
ID of the redirect that originated this transaction. When provided, the affiliate_id is automatically resolved from the redirect. If omitted, affiliate_id becomes required.
Example:
1affiliate_idinteger
ID of the affiliate who generated this transaction. Required when redirect_id is not provided. When redirect_id is provided and affiliate_id is omitted, it is automatically resolved from the redirect.
Example:
42basket_itemsarray [object]required
Array of items in the basket. The basket_price is automatically calculated from the sum of all item prices multiplied by quantities.
Example:
[{"name":"Laptop Stand","gtin":"1234567890123","price":49.99,"quantity":2,"commission_rate":10.0,"status":"pending"},{"name":"Wireless Mouse","gtin":"9876543210987","price":80.0,"quantity":1,"commission_rate":12.5,"status":"pending"}]namestring
Optional product name
Example:
Laptop Standgtinstringrequired
Product identification code, EAN or UPC (mandatory, cannot be empty)
Example:
1234567890123pricenumber (float)required
Item price (mandatory, must be >= 0)
Example:
49.99quantityintegerrequired
Item quantity (mandatory, must be >= 1)
Example:
2commission_ratenumber (float)required
Commission rate percentage (mandatory, must be >= 0.0)
Example:
10.0statusstring
Item status (optional, defaults to pending)
Example:
pendingResponses
201
Transaction created successfully
application/jsonstatusstring
Example:
successmessagestring
Example:
Transaction created successfullydataobject
Example:
{
"status": "success",
"message": "Transaction created successfully",
"data": {
"id": 45,
"redirect_id": 1,
"basket_price": 129.99,
"affiliate": {
"id": 42,
"name": "Partner Corp"
},
"status": "pending",
"total_commission": 15.0,
"reward": "pending",
"created_at": "2024-12-01T10:00:00Z",
"updated_at": "2024-12-01T10:00:00Z"
}
}
400
Bad request - missing or invalid parameters
application/json
401
Authentication required
application/jsonExample:
{
"status": "error",
"message": "Not authenticated or insufficient permissions"
}
404
Merchant or Affiliate not found
application/json
500
Internal server error
application/jsonstatusstring
Example:
errormessagestring
Example:
Failed to create transactionerrorstring
Example:
Database connection failed