Transactions
Create transaction
Record sales transactions for commission calculation in your affiliate program
POST
/
v1
/
transactions
Create transaction
curl --request POST \
--url https://api.example.com/v1/transactionsimport requests
url = "https://api.example.com/v1/transactions"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/transactions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/transactions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/transactions"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/transactions")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/transactions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"data": {
"key": "transaction_123",
"action": "sale",
"amount": 99.99,
"partner": "partner_123",
"customer": "customer_123",
"credit": false,
"is_currency": true,
"amount_units": "USD",
"created_at": "2025-05-07T05:32:48.000000Z",
"deleted_at": null,
"rewards": [
{
"key": "transaction_123",
"action": "sale",
"status": "ok",
"customer": "customer_123",
"partner": "partner_123",
"amount": 29.997,
"amount_units": "USD",
"is_currency": true,
"credit": false,
"created_at": "2025-05-07T05:32:48.000000Z",
"deleted_at": null,
"product_type_data": {
"product_id": "prod_123",
"product_type": "monthly"
}
}
]
},
"status": 1
}
Endpoint
POST https://api.partnero.com/v1/transactions
Request body
Transaction fields| Parameter | Type | Required | Description |
|---|---|---|---|
key | string | No | Unique transaction ID (recommended for refund handling) |
amount | number | Yes* | Transaction amount. Partnero calculates commission based on program settings |
reward | number | Yes* | Set the commission amount directly instead of calculating from amount |
amount_units | string | No | Currency code (e.g., USD, EUR, GBP) |
action | string | No | Transaction type (e.g., sale) |
product_id | string | No | Product ID for advanced commission rules |
product_type | string | No | Product type/category for advanced commission rules |
rewarded | boolean | No | Whether the transaction is already rewarded (default: false) |
rewardable | boolean | No | Whether the transaction is eligible for rewards (default: true) |
created_at | integer | No | Unix timestamp to backdate the transaction |
amount or reward.
Customer identification
| Parameter | Type | Required | Description |
|---|---|---|---|
customer.key | string | Yes* | Customer’s unique key |
customer.email | string | Yes* | Customer’s email (alternative to key) |
key or email.
Create customer with transaction (options.create_customer: true)
When the customer doesn’t exist yet, you can create them and the transaction in a single request.
| Parameter | Type | Description |
|---|---|---|
options.create_customer | boolean | Create customer and transaction simultaneously |
customer.name | string | Customer’s first name |
customer.surname | string | Customer’s last name |
customer.tags | array | Tags to assign to the customer |
customer.created_at | string | Customer creation date |
customer.partner.key | string | Partner key for attribution |
customer.partner.id | string | Partner ID for attribution |
customer.partner.email | string | Partner email for attribution |
options.referral_url | string | Referral URL for custom link attribution |
product_id, product_price), product metadata (product_information), or both.
| Parameter | Type | Description |
|---|---|---|
products | array | Array of product objects |
products[].product_id | string | Product ID for commission rules |
products[].product_price | number | Product price for commission calculation |
products[].product_information | object | Product metadata (optional) |
products[].product_information.sku | string | Product SKU |
products[].product_information.name | string | Product name |
products[].product_information.description | string|null | Product description |
| Parameter | Type | Description |
|---|---|---|
transactions | array | Array of transaction objects for bulk creation |
transactions[].amount | number | Transaction amount (required) |
transactions[].key | string | Unique transaction ID |
transactions[].action | string | Transaction type |
transactions[].amount_units | string | Currency code |
transactions[].product_id | string | Product ID |
transactions[].product_type | string | Product type |
transactions[].rewarded | boolean | Already rewarded |
transactions[].rewardable | boolean | Eligible for rewards |
Request
- Single transaction
- Direct reward
- With customer creation
- Multiple transactions
- Multiple products
- With product information
curl --location 'https://api.partnero.com/v1/transactions' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"customer": {
"key": "customer_123"
},
"key": "transaction_123",
"amount": 99.99,
"amount_units": "USD",
"product_id": "prod_123",
"product_type": "monthly",
"action": "sale"
}'
curl --location 'https://api.partnero.com/v1/transactions' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"customer": {
"key": "customer_123"
},
"key": "transaction_789",
"reward": 25.00,
"amount_units": "USD",
"action": "sale"
}'
curl --location 'https://api.partnero.com/v1/transactions' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"key": "transaction_456",
"amount": 50.99,
"action": "sale",
"options": {
"create_customer": true
},
"customer": {
"key": "customer_456",
"name": "Robert",
"surname": "Johnson",
"email": "[email protected]",
"partner": {
"key": "partner_123"
}
}
}'
curl --location 'https://api.partnero.com/v1/transactions' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"customer": {
"key": "customer_123"
},
"transactions": [
{
"key": "transaction_123_m",
"amount": 50.99,
"action": "sale"
},
{
"key": "transaction_456_m",
"amount": 100.99,
"action": "sale"
}
]
}'
curl --location 'https://api.partnero.com/v1/transactions' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"customer": {
"key": "customer_123"
},
"key": "order_789",
"action": "sale",
"products": [
{
"product_id": "prod_a",
"product_price": 29.99
},
{
"product_id": "prod_b",
"product_price": 49.99
}
]
}'
curl --location 'https://api.partnero.com/v1/transactions' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"customer": {
"key": "customer_123"
},
"action": "sale",
"amount": 1000,
"products": [
{
"product_id": "product_1",
"product_price": 100,
"product_information": {
"sku": "SKU123",
"name": "Product 1 name",
"description": "Product 1 short description"
}
},
{
"product_id": "product_2",
"product_price": 200
},
{
"product_information": {
"sku": "SKU456",
"name": "Product 2 name",
"description": null
}
}
]
}'
Response
{
"data": {
"key": "transaction_123",
"action": "sale",
"amount": 99.99,
"partner": "partner_123",
"customer": "customer_123",
"credit": false,
"is_currency": true,
"amount_units": "USD",
"created_at": "2025-05-07T05:32:48.000000Z",
"deleted_at": null,
"rewards": [
{
"key": "transaction_123",
"action": "sale",
"status": "ok",
"customer": "customer_123",
"partner": "partner_123",
"amount": 29.997,
"amount_units": "USD",
"is_currency": true,
"credit": false,
"created_at": "2025-05-07T05:32:48.000000Z",
"deleted_at": null,
"product_type_data": {
"product_id": "prod_123",
"product_type": "monthly"
}
}
]
},
"status": 1
}
Response fields
Transaction — data
Transaction — data
| Field | Type | Description |
|---|---|---|
key | string | Transaction identifier |
action | string | Transaction type |
amount | number | Transaction amount |
amount_units | string | Currency code |
partner | string | Attributed partner key |
customer | string | Customer key |
credit | boolean | Whether this is a credit transaction |
is_currency | boolean | Whether the amount is monetary |
created_at | string | ISO 8601 timestamp |
deleted_at | string|null | Deletion timestamp if archived/refunded |
Rewards — data.rewards[]
Rewards — data.rewards[]
| Field | Type | Description |
|---|---|---|
key | string | Reward identifier (matches transaction key) |
action | string | Reward origin |
status | string | Reward status (ok, review_period, rejected) |
customer | string | Customer key |
partner | string | Partner key |
amount | number | Commission amount |
amount_units | string | Currency code |
is_currency | boolean | Whether the amount is monetary |
credit | boolean | Whether this is a credit reward |
created_at | string | ISO 8601 timestamp |
deleted_at | string|null | Deletion timestamp |
product_type_data | object | Product ID and type (if provided) |
Error responses
| Status | Error | Solution |
|---|---|---|
| 400 | Customer not found | Create customer first or use options.create_customer |
| 400 | Duplicate key | Transaction with this key already exists |
| 422 | Validation error | Check required fields (amount/reward and customer identification) |
Use unique transaction keys (like invoice IDs) to enable refund handling. When you delete a transaction by key, the associated commission is automatically reversed.
⌘I
Create transaction
curl --request POST \
--url https://api.example.com/v1/transactionsimport requests
url = "https://api.example.com/v1/transactions"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/transactions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/transactions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/transactions"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/transactions")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/transactions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"data": {
"key": "transaction_123",
"action": "sale",
"amount": 99.99,
"partner": "partner_123",
"customer": "customer_123",
"credit": false,
"is_currency": true,
"amount_units": "USD",
"created_at": "2025-05-07T05:32:48.000000Z",
"deleted_at": null,
"rewards": [
{
"key": "transaction_123",
"action": "sale",
"status": "ok",
"customer": "customer_123",
"partner": "partner_123",
"amount": 29.997,
"amount_units": "USD",
"is_currency": true,
"credit": false,
"created_at": "2025-05-07T05:32:48.000000Z",
"deleted_at": null,
"product_type_data": {
"product_id": "prod_123",
"product_type": "monthly"
}
}
]
},
"status": 1
}
