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:


Step 1: Get Subscription Plan Details

To retrieve subscription plan information, send aGET request to the Get Subscription Plan endpoint.

Key Request Parameters

The request requires several key parameters:

ParameterDescriptionRequired
internalIdLocalpayment's unique plan identifier from the URL path

Example Request

Below is an example using curl:

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 in the request.


Step 2: Handle the Response

Successful Response

A successful request returns complete subscription plan details:

{
    "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": "170.170.00000004",
    "autoRecurring": {
        "repetitions": 1,
        "type": "hour",
        "frequency": 1
    },
    "status": {
        "code": "100",
        "description": "ACTIVE",
        "detail": "Subscription plan is active"
    }
}

Key Response Fields

ParameterDescriptionUse Case
internalIdLocalpayment's unique plan identifier.Reference for API operations.
nameDescriptive name of the subscription plan.Display to customers.
descriptionDetailed explanation of plan features.Customer communication.
amountBilling amount.Payment processing.
countryCountry where the plan is available.Geographic restrictions.
currencyBilling currency.Financial calculations.
accountNumberAssociated merchant account number.Reconciliation.
autoRecurring.typeBilling frequency type.Billing cycle management.
autoRecurring.repetitionsNumber of billing cycles.Plan duration tracking.
autoRecurring.frequencyBilling frequency value.Recurring billing setup.
status.codeCurrent plan status code.Availability checking.

Error Response

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

{
  "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:

Common Status Codes

CodeStatusDescription
100ACTIVEPlan is active and available for subscription associations.
400REJECTEDPlan retrieval failed due to invalid parameters or plan not found.
📝

Note: For complete status code reference, see the Transaction Status documentation.


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