Update Subscription
This API endpoint allows updating a subscription by its unique ID. You must provide the subscription ID in the path parameter and a valid price ID in the request body.

Authorization: Bearer YOUR_TOKEN


Expected Behavior:


  • On success, the system will update the subscription and return a success message.
  • If the request is invalid or the subscription cannot be updated, the system will return an error message detailing the issue.
Path Parameters
  • id string
    The unique ID of the subscription to update.
Request Body Parameters
  • price_id string
    The ID of the new price to update the subscription with.
JavaScript
Response codes
const axios = require('axios');

const url = 'https://payment-cmd.api.pinghome.io/v1/subscription/{id}';
const data = {
  price_id: 'price_1MU7isEyoIQbyvYhiIpiQlw2'
};

axios.patch(url, data, {
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json'
  }
})
.then(response => {
  console.log(response.data);
})
.catch(error => {
  console.error(error);
});
ResponseThis section is used to view the possible HTTP response codes returned by the API. These codes indicate the status of a request, such as 201 (Created), 401 (Unauthorized), 409 (Conflict), or 422 (Unprocessable Entity).