App credits
Improve your cash-flow by selling in-app credits
As a business, of course you accept credit cards and other forms of payment in cash. You can also accept in-app wallets storing prepaid credits. In-app wallets are an opportunity to keep customer's money on your platform, which creates liquidity for you and saves you on excess banking fees, especially for small-value transactions.
Using this pattern
Let's suppose you want to allow your customers to top up an in-app wallet with prepaid credits, instead of immediately transferring funds for purchases directly from their bank accounts or credit cards. Wallets significantly reduce the friction of processing a purchase: By reducing the number of external transactions, you can realize significant savings on payment processing fees.
Moreover, if you don't permit credits to be transferred back out as cash, you are essentially receiving a 0% interest loan from your customers, a formula that Starbucks perfected with their gift card program.
So, you have a customer who wants to purchase credits, and then use some of them to buy an item from a seller. When the customer purchases credits, you will move funds from the customer's credit card into a special account representing the wallet. Then, when the customer buys an item, you need only move the credits from their wallet to the seller's wallet. Then the seller can periodically flush their wallet to their bank account (saving additional payment processing fees) at a later time.
Formance Ledger lets you transfer value from the world into a customer's wallet, creating it if necessary. Suppose customer with ID U1234
wants to put ¥5,000 into their wallet. You can credit those funds into the cutomer's wallet using Numscript as such:
Let's break this Numscript transaction down. This Numscript snippet takes advantage of namespaces to name the accounts in a readable, hierarchical way. The @world
account is a special account that represents money coming in from the outside world—in this case from the buyer's credit card. The account @user:U1234:wallet
is the buyer's wallet—it will be created if it doesn't exist. This transaction simply moves ¥5,000 from the outside world (the buyer's credit card) into the user's wallet.
Later, let's imagine buyer U1234
wants to purchase an item for ¥2,000 from a seller with ID U6789
on your platform, creating a transaction with ID T2345
. You can structure a transaction to move the credit from the buyer to the seller like this:
This transaction consists of two postings that will be executed sequentially. In the first posting, you are requesting payment from the buyer's wallet, and moving those funds into a temporary order account, @user:U1234:transaction:T2345
, representing that specifically those funds were used to pay for that order. Then, in the second posting, you immediately move the funds from the temporary order account to the seller's wallet (or you can wait until the seller indicates the item has shipped, if you prefer). Normally, you might need to wait for the money to arrive from our payment processor, but since these are credits, you can move them around as you see fit. Finally, the transaction specifies the amount as *
, meaning you want to flush the entire contents of the order account into the seller's wallet, letting Formance Ledger determine the precise amount.
Then, when the customer wants to spend more of their credit, just repeat the process. Where without an in-app wallet, each of these steps would incur a payment processing fee, you can effectively use the credits to aggregate the payment processing into a smaller number of transactions.