Skip to content

Merchant Payments & Merit

Storage Returns
D9Merchant::Accounts(account) Merit balance, reward factors, and redemption history
D9Merchant::MerchantExpiry(account) Subscription expiry timestamp (Unix milliseconds)
D9Merchant::GovernedSubscriptionFee Subscription fee per 30-day period (USDT)
Assets::Account(2, merchant) Merchant Energy balance
Assets::Account(3, merchant) Merchant Bandwidth balance
D9Merchant::send_payment(merchant, usdt_amount, funding, min_pool_d9_out)
Parameter Description
merchant Active merchant account address
usdt_amount Invoice total in raw USDT units (6 decimals)
funding PaymentFunding::Usdt to pay directly from customer USDT, or PaymentFunding::D9 { max_d9_in } to swap customer D9 to USDT via the AMM up to max_d9_in
min_pool_d9_out Slippage floor for the 16% pool-leg D9 swap

Before submitting, confirm that MerchantExpiry(merchant) is in the future and that the merchant holds sufficient Energy and Bandwidth.

After finalization, the payment settles as follows:

  • 84% is transferred to the merchant in USDT.
  • 16% is swapped into D9 and routed to the burn mining reward pool.
  • Merit is credited to the customer in D9Merchant::Accounts.
D9Merchant::subscribe(periods)
  • periods: 1, 3, 6, or 12 (each period adds 30 days).
  • Total remaining validity is capped at 365 days from the current block time.
D9Merchant::redeem_d9(min_d9_out)
  1. Fetch a redemption quote from the runtime API UserPortfolioApi_get_merchant_redemption_quote.
  2. Wait until cooldown_remaining_ms reaches 0 (in milliseconds).
  3. Set min_d9_out slightly below the quote’s estimated_d9 and submit redeem_d9. If the actual payout would fall below min_d9_out, the transaction fails with RedemptionBelowMinimum and no state changes.
  4. Successful redemption pays out native D9.