Payout Service
Step-by-step example of how to setup and use Public Mint for Payouts
Last updated
Step-by-step example of how to setup and use Public Mint for Payouts
Last updated
In this example we'll show how to use our APIs to easily implement a payout service based on Public Mint's services and blockchain.
Public Mint's service APIs offer a series of methods that can be used to integrate with Public Mint services and blockchain. Before you start, it's recommended that you review the full documentation available online on developers.publicmint.io.
To use Public Mint's services, you need to be registered as partner and have the API Key to access the APIs. Please contact support@publicmint.com to apply.
Public Mint has two publicly available environments that can be used by anyone: production and sandbox
The Production environment is Public Mint's main environment for partners and users. It's connected to real banks and KYC verification systems.
Sandbox
The Sandbox environment is targeted for integration development by Partners and others that want to use Public Mint's services and blockchain. It's not connected to KYC verification systems or actual banking rails.
In order to execute payouts on the blockchain, the first step is to create and prepare an address from which the transfer will be executed. Please check out our tutorial on how to Create a Blockchain Address.
For this example, we'll also set up an address to be the liquidity pool from where payouts will be executed, and which will be replenished as funds come in via FIAT. This allows for payouts that are effectively independent from the actual deposit of funds (within the limits of the funds preloaded into the pool).
On Public Mint, all fiat transactions must be associated with a previously KYC-verified identity. There are three ways to obtain such an identity:
As a Partner, you'll have an identity automatically created during registration, which you can use in conjunction with your API Key. Seeing as funds in the liquidity pool address are your own, you can use your own identity when loading funds;
If you are using the Public Mint Widget, you can skip this section, as the widget will handle the identity generation automatically.
If you prefer to have users provide their personal identification details to you, you can create an Identity for each of your users by forwarding that data to our API, therefore allowing your customers to deposit funds directly into an address. Please check our tutorial on how to create identities via our API.
With an address assigned to our liquidity pool and an identity for deposits, you can now make a fiat deposit so that you have an initial amount available for the payout.
In this example, we'll use a bank wire transfer for the deposit. Read about other transfer methods here.
Example
At the moment the deposit is created, the reference
field is initially set to null
.
As this is an async operation, the response will be returned via POST request to the partner's webhook URL. Alternatively, you can make a GET request to the /deposits/:id
endpoint, where :id
is the id returned from the deposit POST call. Read more about it here.
The reference
should then be used for making the wire transfer to Public Mint's bank account.
Make sure to include the reference
on the transfer description, and that the origin account is held by the same identity you used to create the deposit.
In the sandbox environment, you can bypass the deposit settlement process with a manual settlement. To do that, you need to make a POST request to the /deposits/:id/sandbox-settle-deposit
endpoint. Note that this is only possible in the sandbox environment.
Example
Now that the liquidity pool address has funds, you can request payouts from the blockchain. Doing so is as simple as making a transfer between your blockchain account and the destination account.
Example
When the pool gets low on funds, all you need is to make a new deposit and you're set.