> ## Documentation Index
> Fetch the complete documentation index at: https://docs.base.org/llms.txt
> Use this file to discover all available pages before exploring further.

# subscription.getStatus

> Check the status and details of an existing subscription

export const Button = ({children, disabled, variant = "primary", size = "medium", iconName, roundedFull = false, className = '', fullWidth = false, onClick = undefined}) => {
  const variantStyles = {
    primary: 'bg-blue text-black border border-blue hover:bg-blue-80 active:bg-[#06318E] dark:text-white',
    secondary: 'bg-white border border-white text-palette-foreground hover:bg-zinc-15 active:bg-zinc-30',
    outlined: 'bg-transparent text-white border border-white hover:bg-white hover:text-black active:bg-[#E3E7E9]'
  };
  const sizeStyles = {
    medium: 'text-md px-4 py-2 gap-3',
    large: 'text-lg px-6 py-4 gap-5'
  };
  const sizeIconRatio = {
    medium: '0.75rem',
    large: '1rem'
  };
  const classes = ['text-md px-4 py-2 whitespace-nowrap', 'flex items-center justify-center', 'disabled:opacity-40 disabled:pointer-events-none', 'transition-all', variantStyles[variant], sizeStyles[size], roundedFull ? 'rounded-full' : 'rounded-lg', fullWidth ? 'w-full' : 'w-auto', className];
  const buttonClasses = classes.filter(Boolean).join(' ');
  const iconSize = sizeIconRatio[size];
  return <button type="button" disabled={disabled} className={buttonClasses} onClick={onClick}>
      <span>{children}</span>
      {iconName && <Icon name={iconName} width={iconSize} height={iconSize} color="currentColor" />}
    </button>;
};

export const BaseBanner = ({content = null, id, dismissable = true}) => {
  const LOCAL_STORAGE_KEY_PREFIX = 'cb-docs-banner';
  const [isVisible, setIsVisible] = useState(false);
  const onDismiss = () => {
    localStorage.setItem(`${LOCAL_STORAGE_KEY_PREFIX}-${id}`, 'false');
    setIsVisible(false);
  };
  useEffect(() => {
    const storedValue = localStorage.getItem(`${LOCAL_STORAGE_KEY_PREFIX}-${id}`);
    setIsVisible(storedValue !== 'false');
  }, []);
  if (!isVisible) {
    return null;
  }
  return <div className="fixed bottom-0 left-0 right-0 bg-white py-8 px-4 lg:px-12 z-50 text-black dark:bg-black dark:text-white border-t dark:border-gray-95">
      <div className="flex items-center max-w-8xl mx-auto">
        {typeof content === 'function' ? content({
    onDismiss
  }) : content}
        {dismissable && <button onClick={onDismiss} className="flex-shrink-0 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors" aria-label="Dismiss banner">
          ✕
        </button>}
      </div>
    </div>;
};

Defined in the [Base Account SDK](https://github.com/base/account-sdk)

<Info>
  The `subscription.getStatus` function retrieves the current status and details of a subscription created with spend permissions. Use this to check if a subscription is active, view remaining charges, and determine the next payment period.
</Info>

## Parameters

<ParamField body="id" type="string" required>
  The subscription ID (permission hash) returned from subscribe().

  **Pattern:** `^0x[0-9a-fA-F]{64}$`
</ParamField>

<ParamField body="testnet" type="boolean">
  Must match the testnet setting used in the original subscribe call. Default: false
</ParamField>

## Returns

<ResponseField name="result" type="SubscriptionStatus">
  Subscription status information including current state and payment details.

  <Expandable title="SubscriptionStatus properties">
    <ResponseField name="isSubscribed" type="boolean">
      Whether subscription is active (not cancelled).
    </ResponseField>

    <ResponseField name="recurringCharge" type="string">
      Recurring charge amount in USD.
    </ResponseField>

    <ResponseField name="remainingChargeInPeriod" type="string">
      Remaining amount that can be charged in the current period.
    </ResponseField>

    <ResponseField name="currentPeriodStart" type="Date">
      Start date of the current billing period.
    </ResponseField>

    <ResponseField name="nextPeriodStart" type="Date">
      Start date of the next billing period.
    </ResponseField>

    <ResponseField name="periodInDays" type="number">
      Subscription period in days.
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```typescript Basic Status Check theme={null}
  import { base } from '@base-org/account';

  const status = await base.subscription.getStatus({
    id: '0x71319cd488f8e4f24687711ec5c95d9e0c1bacbf5c1064942937eba4c7cf2984'
  });

  console.log(`Active: ${status.isSubscribed}`);
  console.log(`Recurring amount: $${status.recurringCharge}`);
  console.log(`Remaining this period: $${status.remainingChargeInPeriod}`);
  console.log(`Next payment: ${status.nextPeriodStart}`);
  ```

  ```typescript Check Before Charging theme={null}
  import { base } from '@base-org/account';

  // Check if subscription can be charged
  const status = await base.subscription.getStatus({
    id: subscriptionId,
    testnet: false
  });

  if (!status.isSubscribed) {
    console.log("Subscription has been cancelled");
    return;
  }

  const remainingAmount = parseFloat(status.remainingChargeInPeriod || '0');
  const chargeAmount = parseFloat(status.recurringCharge);

  if (remainingAmount >= chargeAmount) {
    console.log(`Can charge full amount: $${chargeAmount}`);
    // Proceed with charge
  } else if (remainingAmount > 0) {
    console.log(`Can only charge remaining: $${remainingAmount}`);
    // Charge partial amount
  } else {
    console.log(`No remaining charge until ${status.nextPeriodStart}`);
    // Wait for next period
  }
  ```
</RequestExample>

<ResponseExample>
  ```typescript Active Subscription theme={null}
  {
    isSubscribed: true,
    recurringCharge: "9.99",
    remainingChargeInPeriod: "9.99",
    currentPeriodStart: "2024-01-15T00:00:00.000Z",
    nextPeriodStart: "2024-02-14T00:00:00.000Z",
    periodInDays: 30
  }
  ```

  ```typescript Partially Charged Subscription theme={null}
  {
    isSubscribed: true,
    recurringCharge: "19.99",
    remainingChargeInPeriod: "5.50",
    currentPeriodStart: "2024-01-01T00:00:00.000Z",
    nextPeriodStart: "2024-01-31T00:00:00.000Z",
    periodInDays: 30
  }
  ```

  ```typescript Cancelled Subscription theme={null}
  {
    isSubscribed: false,
    recurringCharge: "9.99",
    remainingChargeInPeriod: "0",
    currentPeriodStart: "2024-01-15T00:00:00.000Z",
    nextPeriodStart: "2024-02-14T00:00:00.000Z",
    periodInDays: 30
  }
  ```

  ```typescript Fully Charged Period theme={null}
  {
    isSubscribed: true,
    recurringCharge: "49.99",
    remainingChargeInPeriod: "0",
    currentPeriodStart: "2024-01-01T00:00:00.000Z",
    nextPeriodStart: "2024-02-01T00:00:00.000Z",
    periodInDays: 31
  }
  ```
</ResponseExample>

## Usage Patterns

<Tabs>
  <Tab title="Check Before Charge">
    Always check subscription status before attempting to charge:

    ```typescript theme={null}
    const status = await base.subscription.getStatus({ id, testnet });

    if (status.isSubscribed && parseFloat(status.remainingChargeInPeriod!) > 0) {
      const chargeCalls = await base.subscription.prepareCharge({
        id,
        amount: status.remainingChargeInPeriod!,
        testnet
      });
    }
    ```
  </Tab>

  <Tab title="Schedule Next Charge">
    Use the status to schedule when to charge next:

    ```typescript theme={null}
    const status = await base.subscription.getStatus({ id, testnet });

    if (status.nextPeriodStart) {
      const nextChargeDate = new Date(status.nextPeriodStart);
      scheduleJob(nextChargeDate, () => chargeSubscription(id));
    }
    ```
  </Tab>

  <Tab title="Display to User">
    Show subscription details to users:

    ```typescript theme={null}
    const status = await base.subscription.getStatus({ id, testnet });

    return (
      <div>
        <p>Status: {status.isSubscribed ? 'Active' : 'Cancelled'}</p>
        <p>Monthly charge: ${status.recurringCharge}</p>
        <p>Next billing date: {new Date(status.nextPeriodStart).toLocaleDateString()}</p>
      </div>
    );
    ```
  </Tab>
</Tabs>

## Error Handling

The function may throw errors for invalid subscription IDs or network issues:

```typescript theme={null}
try {
  const status = await base.subscription.getStatus({
    id: subscriptionId,
    testnet: false
  });
  // Process status
} catch (error) {
  console.error(`Failed to get subscription status: ${error.message}`);
  // Handle error appropriately
}
```

<BaseBanner
  id="privacy-policy"
  dismissable={false}
  content={({ onDismiss }) => (
<div className="flex items-center">
  <div className="mr-2">
    We're updating the Base Privacy Policy, effective July 25, 2025, to reflect an expansion of Base services. Please review the updated policy here:{" "}
    <a
      href="https://docs.base.org/privacy-policy-2025"
      target="_blank"
      className="whitespace-nowrap"
    >
      Base Privacy Policy
    </a>. By continuing to use Base services, you confirm that you have read and understand the updated policy.
  </div>
  <Button onClick={onDismiss}>I Acknowledge</Button>
</div>
)}
/>
