Getting user’s data

Call the function paywall.getUser() to get information about the user, including country match, subscription status, and balance (if tokenization is enabled). If the user is not authenticated, a 401 error will be returned with the body { error: 'Unauthorized', countryMatch: boolean }. Upon successful authentication, you will receive the following object:
user: { id: string email: string name: string avatar: string created_at: string }, balances: { type: string count: number }[] countryMatch: boolean subscription: { status: 'active' | 'canceled' | 'incomplete_expired' | 'past_due' | 'incomplete' | 'unpaid' current_period_start: string // "2024-09-08T15:39:02+00:00" current_period_end: string // "2024-08-08T15:39:02+00:00" cancel_at_period_end: boolean // Whether this subscription will (if status=active) or did (if status=canceled) cancel at the end of the current billing period. canceled_at: string // If the subscription has been canceled, the date of that cancellation created: string // "2024-08-08T15:39:02+00:00" ended_at: string // If the subscription has ended, the date the subscription ended. id: string }[] payment: { status: 'paid' | 'pending' | 'unpaid' }[] paid: boolean
💡
If user has active subscription or lifetime payment then paid is true

Subscription statuses

STATUS
DESCRIPTION
active
The subscription is in good standing and the most recent payment is successful. It’s safe to provision your product for your customer.
incomplete
A successful payment needs to be made within 23 hours to activate the subscription. Or the payment requires action, like customer authentication.
incomplete_expired
The initial payment on the subscription failed and no successful payment was made within 23 hours of creating the subscription. These subscriptions don’t bill customers. This status exists so you can track customers that failed to activate their subscriptions.
past_due
Payment on the latest finalized invoice either failed or wasn’t attempted. The subscription continues to create invoices. If the invoice is still unpaid after all Smart Retries have been attempted, you can configure the subscription to move to canceledunpaid, or leave it as past_due. To move the subscription to active, pay the most recent invoice before its due date.
canceled
The subscription has been canceled. This is a terminal state that can’t be updated.
unpaid
The latest invoice hasn’t been paid but the subscription remains in place. The latest invoice remains open and invoices continue to be generated but payments aren’t attempted. You should revoke access to your product when the subscription is unpaid since payments were already attempted and retried when it was past_due. To move the subscription to active, pay the most recent invoice before its due date.