logo
This section covers how to initiate withdrawals from the SDK to external user wallets. You'll learn how to create withdrawal requests, pass the required parameters, and track the transaction status from initiation to on-chain confirmation.
There are currently two methods for withdrawals:
  • createWitdraw - used for generating a withdrawal payment for the end user.
  • getWithdraw - used for tracking the status of the deposit transaction.
What will you find here?
Check out older Withdrawal docs:
â„šī¸Withdrawals v1

How to create a Withdrawal?

The createWithdraw method is used for creating a withdrawal payment on the ChainBerry infrastructure.
php
$withdrawParams = [ 'amount' => '50.00', 'currency' => 'USDT', 'network' => 'BNB', 'address' => '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6', 'partnerUserID' => '9d57ccb2-b9a8-40d4-b985-1c17be009e90', 'partnerPaymentID' => '0766167c-68dd-491d-a454-9fc5bb6eea3e', 'callbackUrl' => 'https://your-callback-url.com/webhook' ]; try { $withdraw = BerrySdk::createWithdraw($withdrawParams); echo "Withdrawal created: " . $withdraw['paymentId']; } catch (Exception $e) { echo "Error: " . $e->getMessage(); }

Parameters

Parameter
Required
Type
Default
Example
Description
amount
true
string
undefined
0.001
Amount of cryptocurrency to deposit in the ##.## format
currency
true
string
undefined
USDC
Currency that the Customer will receive from CB
network
false
string
undefined
ETH
Network on which the funds will be sent. If not set, it defaults to currency field
address
true
string
undefined
External address provided by the Customer to which the funds will be withdrawn
partnerUserID
false
string
undefined
Reference id for the user provided by the partner
partnerPaymentID
false
string
undefined
Payment ID provided by the Partner
callbackUrl
true
string
undefined
Callback for receiveing transaction updates

Response

Parameter
Type
Example
Description
paymentID
string
Id of the payment for easy tracking
status
string
amount
string
15.60
Amount in-coin that was sent to the user
amountUsd
Payment amount in usd
currency
string
USDT
Cryptocurrency that the Customer received
network
string
TRX
Netwrok thrgourh which the funds were sent
address
string
External Customer wallet for receiving funds
partnerUserID
string
Reference ID for the user provided by the partner
partnerPaymentID
string
Payment ID provided by the Partner
commissionAmount
string
0.10
Commission Amount to be paid to ChainBerry
commissionCurrency
string
USDT
Currency in which the commission is paid
commissionNetwork
string
TRX
Network on which the commission is paid

Errors

Status
Error
Message
401
UNAUTHORIZED
API Token is incorrect or missing.
401
UNAUTHORIZED
Payload Signature is incorrect or missing.
400
BAD_REQUEST
Amount is invalid. It should be a ##.## formatted string.
400
BAD_REQUEST
Amount is required.
400
BAD_REQUEST
Currency is invalid. It should be one of the supported currencies.
400
BAD_REQUEST
Currency is required.
400
BAD_REQUEST
Network is invalid. It should be one of the supported networks
400
BAD_REQUEST
Address is not valid for [Currency].
400
BAD_REQUEST
Address is required.
400
BAD_REQUEST
Callback URL is invalid.
400
BAD_REQUEST
Callback URL is required.
400
BAD_REQUEST
Partner User ID is invalid. It should be a string.
400
BAD_REQUEST
Partner Payment ID is invalid. It should be a string.
javascript
{ status: 401, error: "UNAUTHORIZED", message: "API Token is incorrect or missing." } { status: 400, error: "BAD_REQUEST", message: { amount: "Amount is invalid. It should be a ##.## formatted string.", network: "Network is invalid. It should be one of the following ETH, BNB, TRX and align with the Currency field.", callbackUrl: "Callback URL is required.", } }

How to track Withdrawal payments?

You can track transaction changes in one or two ways:
  • Receive updates automatically to the callbackUrl provided in the createWithdraw
  • Manually fetch the transaction with getWithdraw method

Tracking transaction changes through a callback

For every deposit transaction, you need to provide a callbackUrl. Whenever a status changes, the route will be called with the following body:
Parameter
Type
Example
Description
paymentID
string
ChainBerry id of the transaction
status
string
PROCESSING
amount
string
120.00
Amount in-coin sent by the Customer
amountUsd
string
120.00
Amount in usd sent by the Customer
currency
string
USDC
Currency sent in the payment
network
string
BNB
Network on which the withdrawal was made
address
string
External Customer address for withdrawing funds
partnerUserID
string
Reference ID for the user provided by the partner
partnerPaymentID
string
Payment ID provided by the Partner
commissionAmount
string
0.05
Commission Amount to be paid to ChainBerry
commissionCurrency
string
USDT
Currency in which the commission is paid
commissionNetwork
string
TRX
Network on which the commission is paid
cryptoTransactionInfo
string
Blockchain details for all transactions related to the payment
signature
string
ChainBerry payload signature

Manually tracking transaction changes

php
try { $withdraw = BerrySdk::getWithdraw($paymentId); echo "Withdrawal status: " . $withdraw['status']; } catch (Exception $e) { echo "Error: " . $e->getMessage(); }
Parameters:
Parameter
Required
Type
Default
Description
paymentId
true
string
undefined
Payment Id returned by the createWithdraw method
Returns:
Same as the callback.
Errors:
No payment found for provided id.

Additional Information

Supported currencies

Supported Currencies

Bitcoin (BTC), Ethereum (ETH), Binance (BNB), Polygon (POL), Solana (SOL), Tron (TRX), Litecoin (LTC), Ton Coin (TON)

Supported Stablecoins

  • USDT (ETH, BSC, POL, SOL, TRX)
  • USDC (ETH, BSC, POL, SOL)

Supported Networks

Ethereum (ETH), Binance Smart Chain (BNB), Polygon (POL), Solana (SOL), Tron (TRX)