Skip to main content
Localpayment enables merchants to set up recurring payment subscriptions using credit and debit cards, supporting both fixed plans and custom billing scenarios across multiple countries. This guide outlines the process for creating a subscription through Localpayment’s API, detailing required parameters, handling responses, and interpreting status codes.

Before You Begin

Ensure you have:

API Credentials

Valid API credentials and access token for authentication.

Account Setup

Proper account setup for your target country and business verification.

IP Whitelisting

Whitelist your server IP addresses for API access.

Webhook Endpoint

Set up a webhook URL to receive payment notifications.

Step 1: Create a Subscription

To create a new subscription, you’ll need to send a POST request to the Create a Subscription endpoint.

Key Request Parameters

The request requires several key parameters depending on whether you’re creating a fixed plan subscription or a custom subscription:

Subscription Types

  • Fixed Plan Subscription: Use when you have predefined subscription plans created via the Create Subscription Plan endpoint.
  • Custom Subscription: Use for variable billing scenarios where each payment may differ in amount or timing.

Payment Method Codes

In every country, paymentMethod.code identifies the country, the card brand, and the product (credit or debit), so send the code that matches the card and the subscription’s country. In Peru, where cards are accepted in two currencies, the code must also match the currency: for example, a Visa credit card uses 6000 with PEN and 6004 with USD. See Card Payment Method Codes for the codes of all countries.

Example Request

Below is an example using curl:
curl
See all available parameters in the request.

Step 2: Handle the Response

Successful Response

A successful response includes detailed subscription information and identifiers:

Key Response Fields

Error Response

When a request fails, you’ll receive detailed error information:

Step 3: Track Transaction Status

After creating a subscription, monitor its lifecycle through these methods:

Webhooks (Recommended)

Receive real-time notifications when transaction status changes. Most efficient for production environments.

Status API Endpoint

Query transaction status programmatically. Useful for polling or recovering lost webhook notifications.

Business Portal View

Visual interface for monitoring transactions. Great for manual oversight and detailed transaction analysis.

Common Status Codes

The Localpayment API provides various status codes to indicate the state of the subscription.
Complete ReferenceView all status codes in our Transaction Status Documentation.

Testing Your Integration

Test Scenarios

Verify your integration handles these scenarios:
  1. Successful Subscription Creation: Standard subscription flow with valid card.
  2. Fixed Plan Subscription: Subscription with predefined plan.
  3. Custom Subscription: Subscription with custom billing parameters.
  4. Validation Errors: Invalid card, missing required fields
  5. Status Updates: Webhook handling and status polling

Next Steps

After a subscription is created, you may need to perform additional actions, such as:

Update subscription

Modify existing subscription details including billing amount, frequency, or customer information.

Cancel subscription

Terminate active subscriptions while preserving transaction history and billing records.

Handle subscription webhooks

Set up webhooks to receive real-time notifications for subscription events and payment status changes.
Last modified on November 10, 2026