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

# Get Subscription Plan

Localpayment provides an endpoint to retrieve detailed information about existing subscription plans. This guide explains how to fetch subscription plan details through Localpayment's API, allowing you to verify plan configurations, check status, and use plan information in your application.

## Before You Begin

Ensure you have:

> [card] [API Credentials](https://docs.localpayment.com/docs/api-keys-and-environments.md)
>
> Valid API credentials and access token for authentication.

> [card] [Account Setup](https://docs.localpayment.com/docs/make-your-first-test-payment.md)
>
> Proper account setup for your target country and business verification.

> [card] [IP Whitelisting](https://docs.localpayment.com/docs/dashboard-whitelist-your-ips.md)
>
> Whitelist your server IP addresses for API access.

> [card] [Webhook Endpoint](https://docs.localpayment.com/docs/webhooks.md)
>
> Set up a webhook URL to receive payment notifications.

***

## Step 1: Get Subscription Plan Details

To retrieve subscription plan information, send a`GET` request to the [Get Subscription Plan](https://docs.localpayment.com/docs/get-subscription-plan.md) endpoint.

### Key Request Parameters

The request requires several key parameters:

| Parameter | Description | Required |
| - | - | - |
| `internalId` | Localpayment's unique plan identifier from the URL path | ✅ |

### Example Request

Below is an example using `curl`:

```bash curl theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
curl --request GET \
  --url 'https://api.stage.localpayment.com/api/subscriptions/plan/{internalId}' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <your_access_token>' \
  --header 'Content-Type: application/json'
```

See all [available parameters](https://docs.localpayment.com/docs/get-subscription-plan.md) in the request.

***

## Step 2: Handle the Response

### Successful Response

A successful request returns complete subscription plan details:

```json theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
{
    "internalId": "b8546575-5d4f-4a56-9e21-522d01cf5992",
    "name": "Plan Básico Mensual",
    "description": "Acceso básico a contenido exclusivo",
    "amount": 50,
    "country": "MEX",
    "currency": "MXN",
    "accountNumber": "{{accountNumber}}",
    "autoRecurring": {
        "repetitions": 1,
        "type": "hour",
        "frequency": 1
    },
    "status": {
        "code": "100",
        "description": "ACTIVE",
        "detail": "Subscription plan is active"
    }
}
```

### Key Response Fields

| Parameter | Description | Use Case |
| - | - | - |
| `internalId` | Localpayment's unique plan identifier. | Reference for API operations. |
| `name` | Descriptive name of the subscription plan. | Display to customers. |
| `description` | Detailed explanation of plan features. | Customer communication. |
| `amount` | Billing amount. | Payment processing. |
| `country` | Country where the plan is available. | Geographic restrictions. |
| `currency` | Billing currency. | Financial calculations. |
| `accountNumber` | Associated merchant account number. | Reconciliation. |
| `autoRecurring.type` | Billing frequency type. | Billing cycle management. |
| `autoRecurring.repetitions` | Number of billing cycles. | Plan duration tracking. |
| `autoRecurring.frequency` | Billing frequency value. | Recurring billing setup. |
| `status.code` | Current plan status code. | Availability checking. |

### Error Response

When a subscription plan cannot be found or accessed, you'll receive error information:

```json theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
{
  "status": {
    "code": "400",
    "description": "ERROR",
    "detail": "Plan subscription not found"
  }
}
```

***

## Step 3: Track Transaction Status

After retrieving a subscription plan, you can determine its availability and current state:

> [card] [Webhooks (Recommended)](https://docs.localpayment.com/docs/webhooks.md)
>
> Receive real-time notifications when transaction status changes. Most efficient for production environments.

> [card] [Status API Endpoint](https://docs.localpayment.com/reference/get-transaction-status.md)
>
> Query transaction status programmatically. Useful for polling or recovering lost webhook notifications.

> [card] [Business Portal View](https://docs.localpayment.com/docs/dashboard-overview.md)
>
> Visual interface for monitoring transactions. Great for manual oversight and detailed transaction analysis.

### Common Status Codes

| Code | Status | Description |
| :- | :- | :- |
| `100` | `ACTIVE` | Plan is active and available for subscription associations. |
| `400` | `REJECTED` | Plan retrieval failed due to invalid parameters or plan not found. |

> [!NOTE]
>
> **Complete Reference**
>
> View all status codes in our [Transaction Status Documentation](https://docs.localpayment.com/reference/transaction-status-error-codes).

***

## Testing Your Integration

### Test Scenarios

Verify your integration handles these scenarios:

1. **Successful Plan Retrieval**: Fetch details for an existing active plan.
2. **Nonexistent Plan**: Attempt to retrieve a plan that doesn't exist.
3. **Invalid Plan ID**: Test with malformed or incorrect internalId formats.
4. **Authentication Failures**: Retrieve plans with invalid or expired access tokens.

***

## Next Steps

> [card] [Create a subscription plan](https://docs.localpayment.com/docs/create-a-subscription-plan.md)
>
> Set up new subscription plans for different service tiers or pricing models.

> [card] [Update subscription plan](https://docs.localpayment.com/docs/update-a-subscription-plan.md)
>
> Modify existing plan details based on the information retrieved.

> [card] [Create subscription with plan](https://docs.localpayment.com/docs/create-a-subscription.md)
>
> Use the plan id to create new customer subscriptions.


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