Merchant Payments & Merit
Storage reads
Section titled “Storage reads”| 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 |
1. Pay a merchant invoice
Section titled “1. Pay a merchant invoice”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.
2. Subscribe or renew as a merchant
Section titled “2. Subscribe or renew as a merchant”D9Merchant::subscribe(periods)periods:1,3,6, or12(each period adds 30 days).- Total remaining validity is capped at 365 days from the current block time.
3. Redeem customer merit
Section titled “3. Redeem customer merit”D9Merchant::redeem_d9(min_d9_out)- Fetch a redemption quote from the runtime API
UserPortfolioApi_get_merchant_redemption_quote. - Wait until
cooldown_remaining_msreaches0(in milliseconds). - Set
min_d9_outslightly below the quote’sestimated_d9and submitredeem_d9. If the actual payout would fall belowmin_d9_out, the transaction fails withRedemptionBelowMinimumand no state changes. - Successful redemption pays out native D9.
