If you would like to sell or unlock individual items in your app, you’re in the right place! We have several features to help support this.
Before we get started it’s worth noting that one-time purchases are not supported “out of the box” like renewable subscriptions are. Specifically, we don't support an in-app checkout flow for one-time purchases yet. This means that you will have to do some extra work yourself to wire things up, and possibly even hire a developer. It also means that purchase flows can only be completed on the web. See “Limitations” below for more details.
Concepts
Understanding the following concepts will help you design the right one-time purchase experience for your users.
Entitlements
At the center of one-time purchases are entitlements. An entitlement grants a specific user access to a particular piece of content indefinitely. Entitlements are granted via our API or via coupon codes. You can learn more about entitlements here.
Coupon codes
Coupon codes are short codes that your users can redeem in your web app for access to content. The key parts of a coupon code are the code itself (a string of characters), the content that the code will redeem, how many customers can redeem the code, and when the code expires (if at all). You can use our API to generate coupon codes and email them directly to your customers.
External purchase URLs
When you are creating or editing content in the Treefort dashboard, you’ll notice an “External purchase URL” field. If you drop a URL to an external checkout page in this field, we’ll show a “Purchase” button on the page for that content in your app. If a user clicks the button, we’ll send them to the URL you provided. That’s it - after that it’s up to you to manage the payment flow and grant the user an entitlement to the content.
⚠️ This feature is only available on the web. See “Limitations” below.
Common patterns
Our customers tend to handle one-time purchases in a couple of ways.
eCommerce purchases
You can use our API and coupon code features to grant customer in-app access to content that they purchase via your eCommerce website (e.g. a Shopify store).
Setup
Setup on your end looks like this:
Listen to purchase webhooks from your eCommerce website.
Call the Treefort API to create a coupon code for the purchased item.
Call the Treefort API to email the coupon code to the customer’s email.
Optionally add links to your eCommerce website from your app using the “External purchase URL” feature.
Having a developer can help with this process, but tools like Pipedream or Zapier can enable a technical non-developer to set this up in a pinch.
Customer experience
The customer experience looks like this:
They purchase an item on your eCommerce site.
They receive an email with a link to unlock the content in your app.
They click the link and are guided through the process of creating an account (if they haven’t already) and redeeming the content.
Stripe payment links
You can use our API and external purchase URL features to allow customers to purchase content from your web app using Stripe payment links.
Setup
Setup on your end looks like this:
Create a products and payment link in Stripe for the item you wish to sell. Add custom metadata to each product indicating which Treefort content item should be unlocked when the product is purchased.
Paste the Stripe payment link into the “External purchase URL” field for the content.
Repeat steps 1-2 for each item you wish to sell in your web app.
Listen to purchase webhooks from Stripe.
Call the Treefort API to create a coupon code for the purchased item.
Call the Treefort API to email the coupon code to the customer’s email.
Having a developer can help with this process, but tools like Pipedream or Zapier can enable a technical non-developer to set this up in a pinch.
Customer experience
The customer experience looks like this:
They browse your app and come across a content item that requires payment to view.
They click the “Purchase” button on the content item page.
They are redirected to a checkout page for Stripe and complete payment.
They receive an email with a link to unlock the content in your app.
They click the link and are guided through the process of creating an account (if they haven’t already) and redeeming the content.
Limitations
One-time purchase flows can currently only be initiated on the web - from your web app, eCommerce store, Stripe link, etc. Once a user has unlocked content on the web they can access it via your iOS app or Android app, but they can’t make the purchase from those apps. This limitation is due to restrictions from Apple and Google regarding in-app payments.
👉 Apple and Google have recently lifted some of their payment restrictions in certain geographies. We are working on taking advantage of these changes.
