Use Case

Payout to Wallet

Create a closed-loop economy on your marketplace

marketplaces

As a marketplace, perhaps you are sending your sellers their payouts directly to their bank account with each sale. But you can also credit them to an in-app wallet. In-app wallets are an opportunity to keep that money on your platform when issuing a payment, which creates liquidity for you and saves you on excess banking fees. It also allows the sellers to pay for extra services (e.g. promotions) in a streamlined way, creating opportunities to diversify your revenue lines beyond sales commissions.

Using this pattern

Let's suppose you want to credit your sellers to an in-app wallet, instead of immediately transferring their sales revenue directly to their bank accounts. Wallets significantly reduce the friction of processing a remittance: Sellers can request periodic bulk transfers to their bank accounts, saving you banking fees, and they can use their wallet to pay for additional services, such as promotions or marketing on your marketplace.

So, you have a seller who made a sale. When the customer checked out, you moved funds from the customer's credit card into a special account for tracking the order. Once those funds have actually arrived in your account, instead of flushing them back into the seller's bank accounts, you can direct them to the seller's wallet, for them to use on your platform or to transfer to their bank accounts at a later time.

Formance Ledger lets you pass sales revenue directly to a seller's wallet, creating it if necessary. Suppose seller with ID U6789 just sold an item in transaction T3456, and the funds have cleared. You can move those funds into the seller's wallet using Numscript as such:

send [EUR/2 *] (
  source = @user:U1234:transaction:T3456
  destination = @user:U6789:wallet
)

Let's break this Numscript transaction down. This Numscript snippet takes advantage of namespaces to name the accounts in a readable, hierarchical way. The account @user:U1234:transaction:T3456 is the order account, representing the funds that were set aside from the order with ID T3456. The account @user:U6789:wallet is the seller's wallet—it will be created if it doesn't exist. Finally, specifying the amount as * means you want to flush the entire contents of the order account into the seller's wallet, letting Formance Ledger determine the precise amount.

Later, let's imagine seller U6789 wants to purchase a promotional campaign on your platform for €50,00. They may or may not have sufficient funds in their wallet, as they have set up automatic monthly withdrawals of their wallet contents to their bank account. Nevertheless, you can structure a transaction to transparently handle this situation using Numscript:

send [EUR/2 5000] (
  source = {
    @user:U6789:wallet
    @world
  }
  destination = @platform:promotions
)

Here, you are requesting that the promotion be paid for from the seller's wallet. If there are insufficient funds in the wallet, then the transaction specifies that the remainder should be paid from the seller's bank account. The @world account is a special account that represents money coming in from the outside world—in this case from the seller's bank account. The account @platform:promotions is your account for collecting revenue from the sale of promotions on the platform.

Splitting the source like this means you don't need to first inquire to the balance in the wallet to see if there is enough, and if not, make the necessary calculations to determine how much additional to charge to the seller's bank account. Instead, of relying on standard floating point math, which is too imprecise for financial calculations, let Formance Ledger handle these calculations with its sophisticated integer math algorithms without remainder or error.

Use Cases

Refund your users by crediting their wallet to keep funds on your platform

Create a closed-loop economy on your marketplace

Allow your customers to use their wallets at checkout and for payments

900+ payments innovators building on Formance and sharing best practices.