Beta: In-App Purchases

Overview

We’re introducing a new way for you to monetize your app: You can offer in-app purchases that users pay for as standalone purchases. Note that this feature is currently in beta.

For example, if your app sells custom images to users, you can sell each image as a one-time purchase, offer a package of 10 images, and more.

You’ll use our SDK to display a description of your in-app products, and you’ll keep track of the user’s balance on your server. We’ll explain how this works below.

Getting Started

Before you start developing this feature in your app:

  1. Contact us to set up your billing package. Reach out to your account manager or submit a ticket.
  2. Design a pricing page to show users the different packages. Display this page in your settings panel/dashboard component.
Implementation

Here’s how to implement in-app purchases:

  1. Show users the right packages. When your App Settings panel/Dashboard component loads, use the SDK to get information about the user’s location. This way, you can show users the right packages based on their region and currency.
    Use Wix.Billing.getProducts in the settings panel, and Wix.Dashboard.getProducts in the dashboard. 
  2. Direct users to our billing page. The getProducts method returns a URL so that you can open the Wix billing page for users to complete the payment. Open the billing page as a new tab.
  3. Keep track of the user’s balance. Use our HTTP API to get information about the user’s purchase, and then track the user’s balance on your server. We’ll explain how to do this in the next section.
Manage Purchases

Once a user makes a purchase in your app, you’ll need to keep track of the user’s balance:

  1. Listen for the billing webhooks. When a user makes a purchase, we’ll send an HTTP post request to your server URL. Check the cycle property in these webhooks:
    • billing/upgrade
    • billing/statuschanged (the PURCHASE_IMMEDIATE event)
  2. Use our HTTP API to get the user’s purchase history. This is an important step, since you shouldn’t rely only on webhooks to know when a user makes a purchase.
    Use the GET /premium/oneTimePurchases endpoint to verify the user’s purchase.
  3. Update and track the user’s balance on your server. This means that you should:
    • Keep track of and display the user’s remaining balance – even if the user deletes your app and then adds it again.
    • Know when the user runs out of credit.

Was this page helpful?

What can we do to improve it?

What did you like about it?