Withdrawing
Request a fiat withdrawal from a blockchain address.
The same requirements for depositing also apply to withdrawing fiat. Here's what you need:
Step 1: Verify user KYC status & add transfer method
In case you haven't yet done so, start by submitting your documents as explained here. If you haven't passed KYC, or if you're initiating a withdrawal on behalf of a user but are unsure about their verification status, follow these steps to verify the identity's KYC status now.
If the response returns identityConfirmed: true you can go ahead with the flow.
Step 2: Activate required operations
In order to use the transfer methods you will need to activate the operations. The available operations are:
'deposit:wire',
'deposit:stablecoin',
'withdrawal:wire',
'withdrawal:stablecoin'POST <hostname>/operations/activate
{
"identityId": "{{identityId}}",
"code": ["withdrawal:wire"]
}Step 3: Create a transfer method
To be able to execute a withdrawal you need to indicate what is the transfer method that is to be used for the transaction. As the execution is done directly on the blockchain, we require that all the destination details are previously supplied to be able to process them.
To create a new transfer method, you should make a POST request to the transfer method endpoint.
This endpoint will return a response like the one below. The id is needed in the next step, when burning the USD in the blockchain.
Step 3: Call withdrawal function on token contract
For this step, start by making a call to the tokenized fiat contract requesting the burning of the tokens you want to withdraw. To do that, follow the instructions for integrating with the blockchain as explained in the blockchain section.
This guide assumes you have Node.js installed, using npm package manager to install the publicmint-web3.js as detailed in the corresponding section. To instantiate a connection with Public Mint node, use the code below.
Note: In November 1st, the previous withdrawal flow that used the API reference will be deprecated. To use the new flow with the Public Mint NPM, you will need to upgrade to the version 3.0.0.
Once you've set up a web3 connection to Public Mint's blockchain, run this code on your server to trigger the burning of tokens on-chain at Public Mint's token contract.
This is the withdrawal() function from the token smart contract that you must invoke:
If successful, the function will emit an event, which is then captured by Public Mint's event listener.
After that, the tokens will be burned (destroyed) by the token contract.
Available withdrawals:
withdrawAchUS
withdrawWireInt
withdrawWireUS
The interface is equal for all withdraw methods has the same parameters as example above.
See here more about withdrawals methods and unique costs.
Last updated
Was this helpful?