Programmatic Payouts

Creating a Payout

You can also integrate with payouts programmatically. To instruct a payout using the Confirmo API you need to send a POST request to https://confirmo.net/api/v3/payouts endpoint.

curl --location 'https://confirmo.net/api/v3/payouts' \
--header 'Authorization: Bearer [YOUR_CONFIRMO_API_KEY]' \
--header 'Content-Type: application/json' \
--data '@data.json'

The body can look like the example below.

data = {
	"currencyFrom": "USD",
	"amountFrom": 100,
	"address": "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq",
  	"paymentMethodId": "BITCOIN-BLOCKCHAIN-MAINNET-BTC-CURRENCY",
	"notifyUrl": "https://yourEShop.com/payoutProcess",
	"isDraft": False
};

The above request will create a payout for 100 USD which will be debited from your USD balance and send an equivalent amount in Bitcoin (according to the current exchange rate) to the Bitcoin wallet set in the field address. The currencyFrom parameter is always required and instructs which balance should be debited for the payout.

Similarly, the parameter paymentMethodId must be filled in and specifies how the payout should be sent. By default, the following values are possible:

  • ETHEREUM-ARBITRUM-ONE-MAINNET-USDC
  • ETHEREUM-BLOCKCHAIN-MAINNET-USDC-STANDARD
  • ETHEREUM-BLOCKCHAIN-MAINNET-USDT
  • ETHEREUM-BLOCKCHAIN-MAINNET-ETH-CURRENCY
  • TRON-BLOCKCHAIN-MAINNET-USDT-STANDARD
  • BITCOIN-BLOCKCHAIN-MAINNET-BTC-CURRENCY
  • LITECOIN-BLOCKCHAIN-MAINNET-LTC-CURRENCY

Instead of filling in the amountFrom you can alternatively specify amountTo parameter. This is especially useful if the payout currency doesn't match the currency getting debited from your balance. Using the variable treatAsGrossAmount you can specify if the processing and network fee should be deducted from the requested payout or your outstanding balance.

Don't forget to properly handle required Travel rule documentation for a smooth payout experience.

A sample response to a payout request can be seen below. We will also send a webhook notification to your server in the same format if you specified it under notifyUrl.

{
  "address": "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq",
  "amountFrom": 100,
  "amountTo": 0.001,
  "btcPriority": "HIGH",
  "completedAt": 1484056304,
  "createdAt": 1484055304,
  "currencyFrom": "USD",
  "customerEmail": "[email protected]",
  "debitedAmount": 100,
  "exchangeRate": 100000,
  "expiration": 1484055424,
  "fee": 10,
  "feeCurrency": "USD",
  "id": "WDRnwMw9LIF",
  "notifyEmail": "[email protected]",
  "notifyUrl": "https://yourEShop.com/payoutProcess",
  "paymentMethodId": "BITCOIN-BLOCKCHAIN-MAINNET-BTC-CURRENCY",
  "reference": "string",
  "sentAt": 1484055304,
  "sourceAddresses": [
    "6D5a012e39a77800D492420245662406A03e",
    "54SDdf800D492420245662406A03e"
  ],
  "status": "PREPARED",
  "substatus": "SCREENING_IN_PROGRESS",
  "treatAsGrossAmount": false,
  "txid": "cf3c7…03bcf",
  "validTo": 1484056304
};

Sending the payout

When you first create a payout (and set isDraft to false, otherwise the default value is true) it will be in the status prepared. If you are happy with the exchangeRate and fee you can move the payout to confirmed state by making a PATCH call to https://confirmo.net/api/v3/payouts/{id}. In your request you should specify the id of the payout and in the payload the state you want to move the payout to.

{ "action": "CONFIRMED" };

Payout Drafts

If your payout is in state draft you can then move it to the prepared state by sending a PATCH call to the same endpoint as when moving a payout to the confirmed state. In your call you will set the action parameter to PREPARE and then continue the flow normally. Please note that amounts and fees in draft status are only estimates.

💡

Older integrations must first enable the payout draft flow. For these integrations the default value of isDraft is set to False.


What’s Next