logo
This section explains how to set up auto-conversion deposits using BerrySDK and the BerryPay flow. Users initiate the deposit through your app using the SDK, then complete the transaction via the embedded BerryPay interface. Once confirmed, the crypto is automatically converted into stablecoins and sent directly to the user's wallet.
There are currently two methods for conversions:
  • createAutoConversion - used for generating an conversion deposit payment for the end user with automatic wallet generation in the background.
  • getAutoConversion - used for tracking the status of the conversion deposit payment
What will you find here?
Check out older Conversions docs:

How to create a Conversion Deposit?

The createAutoConversion method is used for creating an auto-conversion deposit payment on the ChainBerry infrastructure. If the user is new, or doesn’t have a dedicated wallet for the chosen currency, the wallet will be created automatically in the background.
php
$autoConversionParams = [ 'fromAmount' => '25', 'fromCurrency' => 'TON', 'toCurrency' => 'USDC', 'toNetwork' => 'BNB', 'partnerUserID' => '9d57ccb2-b9a8-40d4-b985-1c17be009e90', 'partnerPaymentID' => '0766167c-68dd-491d-a454-9fc5bb6eea3e', 'callbackUrl' => 'https://your-callback-url.com/webhook' ]; try { $autoConversion = BerrySdk::createAutoConversion($autoConversionParams); echo "Auto-Conversion created: " . $autoConversion['paymentId']; } catch (Exception $e) { echo "Error: " . $e->getMessage(); }

Parameters

Parameter
Required
Type
Default
Example
Description
fromAmount
true
string
undefined
0.01
Amount of cryptocurrency to deposit in the ##.## format
fromCurrency
false
string
undefined
BNB
Currency that the Customer will send. Defaults to currency
fromNetwork
false
string
undefined
BNB
Network on which the funds will be sent.
toCurrency
true
string
undefined
USDT
Currency that the Customer will receive. Currently defaults to Tron network.
fromNetwork
false
string
undefined
BNB
Network on which the funds will be received.
partnerUserID
true
true
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
CONFIRMED
fromAmount
string
15.60
Amount the Customer should send
fromAmountUsd
string
15.50
fromAmount in usd
fromCurrency
string
ETH
Cryptocurrency that the Customer sent
fromNetwork
string
ETH
Network through which the Customer will sent the funds
address
string
Customer wallet for sending funds
toAmount
string
0.10
Amount the Customer will receive in the desired currency
toAmountUsd
string
15.50
toAmount in usd
toCurrency
string
USDT
Cryptocurrency that the Customer received
toNetwork
string
TRX
Network on which the Customer will receive the converted funds
conversionRate
string
15.50
fromCurrency / toCurrency rate
partnerUserID
string
Reference ID for the user provided by the partner
partnerPaymentID
string
Payment ID provided by the Partner
checkoutUrl
string
Url to BerryPay for completing the transaction
commissionAmount
string
0.05
Commission Amount to be paid to ChainBerry
commissionCurrency
string
BNB
Currency in which the commission is paid
commissionNetwork
string
BNB
Network on which the commission is paid

Errors

TBD

How to track Conversion payments?

You can track payment changes by receiving updates automatically to the callbackUrl provided in the createAutoConversion

Tracking transaction changes through a callback

For every auto-conversion deposit payment, 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
depositAddress
string
Customer address on chain
transactionAmount
number
netAmount + processingFee
netAmount
number
Amount the user sent
processingFee
number
Blockchain transaction fees
transactionCurrency
string
Currency the Customer has deposited
finalAmount
number
Amount the user received
finalCurrency
string
Currency the user received
conversionRate
number
Conversion rate between transactionCurrency and finalCurrency
cryptoTransactionInfo.txid
string
Transaction hash on the blockchain
cryptoTransactionInfo.confirmations
number
Number of confirmations on the chain
cryptoTransactionInfo.amount
number
Total amount. Same as transactionAmount
cryptoTransactionInfo.confirmedTime
string
Time of the confirmation on chain
cryptoTransactionInfo.status
string
cryptoTransactionInfo.processingFee
number
Same as processingFee
cryptoTransactionInfo.conversionRate
number
Same as conversionRate
signature
string
ChainBerry payload signature
ℹ️Conversions