Node.js
import { ShoplyCustomer } from "@shoplygg/node";
const buyer = new ShoplyCustomer({ storeId: "YOUR_STORE_ID", token });
const result = await buyer.affiliate.join();<?php
require 'vendor/autoload.php';
$buyer = new Shoply\Customer(['storeId' => 'YOUR_STORE_ID', 'token' => $token]);
$result = $buyer->affiliate->join();
import shoply
buyer = shoply.Customer("YOUR_STORE_ID", token=token)
result = buyer.affiliate.join()
curl --request POST \
--url https://api.shoply.gg/v1/stores/{storeId}/customer/affiliate/join \
--header 'Authorization: Bearer <token>'package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.shoply.gg/v1/stores/{storeId}/customer/affiliate/join"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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/join")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.shoply.gg/v1/stores/{storeId}/customer/affiliate/join")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
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": "d9dec652",
"link": "https://northwind.myshoply.gg/?ref=d9dec652",
"linkStart": "https://northwind.myshoply.gg/?ref=",
"commission": 10,
"discount": 5,
"clicks": 0,
"orders": 0,
"earned": {
"amount": 0,
"currencyCode": "USD"
},
"balance": {
"amount": 0,
"currencyCode": "USD"
},
"paidOut": {
"amount": 0,
"currencyCode": "USD"
},
"can": {
"editLink": true,
"toStore": true,
"payouts": true
},
"payout": null,
"payouts": [],
"changes": [],
"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
Join the affiliate programme
Makes the buyer an affiliate at the store’s own rates, with a link that works at once, where the store lets buyers join. Answers the affiliate page.
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
/
join
Node.js
import { ShoplyCustomer } from "@shoplygg/node";
const buyer = new ShoplyCustomer({ storeId: "YOUR_STORE_ID", token });
const result = await buyer.affiliate.join();<?php
require 'vendor/autoload.php';
$buyer = new Shoply\Customer(['storeId' => 'YOUR_STORE_ID', 'token' => $token]);
$result = $buyer->affiliate->join();
import shoply
buyer = shoply.Customer("YOUR_STORE_ID", token=token)
result = buyer.affiliate.join()
curl --request POST \
--url https://api.shoply.gg/v1/stores/{storeId}/customer/affiliate/join \
--header 'Authorization: Bearer <token>'package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.shoply.gg/v1/stores/{storeId}/customer/affiliate/join"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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/join")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.shoply.gg/v1/stores/{storeId}/customer/affiliate/join")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
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": "d9dec652",
"link": "https://northwind.myshoply.gg/?ref=d9dec652",
"linkStart": "https://northwind.myshoply.gg/?ref=",
"commission": 10,
"discount": 5,
"clicks": 0,
"orders": 0,
"earned": {
"amount": 0,
"currencyCode": "USD"
},
"balance": {
"amount": 0,
"currencyCode": "USD"
},
"paidOut": {
"amount": 0,
"currencyCode": "USD"
},
"can": {
"editLink": true,
"toStore": true,
"payouts": true
},
"payout": null,
"payouts": [],
"changes": [],
"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.

