Node.js
import { ShoplyCustomer } from "@shoplygg/node";
const buyer = new ShoplyCustomer({ storeId: "YOUR_STORE_ID", token });
const result = await buyer.affiliate.toStore({
amount: 10,
});<?php
require 'vendor/autoload.php';
$buyer = new Shoply\Customer(['storeId' => 'YOUR_STORE_ID', 'token' => $token]);
$result = $buyer->affiliate->toStore([
'amount' => 10,
]);
import shoply
buyer = shoply.Customer("YOUR_STORE_ID", token=token)
result = buyer.affiliate.toStore(amount=10)
curl --request POST \
--url https://api.shoply.gg/v1/stores/{storeId}/customer/affiliate/to-store \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"amount": 10
}'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.shoply.gg/v1/stores/{storeId}/customer/affiliate/to-store"
payload := strings.NewReader("{\n \"amount\": 10\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}/customer/affiliate/to-store")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.shoply.gg/v1/stores/{storeId}/customer/affiliate/to-store")
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\": 10\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": null,
"code": null,
"data": {
"member": true,
"canJoin": false,
"offered": {
"commission": 10,
"discount": 5
},
"active": true,
"code": "ada-keys",
"link": "https://northwind.myshoply.gg/?ref=ada-keys",
"linkStart": "https://northwind.myshoply.gg/?ref=",
"commission": 20,
"discount": 5,
"clicks": 0,
"orders": 0,
"earned": {
"amount": 0,
"currencyCode": "USD"
},
"balance": {
"amount": 10,
"currencyCode": "USD"
},
"paidOut": {
"amount": 2.5,
"currencyCode": "USD"
},
"can": {
"editLink": true,
"toStore": true,
"payouts": true
},
"payout": null,
"payouts": [
{
"id": "76868d15-1286-4aa1-9181-1034971e5bf9",
"amount": 5,
"currencyCode": "USD",
"details": "PayPal: ada@example.com",
"status": "cancelled",
"note": "",
"dateRequested": "2026-10-22T16:20:19Z",
"dateResolved": "2026-10-22T16:20:19Z"
}
],
"changes": [
{
"id": "c361a8c7-ee27-47f5-bcc2-3cfaf711a33f",
"kind": "to_store",
"amount": -2.5,
"balanceAfter": 10,
"currencyCode": "USD",
"dateCreated": "2026-10-22T16:20:19Z"
},
{
"id": "b62b44da-fd66-4e5c-a1e0-4c7fa260fbd6",
"kind": "payout_back",
"amount": 5,
"balanceAfter": 12.5,
"currencyCode": "USD",
"dateCreated": "2026-10-22T16:20:19Z"
}
],
"limits": {
"codeMin": 2,
"codeMax": 40,
"details": 300
}
}
}{
"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": {}
}Customer API
Move commission to store balance
Moves commission from the affiliate balance to the buyer’s store balance, to spend at checkout, where the store allows it.
Needs the buyer’s token: Authorization: Bearer shoply_ct_..., from Sign in with the code.
It is counted for the buyer’s token: 30 changes in ten minutes.
POST
/
stores
/
{storeId}
/
customer
/
affiliate
/
to-store
Node.js
import { ShoplyCustomer } from "@shoplygg/node";
const buyer = new ShoplyCustomer({ storeId: "YOUR_STORE_ID", token });
const result = await buyer.affiliate.toStore({
amount: 10,
});<?php
require 'vendor/autoload.php';
$buyer = new Shoply\Customer(['storeId' => 'YOUR_STORE_ID', 'token' => $token]);
$result = $buyer->affiliate->toStore([
'amount' => 10,
]);
import shoply
buyer = shoply.Customer("YOUR_STORE_ID", token=token)
result = buyer.affiliate.toStore(amount=10)
curl --request POST \
--url https://api.shoply.gg/v1/stores/{storeId}/customer/affiliate/to-store \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"amount": 10
}'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.shoply.gg/v1/stores/{storeId}/customer/affiliate/to-store"
payload := strings.NewReader("{\n \"amount\": 10\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}/customer/affiliate/to-store")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.shoply.gg/v1/stores/{storeId}/customer/affiliate/to-store")
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\": 10\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": null,
"code": null,
"data": {
"member": true,
"canJoin": false,
"offered": {
"commission": 10,
"discount": 5
},
"active": true,
"code": "ada-keys",
"link": "https://northwind.myshoply.gg/?ref=ada-keys",
"linkStart": "https://northwind.myshoply.gg/?ref=",
"commission": 20,
"discount": 5,
"clicks": 0,
"orders": 0,
"earned": {
"amount": 0,
"currencyCode": "USD"
},
"balance": {
"amount": 10,
"currencyCode": "USD"
},
"paidOut": {
"amount": 2.5,
"currencyCode": "USD"
},
"can": {
"editLink": true,
"toStore": true,
"payouts": true
},
"payout": null,
"payouts": [
{
"id": "76868d15-1286-4aa1-9181-1034971e5bf9",
"amount": 5,
"currencyCode": "USD",
"details": "PayPal: ada@example.com",
"status": "cancelled",
"note": "",
"dateRequested": "2026-10-22T16:20:19Z",
"dateResolved": "2026-10-22T16:20:19Z"
}
],
"changes": [
{
"id": "c361a8c7-ee27-47f5-bcc2-3cfaf711a33f",
"kind": "to_store",
"amount": -2.5,
"balanceAfter": 10,
"currencyCode": "USD",
"dateCreated": "2026-10-22T16:20:19Z"
},
{
"id": "b62b44da-fd66-4e5c-a1e0-4c7fa260fbd6",
"kind": "payout_back",
"amount": 5,
"balanceAfter": 12.5,
"currencyCode": "USD",
"dateCreated": "2026-10-22T16:20:19Z"
}
],
"limits": {
"codeMin": 2,
"codeMax": 40,
"details": 300
}
}
}{
"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 buyer's token, from Sign in with the code: Authorization: Bearer shoply_ct_.... It reaches that buyer's own orders at one store, and no route that takes a key.
Path Parameters
The store's ID, from Settings, General in its dashboard. It is not a secret: a page may show it.
Body
application/json
How much, in the store's currency, up to their affiliate balance.
Example:
10

