Quickstart
Create a checkout from your server and watch it get paid. About ten minutes.
By the end of this page your server will create a real Swop checkout for one of your products, a buyer will pay it, and you'll see it flip to paid.
Real money
Swop has no sandbox yet, so this quickstart moves real (small) amounts. Use a cheap product of your own and pay it from a different wallet than the one that owns the store.
What you need
- A Swop account with at least one product listed. Create one in the Swop app.
- A server you control (Node 18+, Python 3.9+ or anything that can make HTTPS requests).
1. Create an API key
- Open the Swop web app and go to Dashboard → Developer (
swopme.app/dashboard/developer). - Under Create an API key, give it a name and tick
commerce.readandcommerce.checkout. - Copy the secret. It starts with
swop_sk_and is shown once.
Store it in an environment variable on your server, never in browser code:
export SWOP_MERCHANT_KEY="swop_sk_..."2. Check the key works
curl https://apps.apiswop.co/api/v5/merchant/me \
-H "Authorization: Bearer $SWOP_MERCHANT_KEY"{
"state": "success",
"data": {
"merchant": { "id": "65f0c1…", "name": "Acme", "ens": "acme.swop.id" },
"keyId": "mk_Q3x…",
"effectiveScopes": ["commerce.read", "commerce.checkout"],
"cardEnabled": false
}
}effectiveScopes is what the key can do right now. cardEnabled: false just means buyers will pay in USDC; that's fine for this quickstart.
3. Find a product ID
curl "https://apps.apiswop.co/api/v5/merchant/products?limit=5" \
-H "Authorization: Bearer $SWOP_MERCHANT_KEY"Copy the _id of a cheap digital product (digital products need no shipping address, which keeps this short).
4. Create a checkout
Send the product ID and a quantity. Never send a price: Swop prices every item from your catalogue, and a request that includes price, amount or unitPrice on an item is rejected.
curl -X POST https://apps.apiswop.co/api/v5/merchant/checkout-intents \
-H "Authorization: Bearer $SWOP_MERCHANT_KEY" \
-H "Content-Type: application/json" \
-d '{ "items": [ { "productId": "PRODUCT_ID", "quantity": 1 } ] }'The response (201) is the checkout. Three fields matter now:
| Field | What it is |
|---|---|
intentId | The checkout's ID, like co_7Hk2mPq9xR4s. Save it with your order. |
fees.totalDueAmount | What the buyer pays, in USDC. Show this. |
paymentRequest.url | A solana: payment link for USDC. Any Solana wallet can open it. |
5. Pay it
Turn paymentRequest.url into a QR code (or open it on a phone with a Solana wallet) and pay from a different wallet. Swop watches the blockchain and records the payment by itself; there's nothing to confirm.
6. See it paid
curl https://apps.apiswop.co/api/v5/merchant/checkout-intents/co_7Hk2mPq9xR4s \
-H "Authorization: Bearer $SWOP_MERCHANT_KEY"When status is paid, the order exists, the buyer has a receipt, and the sale shows in your Swop app. That's a working integration.