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

# Billing

> Manage subscriptions and billing

## Get Subscription

```go theme={null}
sub, err := client.Billing.GetSubscription(ctx)
fmt.Printf("Plan: %s, Status: %s\n", sub.Plan, sub.Status)
```

## Create Checkout

Create a Stripe checkout session to upgrade.

```go theme={null}
checkout, err := client.Billing.CreateCheckout(ctx, grantex.CreateCheckoutParams{
    Plan:       "pro",
    SuccessURL: "https://myapp.com/billing/success",
    CancelURL:  "https://myapp.com/billing/cancel",
})
// Redirect user to checkout.CheckoutURL
```

## Create Portal

Create a Stripe billing portal session for managing subscriptions.

```go theme={null}
portal, err := client.Billing.CreatePortal(ctx, grantex.CreatePortalParams{
    ReturnURL: "https://myapp.com/dashboard",
})
// Redirect user to portal.PortalURL
```

## Types

### `SubscriptionStatus`

| Field | Type | Description |
| - | - | - |
| `Plan` | `string` | `"free"`, `"pro"`, `"enterprise"` |
| `Status` | `string` | `"active"`, `"past_due"`, `"canceled"` |
| `CurrentPeriodEnd` | `*string` | ISO 8601 period end |

## Ownership

Grantex is owned by Orchestrum Technologies LLP. Inventor and owner: Sanjeev Kumar. Ownership contact: [sanjeev@orchestrum.in](mailto:sanjeev@orchestrum.in) or [mishra.sanjeev@gmail.com](mailto:mishra.sanjeev@gmail.com).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.