Skip to main content
Checks the current usage balance for a given plan, scoped to the authenticated subscriber or a specific address.

Example Usage

const balance = await payments.getPlanBalance(planId)
// OR if you provide the address of a different user
const balance = await payments.getPlanBalance(planId, userAddress)

Parameters

  • planId: The ID of the payment plan to check balance for
  • userAddress (optional): Check balance for a specific user address instead of the authenticated user

Returns

{
  "isSubscriber": "boolean",
  "total": "number",
  "used": "number",
  "remaining": "number"
}

Notes

  • If isSubscriber is false, the user has no active credits
  • Balance may be time-based or credit-based depending on plan type