# Sell from a supplier

> Sell a supplier's keys, gift cards and top-ups without holding stock: connect your supplier account, map your products, and ShopFast orders and delivers each paid order.

Source: https://shopfa.st/docs/plugins/suppliers

A supplier plugin lets you sell what a supplier has without buying stock first. When an order is paid, ShopFast places
the order in **your own account** at the supplier, waits for it when it takes a while, and delivers the code or the
top-up result to your buyer. ShopFast makes three of them:

- [Sonofutred](https://shopfa.st/docs/plugins/sonofutred): game top-ups, gift cards and keys.
- [BuyCards](https://shopfa.st/docs/plugins/buycards): gift cards.
- [Fazer (FZR)](https://shopfa.st/docs/plugins/fazer): gift cards, game keys, top-ups, Steam gifts and Telegram Stars.

You need an account with a balance at the supplier, and a ShopFast plan with developer tools.

> Supplier plugins are being turned on store by store. If you don't see them in the marketplace, ask ShopFast support to
> turn on supplier plugins for your store.

## Set it up

1. **Install it.** In **Settings → Developers → Plugins**, open the marketplace, choose the **Suppliers** category and
   install the plugin. It arrives as a draft: nothing runs yet.
2. **Approve what it may do.** The plugin page lists it in plain words: the supplier's address it calls, the secret
   you enter, its own small data store, and sending from ShopFast's fixed address. The owner or an admin approves.
3. **Allow ShopFast's address at the supplier.** All three suppliers only take calls from addresses on your allow-list
   (they call it an IP whitelist). The plugin's **Setup** tab shows ShopFast's address. Add it to the allow-list of your
   API key at the supplier **before** you connect. ShopFast tells you beforehand if this address ever changes.
4. **Enter your key.** Also on **Setup**. It is encrypted, only read inside the plugin's run and never shown again.
5. **Press Connect.** ShopFast checks the key and the address with the supplier, shows the account and its balance, and
   starts reading the supplier's catalog. A large catalog takes a few minutes the first time.
6. **Map your products.** On the **Products** tab, pick one of your products (or one option of it) on the left and the
   supplier's item on the right. You see what it costs you, your price and your margin. ShopFast suggests matches by
   name, and you can accept many at once.
7. **Test.** The **Tests** tab runs the plugin against example answers from the supplier. No real order is placed.
8. **Turn it on.** From then on every paid order of a mapped product is ordered at the supplier.

You can do steps 5 and 6 before the plugin is on, so everything is mapped the moment you go live.

## Mapping

- **One product, several items.** A product or option can deliver more than one supplier item: a "$100 card" as two
  $50 cards, or as a $50, a $30 and a $20 card. Each item is ordered, retried and delivered on its own, and the buyer
  gets all the codes together.
- **Details the buyer must give.** A top-up needs a player ID, and sometimes a server or a zone. The supplier's item
  says which. Press **Add these questions** and ShopFast adds them to the product's checkout and connects each to the
  supplier's field.
- **From the product editor.** With a supplier plugin connected, the product editor offers **Deliver from** the plugin:
  search the supplier's catalog and pick the item while you create the product.
- **Stock.** A mapped product sells from the supplier. It needs no keys of its own, and it is sold out only when the
  supplier's item is gone, turned off or out of stock at the last catalog read.
- **Fresh catalog.** ShopFast reads the catalog again every few hours. **Sync now** reads it at once.
- **Problems are flagged.** The Products tab marks a mapping whose item is gone or unavailable, one that costs more than
  your price, and one that still needs a question.

## Before the buyer pays

The plugin checks what it can before any money moves, and the buyer sees the message at the field it is about:

- a player ID or username that cannot be right;
- a detail the supplier needs that your checkout does not ask for yet;
- at BuyCards, whether the card is still in stock right now;
- at Fazer, whether a Steam account can be topped up.

If the supplier cannot be asked at that moment, the checkout goes ahead.

## What the buyer gets

- **Codes** appear on the order page and in the receipt as soon as the supplier returns them.
- **Top-ups** show a short "complete" message with the supplier's reference.
- **Slow orders.** If the supplier needs time, the order page says it is being prepared. When it arrives, the buyer
  gets an email with everything they bought.
- Buyers never see a supplier's error text. They see neutral words, and you see the reason.

## Delivery statuses

Every order line a plugin handles has a status, on the order and under the plugin's **Deliveries** tab. Plugins that
order one unit at a time (Sonofutred and Fazer) show one status per unit.

| Status | What it means | What you do |
| --- | --- | --- |
| **Queued** | Waiting to be sent to the supplier. | Nothing. It goes out within a minute. |
| **Trying again** | The supplier could not be reached, or refused ShopFast's address or your key. ShopFast tries 8 times over about two hours. | If the reason is your key or the allow-list, fix it. The next try picks it up. |
| **At the supplier** | The supplier accepted the order and is working on it. ShopFast asks again on a schedule. | Nothing. |
| **Delivered** | The buyer has the codes or the result. | Nothing. |
| **Failed** | It will not work on its own: the supplier refused the order, or the buyer's details were wrong. | Read the reason, then **Order again**, deliver it by hand, or refund. |
| **Timed out** | The supplier accepted the order but did not finish in time. | **Retry** asks the supplier again with the same order. |
| **Cancelled** | The order was refunded before this was sent. Nothing was bought. | Nothing. |

When the supplier itself cancels or refunds an order, ShopFast orders it again on its own, twice at most. The delivery's
timeline shows each new supplier order.

## When something fails

You get a "Delivery problem" notification with the reason. Open the delivery to see its timeline and every request the
plugin made (addresses and statuses, never your key). The usual reasons:

| What you see | What to do |
| --- | --- |
| The supplier refused ShopFast's address | Add the address from the **Setup** tab to your allow-list at the supplier, then press **Check again**. |
| The supplier did not accept the key | Copy the key again from the supplier and save it on **Setup**. |
| Not enough balance | Top up at the supplier, then **Order again** on the delivery. |
| The buyer's details were not accepted | Ask the buyer for the right player ID, then **Order again** or refund. |
| The item is out of stock or gone | Map the product to another item, or refund. |
| Fewer codes arrived than were ordered | The buyer has the ones that arrived. Use **Deliver by hand** on the delivery to add the missing ones, or refund that part: the delivery shows how much of the price it is. |

**Nothing is ever bought twice.** Every supplier order carries a key that stays the same on every try. If ShopFast
never got the supplier's answer, the next try asks about that order instead of placing a new one. **Order again** on a
failed delivery is the only thing that places a new order, and it says so.

Nothing is ordered for an order that is not cleared: one held for review by Fraud Shield, a test order, an unpaid
checkout, or an order that was refunded.

## Balance and alerts

The plugin's **Overview** shows what you have left at the supplier. ShopFast reads it every 30 minutes, after you
connect, and right after a delivery fails.

Set a **low-balance alert** there: type an amount, and you are told once each time your balance falls below it. Top up
at the supplier and the alert is ready again.

ShopFast also checks the connection once a day, and right away when a delivery cannot reach the supplier. You are
told once when it stops working, for example after a key was replaced at the supplier or ShopFast's address was taken
off its allow-list. Orders keep waiting and are tried again meanwhile; when you press **Check again** and the
connection works, the waiting ones go out at once.

## Turning it off

While the plugin is off, orders for its products wait. They are never marked delivered with nothing, and they go out
when you turn it on again. A mapped product goes back to its own stock while the plugin is off.
