How to change the charge amount for an active subscription

To change the charge amount of an active subscription, run an HTTP-PATCH request https://subscriptions.xsolla.com​/api/v1/projects/{projectId}/subscriptions/{subscriptionId}/price.

Note

After changing the charge amount, the user is notified by email, and the new amount takes effect from the next billing period.

To change the charge amount for new subscriptions, use the Update Plan method. The new amount only applies to new subscriptions, and all existing subscriptions will continue under the old terms.

The request must contain an Authorization: Basic <your_authorization_basic_key> header, where <your_authorization_basic_key> is the merchant_id:api_key pair encoded according to the Base64 standard.

Go to Publisher Account to find these parameters:

  • merchant_id is shown:
    • In the Project settings > Webhooks section.
    • In the Company settings > Company section.
    • In the URL of the browser’s address bar on any Publisher Account page. The URL has the following format: https://publisher.xsolla.com/&amp;lt;merchant ID>/<Publisher Account section>.
  • api_key is shown in Publisher Account only once when it is created and must be stored on your side. You can create a new key in the following section:
    • Company settings > API keys
    • Project settings > API keys

Pass as path parameters:

ParameterTypeDescription
projectId
integerRequired. Project ID. You can find this parameter in your Publisher Account next to the name of the project.
subscriptionId
integerRequired. Subscription ID.
Pass in the request body:
ParameterTypeDescription
amount
floatRequired. Charge amount value.
currency
stringRequired. Three-letter currency code per ISO 4217.
Request example:
Copy
Full screen
Small screen
'https://subscriptions.xsolla.com​/api/v1/projects/{project_id}/subscriptions/{subscription_id}/price' \
  -H 'accept: application/json' \
  -H 'Authorization: Basic'

{
  "amount": 4.99,
  "currency": "USD"
}

Response examples:

  • 200 — Charge amount is changed successfully
  • 400 — Subscription is not active
  • 404 — Subscription is not found
Was this article helpful?
Thank you!
Is there anything we can improve? Message
We’re sorry to hear that
Please explain why this article wasn’t helpful to you. Message
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.
Rate this page
Rate this page
Is there anything we can improve?

Don’t want to answer

Thank you for your feedback!
Last updated: January 22, 2024

Found a typo or other text error? Select the text and press Ctrl+Enter.

Report a problem
We always review our content. Your feedback helps us improve it.
Provide an email so we can follow up
Thank you for your feedback!