Laravel
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 require deakee/loyalty-laravel2 つの統合モード
同じプラグインコードが両モードをサポート。今日は OAuth2 モードで開始し、後で設定切り替えでブリッジを追加 — データ移行不要。
あなたの DB に集中型ロイヤルティ、OAuth2 で Deakee と同期。チェーンもエクスチェンジも使いません — でも顧客は Deakee で残高を見られ、Deakee バウチャーを受け取れます。
- 現在の deakee.com/api/oauth/* バックエンドで動作。
- トークン無し、発行者としての法的リスク無し。
- 設定切り替えでブリッジモードにアップグレード可能。
ERC-8063 コントラクトをデプロイ。顧客は集中型残高をオンチェーントークンに変換し、Deakee エクスチェンジで取引できます。
- エクスチェンジ上場とクロスブランド引き換えを追加。
- Deakee リレイヤーが必要(未公開)。
- OAuth2 モードと同じプラグインコード — 準備ができたら有効化。
インストール
- composer require deakee/loyalty-laravel
- php artisan migrate
- Set DEAKEE_API_KEY in .env, run php artisan deakee:deploy-token (one-time).
- Call DeakeeLoyalty::credit() in your order-complete logic.
- 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 は顧客ごとに 1 回、ウォレットアドレスの取得に使用されます(スコープ:identity のみ)。
| 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 |
適合性を検証
本番公開の前に公式の適合性検証ツールを実行してください。集中型台帳、identity OAuth フロー、ブリッジの mint/burn 接続、冪等性を検査します。
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 を開いてください。