Connect your web app
Configure rewards, complete app approval, prepay any network points and create a server API key in Rewards and settlement. Keep that key in your backend. Users claim a referral offer on Shoploop, then provide their claim code in your app. Match their verified account email before confirming the order.
import { createHash } from "node:crypto";
const response = await fetch("https://shoploop.dev/api/network/events", {
method: "POST",
headers: { "Authorization": "Bearer " + process.env.SHOPLOOP_API_KEY,
"Content-Type": "application/json" },
body: JSON.stringify({
eventId: "purchase:" + order.id, // persist and reuse on every retry
type: "purchase.confirmed",
orderId: order.id,
claimCode: order.shoploopClaimCode,
customerEmailHash: createHash("sha256")
.update(customer.verifiedEmail.trim().toLowerCase()).digest("hex"),
amountCents: order.settledTotalCents,
currency: "USD"
})
});
if (!response.ok) throw new Error(await response.text());
const result = await response.json();Call only after a verified paid order. Retry transport failures using the exact same event ID and payload. A different payload under the same ID is rejected. Deliver purchase confirmation before its refund. Store failed deliveries in a durable queue.
Refunds and redemption
purchase.refunded takes an eventId and the original orderId. Any purchase refund reverses the qualifying reward; partial refunds are conservatively treated the same. Previously spent funded points remain a cost to the issuing app.
voucher.redeem takes eventId, orderId, voucherCode, customerEmailHash, amountCents and currency. The value must fit the eligible purchase and the voucher must belong to that verified customer. Redemption is atomic and creates merchant settlement jobs. Apply the discount only after success; use durable reconciliation if your order fails after redemption.
voucher.refund takes eventId and voucherCode. It cancels an unattempted settlement or reverses a completed transfer before returning points to the customer. Unknown transfer outcomes remain reserved until reconciled. Partial voucher refunds are not supported in this pilot: return the full voucher value and handle the remaining cash refund in your app.
Before enabling checkout
Connect a US settlement account to accept network points. Opting out stops new vouchers while preserving existing promises. Offer terms must distinguish promotional app credit from funded network points. Native in-app digital rewards are outside this web pilot.