Online store — Passtastic API
☰
Passtastic
Explore
Product
Pricing
Use Cases
Customer Stories
Help
No account yet? Sign up free

Online store

Enroll a shopper on checkout, award points when their order is paid, and keep their wallet pass in sync with refunds — four calls into your existing order flow.

Enroll at checkout or sign-up

Call this from your checkout's order-confirmation step, or your account sign-up flow. It is safe to call on every order — a returning shopper is matched by email rather than duplicated (see result/matchedBy below).

bash
curl -X POST https://api.passtastic.io/api/v1/customers \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "externalCustomerId": "shop_customer_9001",
    "cardId": "64f1c2a9b8e4a2d1c0a1b2c3",
    "name": "Jamie Cole",
    "email": "jamie@example.com"
  }'
json
{
  "passUserId": "66a1e2f3c9d4b5a6f7081920",
  "externalCustomerId": "shop_customer_9001",
  "cardId": "64f1c2a9b8e4a2d1c0a1b2c3",
  "result": "created",
  "matchedBy": null,
  "linked": true,
  "installUrl": "https://passtastic.io/get-pass/64f1c2a9b8e4a2d1c0a1b2c3?code=8K3F2Q",
  "status": "pending_install"
}

Put installUrl in the order-confirmation email — opening it on a phone adds the card to Apple or Google Wallet. Nothing to build on your side; the pass itself is served by Passtastic.

Earn when an order is paid

Trigger this from your payment-succeeded webhook, not from checkout submission — an order can still fail payment or be abandoned between the two. Use from: "spend" for the order total, and set Idempotency-Key to the order id so a retried payment webhook never double-awards the same order.

bash
curl -X POST https://api.passtastic.io/api/v1/customers/email:jamie@example.com/earn \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-58210" \
  -d '{
    "type": "points",
    "from": "spend",
    "spend": { "amount": 64.00, "currency": "EUR" },
    "note": "Order #58210"
  }'

Refunds

A refund is a negative balanceCorrection on adjust — use the order id for Idempotency-Key (a distinct key from the earn call above, since they're different writes) so a retried refund webhook can never withdraw twice. balanceCorrection must be non-zero — a partial refund is the actual points/stamps that order earned, negated, not the full order value.

bash
curl -X POST https://api.passtastic.io/api/v1/customers/email:jamie@example.com/adjust \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-58210-refund" \
  -d '{
    "balanceCorrection": -64,
    "note": "Refund for order #58210"
  }'

Show the balance in the account page

Read the same customer back to show their stamps, points, or level next to their order history.

bash
curl https://api.passtastic.io/api/v1/customers/email:jamie@example.com \
  -H "X-Api-Key: YOUR_API_KEY"
json
{
  "externalCustomerId": "shop_customer_9001",
  "passUserId": "66a1e2f3c9d4b5a6f7081920",
  "cardId": "64f1c2a9b8e4a2d1c0a1b2c3",
  "cardType": "point_card",
  "balance": { "points": 245 },
  "installed": true,
  "installUrl": "https://passtastic.io/get-pass/64f1c2a9b8e4a2d1c0a1b2c3"
}