Skip to main content
Every store has a customer panel on its myshoply.gg address, where a buyer signs in with a code sent to their email. You do not have to use it. If buyers sign in on your own site, your server can show them the same things, and let an affiliate do what the panel lets them do, with an API key.
Rather have Shoply sign buyers in for you, with the code it emails, and ask from their own browser or app with no server of yours in between? That is the Customer API.

How it fits together

  1. A buyer signs in with you. How is yours: a code you email them, a password, Discord. Shoply has no part in it.
  2. Your server, which now knows their email address, asks the API with your key.
  3. Your page shows what came back.
The key stays on your server and never reaches a page. It can read every customer of the store, so your server is what decides whose orders a visitor sees: ask only with the address your own sign-in proved, never with one the browser sent.

The key

Give it only what your panel does.

Who the buyer is to the store

List customers with search set to their address. The search matches part of an address, so take the one whose emailAddress is exactly theirs. Keep its id: everything else asks by it. Somebody who has never ordered is not a customer yet. Create a customer adds them, and answers the one there is when the address is already known.

Their orders, and what they were sent

Get a customer answers their orders with their balance. For one order in full, get the order: each of its items has what was delivered, the license keys in deliveredKeys and your message in deliveryInstructions. Show a buyer only orders whose email is their own address.

Their balance

balance on the customer is what they can spend at your checkout, and balanceHistory is how it got there. To add to it yourself, for a reward or a giveaway, change the customer’s balance.

An affiliate page

The programme has to be switched on. Its four switches for what an affiliate may do hold here as well: what is off is refused, whoever asks. A code that is already somebody’s is refused at code, so your page can say it is taken. A payout is a request and a record: Shoply sends no money. You pay it yourself and mark it paid, or decline it with a reason, in the dashboard or with answer a payout request. An affiliate’s link is an address of your own site with ?ref= and their code. A page that loads shoply.js, the embed or the Checkout Kit notices it and carries it to the checkout, where the buyer’s discount and the affiliate’s commission are worked out. You do not look the code up yourself.

Hear of it instead of asking

A webhook tells your server as things happen, so a page does not have to ask each time it is opened.

Keep what you can

A key’s budget is its own, not each visitor’s: see rate limits. Keep a buyer’s orders for a minute or two, or until a webhook says something changed, in place of asking on every page.