cURL
curl --request POST \
--url https://api.firstpromoter.com/api/v2/track/refund \
--header 'Account-ID: <account-id>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"event_id": "<string>",
"amount": "<string>",
"uid": "<string>",
"currency": "<string>",
"quantity": "<string>",
"sale_event_id": "<string>",
"skip_email_notification": true
}
'import requests
url = "https://api.firstpromoter.com/api/v2/track/refund"
payload = {
"email": "<string>",
"event_id": "<string>",
"amount": "<string>",
"uid": "<string>",
"currency": "<string>",
"quantity": "<string>",
"sale_event_id": "<string>",
"skip_email_notification": True
}
headers = {
"Account-ID": "<account-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Account-ID': '<account-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: '<string>',
event_id: '<string>',
amount: '<string>',
uid: '<string>',
currency: '<string>',
quantity: '<string>',
sale_event_id: '<string>',
skip_email_notification: true
})
};
fetch('https://api.firstpromoter.com/api/v2/track/refund', 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.firstpromoter.com/api/v2/track/refund",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => '<string>',
'event_id' => '<string>',
'amount' => '<string>',
'uid' => '<string>',
'currency' => '<string>',
'quantity' => '<string>',
'sale_event_id' => '<string>',
'skip_email_notification' => true
]),
CURLOPT_HTTPHEADER => [
"Account-ID: <account-id>",
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.firstpromoter.com/api/v2/track/refund"
payload := strings.NewReader("{\n \"email\": \"<string>\",\n \"event_id\": \"<string>\",\n \"amount\": \"<string>\",\n \"uid\": \"<string>\",\n \"currency\": \"<string>\",\n \"quantity\": \"<string>\",\n \"sale_event_id\": \"<string>\",\n \"skip_email_notification\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Account-ID", "<account-id>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.firstpromoter.com/api/v2/track/refund")
.header("Account-ID", "<account-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"event_id\": \"<string>\",\n \"amount\": \"<string>\",\n \"uid\": \"<string>\",\n \"currency\": \"<string>\",\n \"quantity\": \"<string>\",\n \"sale_event_id\": \"<string>\",\n \"skip_email_notification\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firstpromoter.com/api/v2/track/refund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Account-ID"] = '<account-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"<string>\",\n \"event_id\": \"<string>\",\n \"amount\": \"<string>\",\n \"uid\": \"<string>\",\n \"currency\": \"<string>\",\n \"quantity\": \"<string>\",\n \"sale_event_id\": \"<string>\",\n \"skip_email_notification\": true\n}"
response = http.request(request)
puts response.read_body{
"id": 33847726,
"type": "refund",
"amount_cents": -1000,
"reward": {
"id": 10940148,
"status": "approved",
"amount": -200,
"unit": "cash",
"created_at": "2024-09-11T14:36:01.016Z",
"lead": {
"id": 20738339,
"state": "cancelled",
"email": "hello@testmintli.com",
"uid": null,
"customer_since": "2024-09-11T14:22:12.160Z",
"cancelled_at": "2024-09-11T15:07:46.174Z",
"plan_name": null,
"suspicion": "no_suspicion",
"username": null,
"website": null,
"created_at": "2024-09-09T16:22:44.168Z",
"split_promotion_id": null,
"custom_fields": null,
"split_percentage_value": null,
"visitor_sub_id": null
},
"event_id": "test_sale_12340987_refund",
"conversion_amount": -1000,
"tier_level": 1,
"split_type": null
},
"lead": {
"id": 20738339,
"state": "cancelled",
"email": "hello@testmintli.com",
"uid": null,
"customer_since": "2024-09-11T14:22:12.160Z",
"cancelled_at": "2024-09-11T15:07:46.174Z",
"plan_name": null,
"suspicion": "no_suspicion",
"username": null,
"website": null,
"created_at": "2024-09-09T16:22:44.168Z",
"split_promotion_id": null,
"custom_fields": null,
"split_percentage_value": null,
"visitor_sub_id": null
},
"promoter": {
"id": 3920164,
"status": "active",
"cust_id": "",
"email": "peluwydo@mailinator.com",
"created_at": "2022-04-26T15:28:24.800Z",
"temp_password": "xxxxxxxxxx",
"default_promotion_id": 4210919,
"pref": "db1znwe",
"default_ref_id": "8yi2epelut",
"note": "This is a note",
"w8_form_url": null,
"w9_form_url": null,
"parent_promoter_id": 577918,
"earnings_balance": {
"cash": 50744
},
"current_balance": {
"cash": 20044
},
"paid_balance": {
"cash": 30700
},
"auth_token": "xxxxxxxxxxxxxx"
}
}{
"message": "Error. Amount blank or invalid."
}{
"message": "The 'refund' event with the id 'test_sale_12340987_refund' already exists."
}Tracking Api
Tracking refunds and negative commissions
Record a refund for a referred customer so FirstPromoter generates the matching negative commission.
POST
/
refund
cURL
curl --request POST \
--url https://api.firstpromoter.com/api/v2/track/refund \
--header 'Account-ID: <account-id>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"event_id": "<string>",
"amount": "<string>",
"uid": "<string>",
"currency": "<string>",
"quantity": "<string>",
"sale_event_id": "<string>",
"skip_email_notification": true
}
'import requests
url = "https://api.firstpromoter.com/api/v2/track/refund"
payload = {
"email": "<string>",
"event_id": "<string>",
"amount": "<string>",
"uid": "<string>",
"currency": "<string>",
"quantity": "<string>",
"sale_event_id": "<string>",
"skip_email_notification": True
}
headers = {
"Account-ID": "<account-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Account-ID': '<account-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: '<string>',
event_id: '<string>',
amount: '<string>',
uid: '<string>',
currency: '<string>',
quantity: '<string>',
sale_event_id: '<string>',
skip_email_notification: true
})
};
fetch('https://api.firstpromoter.com/api/v2/track/refund', 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.firstpromoter.com/api/v2/track/refund",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => '<string>',
'event_id' => '<string>',
'amount' => '<string>',
'uid' => '<string>',
'currency' => '<string>',
'quantity' => '<string>',
'sale_event_id' => '<string>',
'skip_email_notification' => true
]),
CURLOPT_HTTPHEADER => [
"Account-ID: <account-id>",
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.firstpromoter.com/api/v2/track/refund"
payload := strings.NewReader("{\n \"email\": \"<string>\",\n \"event_id\": \"<string>\",\n \"amount\": \"<string>\",\n \"uid\": \"<string>\",\n \"currency\": \"<string>\",\n \"quantity\": \"<string>\",\n \"sale_event_id\": \"<string>\",\n \"skip_email_notification\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Account-ID", "<account-id>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.firstpromoter.com/api/v2/track/refund")
.header("Account-ID", "<account-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"event_id\": \"<string>\",\n \"amount\": \"<string>\",\n \"uid\": \"<string>\",\n \"currency\": \"<string>\",\n \"quantity\": \"<string>\",\n \"sale_event_id\": \"<string>\",\n \"skip_email_notification\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firstpromoter.com/api/v2/track/refund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Account-ID"] = '<account-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"<string>\",\n \"event_id\": \"<string>\",\n \"amount\": \"<string>\",\n \"uid\": \"<string>\",\n \"currency\": \"<string>\",\n \"quantity\": \"<string>\",\n \"sale_event_id\": \"<string>\",\n \"skip_email_notification\": true\n}"
response = http.request(request)
puts response.read_body{
"id": 33847726,
"type": "refund",
"amount_cents": -1000,
"reward": {
"id": 10940148,
"status": "approved",
"amount": -200,
"unit": "cash",
"created_at": "2024-09-11T14:36:01.016Z",
"lead": {
"id": 20738339,
"state": "cancelled",
"email": "hello@testmintli.com",
"uid": null,
"customer_since": "2024-09-11T14:22:12.160Z",
"cancelled_at": "2024-09-11T15:07:46.174Z",
"plan_name": null,
"suspicion": "no_suspicion",
"username": null,
"website": null,
"created_at": "2024-09-09T16:22:44.168Z",
"split_promotion_id": null,
"custom_fields": null,
"split_percentage_value": null,
"visitor_sub_id": null
},
"event_id": "test_sale_12340987_refund",
"conversion_amount": -1000,
"tier_level": 1,
"split_type": null
},
"lead": {
"id": 20738339,
"state": "cancelled",
"email": "hello@testmintli.com",
"uid": null,
"customer_since": "2024-09-11T14:22:12.160Z",
"cancelled_at": "2024-09-11T15:07:46.174Z",
"plan_name": null,
"suspicion": "no_suspicion",
"username": null,
"website": null,
"created_at": "2024-09-09T16:22:44.168Z",
"split_promotion_id": null,
"custom_fields": null,
"split_percentage_value": null,
"visitor_sub_id": null
},
"promoter": {
"id": 3920164,
"status": "active",
"cust_id": "",
"email": "peluwydo@mailinator.com",
"created_at": "2022-04-26T15:28:24.800Z",
"temp_password": "xxxxxxxxxx",
"default_promotion_id": 4210919,
"pref": "db1znwe",
"default_ref_id": "8yi2epelut",
"note": "This is a note",
"w8_form_url": null,
"w9_form_url": null,
"parent_promoter_id": 577918,
"earnings_balance": {
"cash": 50744
},
"current_balance": {
"cash": 20044
},
"paid_balance": {
"cash": 30700
},
"auth_token": "xxxxxxxxxxxxxx"
}
}{
"message": "Error. Amount blank or invalid."
}{
"message": "The 'refund' event with the id 'test_sale_12340987_refund' already exists."
}The refund call is similar to the sale call. It works the same way, except that it generates negative commissions.
Authorizations
Headers
Body
application/json
- Option 1
- Option 2