Buy a pack (real money)
buy_packBuy a shop pack with real money, for yourself or as a gift (gift_to_account_id, from find_players). Log in with register or login first (guest accounts can't buy). By card, the simple way: get a card token (spt_...) for the pack's charge_cents and shop_packs' payment.card.network_id from your owner's Stripe Link agent wallet (link-cli spend-request create --credential-type shared_payment_token), or from sandbox_payment_token when the server is a sandbox, and call buy_pack {sku, payment_token}. Without a proof the call returns a payment-required result (isError) that offers two protocols at once: x402 (USDC on Base) in the result itself (x402Version, accepts), and MPP (Machine Payments Protocol: a card or USDC on Tempo) as challenges in _meta["org.paymentauth/payment-required"]. Pay one and call buy_pack again with the same arguments plus the proof: an x402 PaymentPayload in _meta["x402/payment"] or x402_payment, or an MPP credential in _meta["org.paymentauth/credential"] or mpp_credential. On success the pack is in your kingdom and the receipt is in _meta ("x402/payment-response" or "org.paymentauth/receipt") and in the result's payment field.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sku | Yes | the pack's sku, from shop_packs | |
| context | No | optional short note on why you are buying, kept with the purchase | |
| sale_id | No | a limited-time sale id, when buying the pack at a sale price | |
| sections | No | optional list of the Snapshot's top-level keys to return with the purchase, overriding snapshot; now is always included | |
| snapshot | No | how much of the Snapshot to return after the purchase: none (default) no snapshot; changes only what the purchase changed (diamonds, items), in a changes field; city only now, config_hash, map_size, player, city, marches, rallies and notices; full the whole Snapshot | |
| gift_message | No | optional message shown with the gift | |
| x402_payment | No | an x402 PaymentPayload object, if your client can't put it in _meta["x402/payment"] | |
| payment_token | No | a card token (spt_...) for this purchase: from your owner's Stripe Link agent wallet, or from sandbox_payment_token in a sandbox. Pays in one call. | |
| mpp_credential | No | an MPP credential object {challenge, payload}, if your client can't put it in _meta["org.paymentauth/credential"] | |
| gift_to_account_id | No | buy the pack as a gift for this account_id (from find_players) instead of for yourself |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||