If you click on a link and make a purchase we may receive a small commission. Read our editorial policy.

Democratizing in-app purchase with direct payment

Following the Apple vs Epic dispute, Raymond Arifianto gives a crash course on how to implement in-app purchase with direct payment in your game

Last week, Epic Games began an (pardon the pun) unreal skirmish with Apple and Google by enabling a discounted direct payment option on the mobile versions of Fortnite, compared to the mandated, standard payment via App Store or Google Play.

According to Tim Sweeney, the decision to enable direct payment is to provide options and to pass the savings to the player, while slamming the 30% store tax from Apple and Google.

As a result, Apple and Google pulled Fortnite from their stores, and a litigation suit filed by Epic is underway.

The dust is not going to settle anytime soon, and the jury is still out whether Apple and Google will let Fortnite -- or other games for that matter -- provide direct payment options for in-game microtransactions. Consider this: if Epic wins this battle, it will also impact consoles such as Xbox, PlayStation, Nintendo, or even Steam.

Here are the three things you need to know should you consider providing alternative direct payment for your game:

Enabling secure IAP with platform pay

While the hot topic is whether platforms will allow alternative direct payments, you will most likely still have to implement the 'pay with platform' route.

On a high level breakdown, here's what's happening when users make an in-app purchases:

The key factor here is that you need to have a server component that can validate user purchases, securely, by calling into server-to-server APIs from the appropriate platforms.

There are different ways platforms provide secure server-to-server validation of user purchases, but generally they can be grouped in two categories:

  1. Receipt validation
  2. Entitlement sync

With receipt validation, the game client would complete the purchase, and pass the receipt up to the server. The server would then validate receipt information to the platform backend, and grants the appropriate entitlement for the user. Apple and Google support receipt validation S2S APIs.

Swimlanes for receipt validation with platforms

Here is an example of how to perform receipt validation with Apple.

With entitlement sync, the game client completes the purchase, and notifies the server. The server then calls the platform backend on behalf of the user, and validates any new entitlements for them. If there are new entitlements, the server copies and synchronizes the entitlements to its own database. Xbox and PlayStation support entitlement sync.

Swimlanes for entitlement sync with platforms

Taking direct payment using payment aggregators

The fastest way to utilize direct payment is by leveraging one (or more) payment aggregator(s).

What is a payment aggregator? The US Chamber website defines it as "a a service provider that allows merchants to process mobile or e-commerce payments. They let businesses accept credit and debit card payments without setting up a merchant account through a bank."

"Instead, you use a third-party payment provider to process your online transactions for you. The provider groups your business with other merchants and accepts payments on behalf of everyone."

In short, you can get up and running quickly to take payment from your users, as the payment aggregator takes care of the heavy lifting (PCI compliance, setting up merchant accounts, tax calculation, securely storing credit card information, etc).

There are many payment aggregators available -- Stripe, Adyen, Paypal, Xsolla, to name a few. They all have different capabilities, ease of use, and different charging models.

A fee per transaction is standard, so make sure to check the fine print before determining which works for your game.

Most payment aggregators let you put your own branding on the pay station during user checkout, so they know that they are purchasing from you directly.

Example of pay station that you can embed in your game

Integrating with a payment aggregator normally involves your server registering a callback fulfillment URL.

Upon a successful transaction, the payment aggregator calls the callback URL with the details of the transaction. Your backend can then process payment and grant the user appropriate entitlement based on their purchases.

Swimlanes for direct pay

Note that you can design your backend system such that you can use different payment aggregators based on your needs. For instance, you can choose different aggregators to process player transactions from different regions based on traffic and transaction fee.

Tracking player purchases with entitlements

Hopefully by now you agree that, in order to securely process in-app purchases for your game, you need a backend system, that can:

  • Validate the purchase
  • Keep track of the player entitlements in a central location, regardless of where and how the purchases were made
Overall architecture of enabling direct pay and platform pay in your game

Keeping track of player entitlements goes beyond in-app purchases -- for instance, if you decide to sell Steam keys in your website, or if you are considering a Buy-Once-Play-Anywhere ownership model for your game.

Note that you can have your e-commerce system interact with other parts of your system, or even external systems, when a purchase is verified and fulfilled. For instance, you may want to send player purchase data into your analytics pipeline to get insights into your players' engagement and spending habits.

With the right backend systems in place, not only can you process in-app purchases securely, you can also engage your players directly to ensure a consistent user experience for your game and your brand, regardless of which platforms they choose to experience your game.

Raymond Arifianto has been making online games and platforms for over 15 years, working at Xbox, Lionhead, EA and Ubisoft. He is now working as VP of tech at AccelByte, a one-stop shop for live game services.