Update a Subscription

Localpayment enables you to modify existing subscriptions to accommodate changes in customer needs, such as upgrading or downgrading plans, updating billing information, or changing subscription frequencies. This guide details the process for updating a subscription through Localpayment's API.


Before You Begin

Ensure you have:


Step 1: Update a Subscription

To modify an existing subscription, send a PATCH request to the Update a Subscription endpoint.

Key Request Parameters

The request requires several key parameters:

ParameterDescription
amountNew subscription amount
cardCard object with updated payment details
autoRecurringBilling frequency and repetition settings
discountDiscount configuration to apply to subscription
retryPayment retry configuration for failed charges
dateToUpdateSpecific date when changes should take effect
suspensionSubscription suspension settings
statusSubscription status change (e.g., pause/resume)

Example Request

Below is an example using curl:

curl --request PATCH \
     --url https://api.stage.localpayment.com/api/payin/subscriptions/{externalId} \
     --header 'Authorization: Bearer <your_access_token>' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
    "dateToUpdate": "2025-10-28",
    "amount": 1600.00,

   "autoRecurring": {
        "repetitions": "2",
        "type": "hour",
        
    },

   "retry": {
    "repetitions": 2,
    "intervalUnit": "day",
    "intervalValue": 1
  }
}
'

See all available parameters in the request.


Step 2: Handle the Response

Successful Response

A successful update returns the modified subscription details:

{
  "externalId": "564b161a-76ba-4a84-b5cf-583f2df8c377",
  "internalId": "52425bbd-b68b-4abc-9480-5ae88d53adb3",
  "status": {
    "code": "107",
    "description": "APPROVED",
    "detail": "Update subscription success"
  },
  "errors": []
}

Key Response Fields

ParameterDescriptionUse Case
status.codeCurrent subscription status code.Status monitoring.

Error Response

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

{
  "status": {
    "code": "400",
    "description": "ERROR",
    "detail": "Invalid operation"
  }
}

Step 3: Track Transaction Status

After updating a subscription, monitor its status through these methods:

Common Status Codes

The Localpayment API provides various status codes to indicate the progress and outcome of the payment in the response.

CodeStatusDescription
107APPROVEDUpdate was approved and applied.
400ERRORSubscription update was rejected.
📝

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 Upgrade: Increasing subscription tier or amount.
  2. Successful Plan Downgrade: Decreasing subscription tier or amount.
  3. Payment Method Update: Changing card details.
  4. Customer Information Update: Modifying customer details.
  5. Validation Errors: Invalid amounts, missing required fields.
  6. Status Updates: Webhook handling and status polling

Next Steps

After updating a subscription, you may need to perform additional actions: