logo
‼️ Note: v1 will soon be deprecated!
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?

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 = [ 'amount' => '6', 'currency' => 'USDT', 'callbackUrl' => 'https://your-callback-url.com/webhook', 'tradingAccountLogin' => 'user123', 'paymentCurrency' => 'USDC', 'paymentGatewayName' => 'BNB', 'partnerPaymentID' => '0766167c-68dd-491d-a454-9fc5bb6eea3e', ]; 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
amount
true
string
undefined
0.001
Amount of cryptocurrency to deposit in the ##.## format
currency
true
string
undefined
USDT
Currency that the Customer will receive. Currently defaults to Tron network.
paymentGatewayName
false
string
undefined
BNB
Network on which the funds will be sent.
paymentCurrency
false
string
undefined
USDC
Currency that the Customer will send. Defaults to currency
callbackUrl
true
string
undefined
Callback for receiveing transaction updates
tradingAccountLogin
true
true
undefined
Reference id for the user provided by the partner
partnerPaymentID
false
string
undefined
Payment ID provided by the Partner

Returns

Parameter
Type
Example
Description
paymentId
string
Id of the payment for easy tracking
status
string
transactionAmount
string
15.60
netAmount
string
15.50
transactionCurrency
string
ETH
Cryptocurrency that the Customer sent
finalCurrency
string
USDT
Cryptocurrency that the Customer received
processingFee
string
0.10
Estimated transaction fee
address
string
Customer wallet for sending funds
checkoutUrl
string
Url to BerryPay for completing the transaction
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

What are the statuses of Conversion payments?

CREATED
Payment created in the system, but still not paid by the user.
PROCESSING
Transaction is being processed by the blockchain and waiting confirmation.
KYT IN PROGRESS
Transaction was processed by the blockchain and is being verified by the KYT provider.
PENDING APPROVAL
Transaction was flagged as risky and is pending manual review by an Operative.
CONVERSION IN PROGRESS
Fund are being converted from source to destination currency.
CONFIRMED
Transaction has been confirmed by the blockchain and the funds are in the ChainBerry system.
REFUND IN PROGRESS
Transaction was rejected by an Operative and the funds are being returned to the Customer.
REJECTED
Transaction was rejected by an Operative and the funds are on the Customer’s External Wallet.
FAILED
Transaction has failed for some reason.