SpendPermissionPaymentCollector when a wallet approves repeated collection. Your scheduler still creates a fresh PaymentInfo and unique salt for every billing period because each protocol payment can be charged only once.
Demo
Charge One Billing Period
The collector reconstructs a spend permission fromPaymentInfo: the payer is the account, the collector is the spender, the token and allowance come from the payment, and preApprovalExpiry is the permission end. Encode the permission signature and optional MagicSpend withdrawal request as collectorData.
Use a durable billing key such as subscriptionId:periodStart before submitting the protocol charge.
TypeScript
PaymentCharged and creates a protocol refundableAmount for that billing period.
Store the billing key,
paymentInfoHash, charge transaction, amount, and spend-permission usage in one durable workflow.See Also
Request a Payment
Use the same charge lifecycle for a one-time checkout.
Refund a Payment
Reverse a charged billing period before refund expiry.