Tutorial Scope
This tutorial aims to help Apple App developers implement a mobile web browser-based checkout in their apps. Apple App developers who are not mandated to use Apple's in-app payment methods can use this tutorial to implement a mobile web browser-based checkout in their Apple Apps and save 15% or 30% commission rates on transactions. Learn more about Apple guidelines for business.
As per the ruling made by the US court on April 30, 2025, Apple has made changes to its guidelines 3.1.1, 3.1.1(a), 3.1.3, and 3.1.3(a) as published in this notification. These changes allow App developers to include buttons, external links, or other calls to action in their United States storefront apps that can redirect users to alternative payment methods outside of the App Store. For regions other than the United States, app developers have to request optional entitlements and need to adhere to Apple guidelines while redirecting users to external purchase methods. Learn more about external purchase entitlements.
Prerequisites
Before implementing web checkout for your mobile app, ensure that you have configured your checkout experience in Chargebee and generate the Chargebee checkout URL using the Checkout for new Item API or by following this tutorial.
Steps to implement checkout experience in a mobile web browser
To offer this checkout experience, you need to add a CTA (Call to Action) in your App and initiate the external web checkout that is powered by Chargebee. Here are the steps:
Include a button or external link in your app to redirect users to an external web checkout page.
Note: Choose to offer the in-app payment method of Apple, along with a regular browser-based checkout, or just offer the browser-based checkout experience in your app. You can include a single or multiple buttons. While the in-app payment method of Apple provides a complete in-app experience, browser-based checkout involves redirecting the user to a mobile web browser for completing payments.
A screen with both in-app and browser-based checkout options can look like this:
Checkout Action Button When the user taps Subscribe via web and save 30%, your app should call the backend service to generate the Chargebee checkout URL.Use the Checkout for new Item API or follow this tutorial to create the checkout session. Your backend should return the hosted_page object in the response.
The id is a unique identifier of the
hosted_page
object used to track the state of the checkout process.The url received from the above object is the unique link to the hosted checkout page, which you can embed in your website.
Pass the customer details to create a customer in Chargebee.
chargebee.hosted_page.checkout_new_for_items({
subscription_items: {
item_price_id: "premium-usd-monthly"
},
customer: {
first_name: "Bruce",
last_name: "Wayne",
email: "wayne@wentrpise.com"
}
}).request(function(error, result) {
if (error) {
// Handle error
} else {
res.send(result.hosted_page.url);
}
});
When the app receives this url, you can open it in a web browser, which takes the user to your Chargebee checkout page.
The checkout page will be displayed according to your configuration which you can modify in Chargebee as per your branding.

Once the user completes the checkout, a new subscription is created in Chargebee. We recommend listening to relevant webhook events such as
subscription_created
orinvoice_generated
to confirm a successful checkout and grant the appropriate entitlements to the customer. You can use the id to retrieve the hosted page object and access the associated subscription and invoice details.After a successful checkout, use the redirect_url to deep link back into your application. This URL receives query parameters such as the
hosted_page_id
andstate
, which you can use to restore session context or track the checkout outcome. For example:http://yoursite.com?id=<hosted_page_id>&state=succeeded
.After implementation, the complete purchase journey will look like this:

We're always happy to help you with any questions you might have!
support@chargebee.com