本文へ移動
    hazBasehazBaseDocs
    HTTP API / WALLET CLIENT

    payX402WithHazbaseWallet

    @hazbase/kit/walletが呼び出すHTTP APIのパス・引数・レスポンスを確認できます。認証・パスキーなどの追加APIは、認証SDKのリファレンスと実装ガイドで扱います。

    https://api.hazbase.com@hazbase/kit 0.9.0JSON

    APIごとに、利用者セッション・署名・操作権限の要件が異なります。以下の仕様と、利用するAPI環境の接続条件を確認してください。 APIの利用方法を確認

    POST /api/payments/x402/hazbase-wallet/pay

    リクエスト

    @hazbase/kit/wallet
    payX402WithHazbaseWallet(input: PayX402WithHazbaseWalletInput): Promise<X402HazbaseWalletPaymentResult>
    emailSessionをAuthorization: Bearerヘッダーに設定します。

    deviceBindingIdとhighTrustTokenによる操作承認が必要です。

    項目必須送信先
    emailSessionstring必須Authorization header
    paymentRequestIdstring必須JSON body
    smartAccountAddressstring必須JSON body
    deviceBindingIdstring必須JSON body
    highTrustTokenstring必須JSON body
    accountSaltstring任意JSON body
    waitForReceiptboolean任意JSON body
    expectedAmountAtomicstring任意JSON body
    expectedPayTostring任意JSON body
    endpointstring任意SDKの接続パス上書き

    POSTではContent-Type: application/jsonとx-request-idを付与します。x-request-idは処理の追跡用で、API全体の冪等性を保証するものではありません。

    レスポンス

    typescript
    export type X402HazbaseWalletPaymentResult = {
      paymentRequestId: string;
      paymentAttemptId: string;
      xPaymentHash: string;
      paid: boolean;
      verified: boolean;
      settled: boolean;
      payer: string;
      chainId: number;
      network: string;
      relayMode?: string;
      submittedUserOpHash?: string | null;
      transactionHash?: string | null;
      gasEstimate?: Record<string, unknown>;
      xPayment?: string | null;
      receipt?: Record<string, unknown> | null;
      status?: string;
      errorCode?: string;
      retryAfterMs?: number;
    };

    ネストした型はSDKリファレンスで確認できます。SDKはトップレベルの応答と、dataで包まれた応答を処理します。

    X402HazbaseWalletPaymentResult

    失敗時の確認

    非2xxの応答はHazbaseWalletApiErrorとして扱われます。status、code、messageを記録し、機能固有のエラーとネットワーク障害を区別してください。秘密情報をログに出さないようにしてください。

    エラーとトラブル対応
    実装ソースを確認