SDK
For custom stacks, headless setups, or anything that doesn't fit a packaged plugin. Provides the canonical centralized-loyalty primitives (member balances, transaction log, refund clawback) plus the relayer client for bridging on-chain.
npm install @deakee/loyalty-sdkTwo integration modes
The same plugin code supports both modes. Start in OAuth2 mode today; layer in the bridge later as a config flip — no data migration.
Centralized loyalty in your DB synced to Deakee via OAuth2. No chain, no exchange — but customers see balances in Deakee and you can accept Deakee vouchers.
- Works against today's deakee.com/api/oauth/* backend.
- No tokens, no legal exposure as an issuer.
- Upgrades to bridge mode in one config flip.
Deploy an ERC-8063 contract; customers can mint centralized balance to on-chain tokens and trade them on the Deakee exchange.
- Adds exchange listing and cross-brand redemption.
- Requires the Deakee relayer (not yet shipped).
- Same plugin code as OAuth2 mode — opt in when ready.
Install
- npm install @deakee/loyalty-sdk
- Run the published migrations against your DB to create the loyalty tables.
- Use members.credit() in your order-complete logic; bridge.withdraw() from your customer-account UI.
- Mount the identity OAuth callback route so customers can link their Deakee wallet.
Example
import { DeakeeLoyalty } from "@deakee/loyalty-sdk";
const loyalty = new DeakeeLoyalty({
apiKey: process.env.DEAKEE_API_KEY,
contractAddress: process.env.DEAKEE_CONTRACT,
db: myKnexInstance,
});
// Centralized earn:
await loyalty.members.credit({
userId, points: 50, reference: `order_${id}`,
});
// User-initiated bridge to chain:
await loyalty.bridge.withdraw({ userId, amount: 500 });How Deakee connects to your plugin
Your partner API key authenticates calls to the Deakee relayer. The OAuth2 authorize/token URLs are used once per customer to fetch the wallet address (scope: identity only).
| authorize_url | https://deakee.com/oauth2/authorize (scope=identity) |
| token_url | https://deakee.com/oauth2/token |
| api_base_url | https://deakee.com/api/relayer/v1 |
Verify conformance
Before going live, run the official conformance verifier against your deployment. It checks the centralized ledger, identity OAuth flow, bridge mint/burn wiring, and idempotency.
npx @deakee/loyalty-verifier \
--partner-api-key <your key> \
--plugin-url <your plugin URL> \
--contract-address <your ERC-8063 contract> \
--test-user-email test@example.comStuck? Read the full README or open an issue at github.com/deakee/loyalty/issues.