← 所有集成
Tier 2 — Full Deakee partner

Laravel

Laravel 10+ (any e-commerce layer)

For Laravel apps with their own checkout (Bagisto, Aimeos, custom). Publishes migrations for `deakee_loyalty_members` + `deakee_loyalty_transactions`, exposes a `DeakeeLoyalty` facade, fires `DeakeeLoyaltyEarned` + `DeakeeLoyaltyWithdrawn` events.

Composer
composer require deakee/loyalty-laravel
在 GitHub 查看源代码 →

两种集成模式

同一插件代码支持两种模式。今天先以 OAuth2 模式启动;日后通过配置切换加入桥接层 — 无需数据迁移。

OAuth2 模式
计划中

你的数据库中维护中心化忠诚度,通过 OAuth2 同步到 Deakee。不上链、不进交易所 — 但客户可在 Deakee 中查看余额,你可接受 Deakee 凭证。

  • 对接当前的 deakee.com/api/oauth/* 后端。
  • 无代币、无作为发行者的法律风险。
  • 通过配置切换即可升级到桥接模式。
桥接模式
计划中

部署 ERC-8063 合约;客户可将中心化余额铸造为链上代币,并在 Deakee 交易所交易。

  • 增加交易所上市和跨品牌兑换。
  • 需要 Deakee 中继器(尚未发布)。
  • 与 OAuth2 模式同一套插件代码 — 准备好时再启用。

安装

  1. composer require deakee/loyalty-laravel
  2. php artisan migrate
  3. Set DEAKEE_API_KEY in .env, run php artisan deakee:deploy-token (one-time).
  4. Call DeakeeLoyalty::credit() in your order-complete logic.
  5. Mount the bridge routes (one line in your routes file) to expose withdraw/deposit endpoints.

示例

use Deakee\Loyalty\Facades\DeakeeLoyalty;

// Centralized earn — no chain:
DeakeeLoyalty::members()->credit(
    userId: $order->user_id,
    points: DeakeeLoyalty::computePoints($order->total_cents),
    reference: "order_{$order->id}",
);

// User-initiated bridge (called from the customer's
// "Send to Deakee" form):
DeakeeLoyalty::bridge()->withdraw($user, $amount);

Deakee 如何连接到你的插件

你的合作伙伴 API 密钥用于向 Deakee 中继器认证调用。OAuth2 authorize/token URL 每个客户使用一次,用于获取钱包地址(范围:仅 identity)。

authorize_urlhttps://deakee.com/oauth2/authorize (scope=identity)
token_urlhttps://deakee.com/oauth2/token
api_base_urlhttps://deakee.com/api/relayer/v1

验证合规性

上线前,针对你的部署运行官方一致性验证器。它会检查中心化账本、identity OAuth 流程、桥接铸造/销毁连接以及幂等性。

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.com

遇到问题?阅读完整的 README 或在 github.com/deakee/loyalty/issues 提交 issue。