Node.js
import Shoply from "@shoplygg/node";
const shoply = new Shoply({ apiKey: process.env.SHOPLY_API_KEY });
const result = await shoply.affiliates.setBalance("AFFILIATE_ID", {
mode: "add",
amount: 5,
});
<?php
require 'vendor/autoload.php';
$shoply = new Shoply\Client(['apiKey' => getenv('SHOPLY_API_KEY')]);
$result = $shoply->affiliates->setBalance('AFFILIATE_ID', [
'mode' => 'add',
'amount' => 5,
]);
import shoply
client = shoply.Client() # reads SHOPLY_API_KEY
result = client.affiliates.setBalance("AFFILIATE_ID", mode="add", amount=5)
curl --request POST \
--url https://api.shoply.gg/v1/stores/{storeId}/affiliates/{affiliateId}/balance \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 5,
"note": "<string>"
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.shoply.gg/v1/stores/{storeId}/affiliates/{affiliateId}/balance"
payload := strings.NewReader("{\n \"amount\": 5,\n \"note\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.shoply.gg/v1/stores/{storeId}/affiliates/{affiliateId}/balance")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 5,\n \"note\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.shoply.gg/v1/stores/{storeId}/affiliates/{affiliateId}/balance")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 5,\n \"note\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": null,
"code": null,
"data": {
"id": "7fe2bc2a-aa86-4cd0-9322-7525740509f3",
"customerId": "f637fc21-973d-43ec-a7db-f819a9ebf73a",
"email": "ada@example.com",
"code": "ada",
"link": "https://northwind.myshoply.gg/?ref=ada",
"commission": 20,
"discount": 5,
"active": true,
"clicks": 0,
"orders": 0,
"revenue": 0,
"earned": 0,
"balance": 12.5,
"requested": 0,
"paidOut": 0,
"paidAsCredit": 0,
"joinedThemselves": false,
"dateCreated": "2026-10-22T16:20:19Z"
},
"meta": {
"totals": {
"affiliates": 1,
"on": 1,
"clicks": 0,
"orders": 0,
"revenue": 0,
"earned": 0,
"owed": 12.5,
"paidOut": 0,
"paidAsCredit": 0
},
"payouts": {
"open": 0,
"requested": 0
},
"programme": {
"enabled": true,
"defaultCommission": 10,
"defaultDiscount": 5,
"selfSignup": false,
"ownLinks": false,
"toStore": true,
"payouts": true
},
"referred": 0,
"limit": 500,
"limits": {
"commission": 90,
"discount": 90,
"code": 40
},
"currencyCode": "USD",
"home": "https://northwind.myshoply.gg"
}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}Affiliates
Change an affiliate's balance
Adds to, takes from or sets what an affiliate is owed. Send an Idempotency-Key with this request.
Needs the affiliates.payouts permission (Answer Payouts).
POST
/
stores
/
{storeId}
/
affiliates
/
{affiliateId}
/
balance
Node.js
import Shoply from "@shoplygg/node";
const shoply = new Shoply({ apiKey: process.env.SHOPLY_API_KEY });
const result = await shoply.affiliates.setBalance("AFFILIATE_ID", {
mode: "add",
amount: 5,
});
<?php
require 'vendor/autoload.php';
$shoply = new Shoply\Client(['apiKey' => getenv('SHOPLY_API_KEY')]);
$result = $shoply->affiliates->setBalance('AFFILIATE_ID', [
'mode' => 'add',
'amount' => 5,
]);
import shoply
client = shoply.Client() # reads SHOPLY_API_KEY
result = client.affiliates.setBalance("AFFILIATE_ID", mode="add", amount=5)
curl --request POST \
--url https://api.shoply.gg/v1/stores/{storeId}/affiliates/{affiliateId}/balance \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 5,
"note": "<string>"
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.shoply.gg/v1/stores/{storeId}/affiliates/{affiliateId}/balance"
payload := strings.NewReader("{\n \"amount\": 5,\n \"note\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.shoply.gg/v1/stores/{storeId}/affiliates/{affiliateId}/balance")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 5,\n \"note\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.shoply.gg/v1/stores/{storeId}/affiliates/{affiliateId}/balance")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 5,\n \"note\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": null,
"code": null,
"data": {
"id": "7fe2bc2a-aa86-4cd0-9322-7525740509f3",
"customerId": "f637fc21-973d-43ec-a7db-f819a9ebf73a",
"email": "ada@example.com",
"code": "ada",
"link": "https://northwind.myshoply.gg/?ref=ada",
"commission": 20,
"discount": 5,
"active": true,
"clicks": 0,
"orders": 0,
"revenue": 0,
"earned": 0,
"balance": 12.5,
"requested": 0,
"paidOut": 0,
"paidAsCredit": 0,
"joinedThemselves": false,
"dateCreated": "2026-10-22T16:20:19Z"
},
"meta": {
"totals": {
"affiliates": 1,
"on": 1,
"clicks": 0,
"orders": 0,
"revenue": 0,
"earned": 0,
"owed": 12.5,
"paidOut": 0,
"paidAsCredit": 0
},
"payouts": {
"open": 0,
"requested": 0
},
"programme": {
"enabled": true,
"defaultCommission": 10,
"defaultDiscount": 5,
"selfSignup": false,
"ownLinks": false,
"toStore": true,
"payouts": true
},
"referred": 0,
"limit": 500,
"limits": {
"commission": 90,
"discount": 90,
"code": 40
},
"currencyCode": "USD",
"home": "https://northwind.myshoply.gg"
}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}Authorizations
A secret API key, made under Developers in the dashboard: Authorization: Bearer shoply_sk_...
Headers
A word of your own for this one change, up to 180 letters, digits, dots, dashes, underscores and colons. Sent again with the same key, the request is not carried out twice: the first answer comes back, with Idempotent-Replay: true.
Path Parameters
The store's ID. A key reaches the store it was made in: GET /key answers which.
The affiliate.
Body
application/json

