earn_points
Calculate and mint loyalty tokens based on purchase amount and program's cashback rate, optionally redeeming existing points at checkout (points_to_redeem or redeem_all) to reduce the payable receipt amount before calculating new cashback. Returns a fee-first calls[] bundle (protocol fee mint first, then the customer mint) — submit in order, atomically via EIP-5792 if supported, then call confirm_mint_fee (or POST /agent-api/mint/confirm) with obligation_id, fee_tx_hash, and recipient_tx_hash. Unconfirmed fee obligations block future mints.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| redeem_all | No | If true, redeems all available customer loyalty points (up to purchase_amount when positive). | |
| cashback_rate | No | Override cashback rate (%). If omitted, uses the program's default rate. | |
| token_address | Yes | Token contract address (0x...) | |
| customer_email | No | Customer email address | |
| purchase_amount | Yes | Purchase amount in currency units (e.g. dollars) | |
| customer_address | Yes | Customer wallet (0x...) or email address | |
| points_to_redeem | No | Optional integer loyalty points to redeem at the counter to reduce purchase_amount. |