SaaS
Ecommerce
Events & Tickets
Digital Products
Services & Consultations
Donations
Membership Communities
Track payments and subscriptions from the API
The Get Customer endpoint can return a customer’s subscriptions, invoices, and payments (with refunds, payment methods, entitlements, and balance) when you pass theexpand query parameter. The typed Commerce SDK hides these fields, so read them from the endpoint response. There are no payment webhooks yet, so poll the endpoint to stay in sync.
To build this, paste this prompt to your app’s Hercules agent:
Read each customer’s payments and subscriptions from the Commerce Get Customer endpoint using theexpanddetail. There are no payment webhooks yet, so poll on an interval. Whenever a payment issucceeded, credit that customer’s wallet exactly once, keyed on the payment id so re-polling never credits the same payment twice.