Subscription purchase

To implement subscription purchasing in your application, follow this logic:

  1. Retrieve the list of subscription plans available for purchase and display them to the user.
  2. Initiate the purchase of the plan selected by the user.

For simplified implementation, refer to the sample.

Note

Purchasing and managing subscriptions are only available to authenticated users. For information on using the SDK for user authentication, refer to the Authentication section.

The code samples use password authentication via user name and password (the XsollaAuth.SignIn method) with hardcoded credentials to simplify the subscription workflow demonstration. In a real application, you need to implement full authentication logic and current session validation using the XsollaAuth.AuthBySavedToken method.

Retrieve list of subscription plans

To retrieve the list of plans configured in Publisher Account, call the XsollaSubscriptions.GetSubscriptionPublicPlans or XsollaSubscriptions.GetSubscriptionPlans method. Use the returned data (the PlanItem object) to display the subscription catalog in your application.

Key fields for configuring UI widgets:

  • plan_name — subscription name.
  • plan_description — description of the plan’‎s benefits.
  • charge — object containing the price (amount) and currency (currency).
  • period — billing period.

Initiate subscription purchase

To initiate the purchase of a subscription plan selected by the user, call the XsollaSubscriptions.GetSubscriptionPurchaseUrl method, passing the planExternalId parameter. Upon a successful request, a PaymentLink object containing a link to the subscription management UI will be passed to the callback function. To open the link in an external browser or built-in WebView, use the XsollaWebBrowser.Open method.

Notice

To track the order status, you need to configure webhook handling and receive order information on the server side of your application. This will allow you to implement additional validation of completed purchases.

Refer to the Get subscription information section for detailed information on configuring and testing webhooks.

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.
Last updated: April 14, 2026

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!
We couldn't send your feedback
Try again later or contact us at doc_feedback@xsolla.com.