Web Billing
IAPHUB offers a seamless solution for selling subscriptions and digital goods on the web.
By enabling Web Billing, you can:
- Easy Setup: Connect your Stripe account in just a few clicks.
- Unified Management: Handle both mobile (iOS/Android) and web transactions in a single place.
- Web Checkout: Sell subscriptions and digital goods with a secure, hosted checkout page.
- Web Customer Portal: Provide a fully localized, self-service portal for users to manage their subscriptions (cancel, resume, upgrade) without writing a single line of code.
- Cross-Platform Entitlements: Web purchases are automatically detected by the IAPHUB SDK in your mobile app, using your existing setup—no additional code required.
Configuration
To start processing web payments, you need to connect your Stripe account to IAPHUB.
- Go to the IAPHUB Dashboard.
- Navigate to Settings -> Web.
- Locate the Stripe section.
- Click the button to connect IAPHUB to Stripe.
If you are already using Stripe for an internal system, we strongly recommend creating a new Stripe App dedicated to IAPHUB. This ensures that transactions are kept separate and prevents any conflicts with your existing webhooks or data.
You can connect both Sandbox and Production environments. We recommend connecting the Sandbox environment first to test the integration before enabling real payments in Production.
Sandbox Configuration
To test payments without using a real credit card, you must enable the Sandbox Mode.
- In the Web settings page, scroll down to the Sandbox Mode section.
- Check the Enabled box.
- Add the email addresses you intend to use for testing in the Sandbox emails list.
Only users with an email address listed in the Sandbox emails will be able to perform sandbox transactions. When testing the checkout flow, make sure to enter one of these authorized emails.
To facilitate testing:
- Sandbox subscriptions automatically renew every 24 hours, regardless of the product duration.
- Sandbox subscriptions are automatically cancelled after 5 days.
Once you have finished testing and are ready to process real payments, you can safely disable the Sandbox Mode to prevent any accidental sandbox transactions.
App Configuration
To ensure the billing portal and emails function correctly, you must provide some details about your application.
- In the Web settings page, scroll down to the App section.
- Fill in the required information:
- App Name: The name displayed in emails and the billing portal. You can add multiple languages to localize the name.
- Support Email: The email users should contact for support.
Once Stripe is connected, you can use the IAPHUB Web Checkout and Web Customer Portal.
Web Checkout
Use this link to direct users to a payment page where they can purchase a product.
http://billing.iaphub.com/:webKey/checkout?product=:productAlias&email=:email&userId=:userId
Parameters:
| Parameter | Type | Description |
|---|---|---|
webKey | Path | Required. The app web key found in the dashboard settings. |
product | Query | Required. The alias of the product (e.g. premium_1m). |
userId | Query | Required. The user ID (same as the one provided to the login method of the IAPHUB SDK). |
email | Query | (Optional) The customer's email address. If omitted, the user will be prompted to enter it. |
Web Customer Portal
Use this link for users to manage their existing subscriptions (e.g., cancel, upgrade, update payment method). When accessing this link, users will be asked to enter their email address. They will receive a one-time code in their inbox to log in securely.
http://billing.iaphub.com/:webKey/portal?email=:email
Parameters:
| Parameter | Type | Description |
|---|---|---|
webKey | Path | Required. The app web key found in the dashboard settings. |
email | Query | (Optional) The customer's email address. If omitted, the user will be prompted to enter it (unless already logged in). |
SDK Integration
The IAPHUB SDK automatically handles web purchases without requiring complex manual synchronization.
1. Purchase on Web
Once a web purchase is processed successfully:
- IAPHUB records the new transaction by listening to Stripe webhooks.
- The purchase webhook is triggered to notify your server (if enabled).
- The transaction becomes available through the Get Transaction API.
2. Handle Purchase in App
When the user returns to your mobile app:
- The onDeferredPurchase event is triggered (with the transaction data).
- For subscriptions or non-consumables:
- The onUserUpdate event is triggered.
- The getActiveProducts method will return the purchased active product.
3. Handle Subscription Updates
Renewals, cancellations, refunds, and other updates are automatically synchronized. IAPHUB listens to Stripe webhooks and refreshes the subscription state using the Stripe API whenever a notification is received. These events will trigger their respective webhooks (e.g. subscription_renewal, subscription_cancel, subscription_expire).
Beta
This is the latest feature offered by IAPHUB and it is still in beta testing.
We have many improvements coming your way in the near future, such as:
- Processing a web payment directly from the IAPHUB SDK
- Processing payments for unauthenticated users (when the user ID is not known)
If you have any feedback or feature requests, feel free to contact us at [email protected].