logo
‼️ Note: v1 will soon be deprecated!
This section explains how to set up deposits in your app using BerrySDK and how to interact with the BerryPay widget programmatically. You'll learn how to generate deposit addresses, track incoming funds, and connect users to the embedded BerryPay flow for a seamless deposit experience.
There are currently two methods for deposits:
  • createDeposit - used for generating a deposit transaction for the end user with automatic wallet generation in the background
  • getDeposit - used for tracking the status of the deposit transaction
What will you find here?

How to create a Deposit?

The createDeposit method is used for creating a deposit transaction 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
$depositParams = [ 'amount' => '100.00', 'currency' => 'USDC', 'callbackUrl' => 'https://your-callback-url.com/webhook', 'tradingAccountLogin' => 'user123', 'paymentGatewayName' => 'ETH', // Optional 'paymentCurrency' => 'USDC' // Optional 'partnerPaymentID' => '0766167c-68dd-491d-a454-9fc5bb6eea3e', ]; try { $deposit = BerrySdk::createDeposit($depositParams); echo "Deposit created: " . $deposit['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
ETH
Currency that the Customer will receive
paymentGatewayName
false
string
undefined
ETH
Network on which the funds will be sent. If not set, it defaults to currency field
paymentCurrency
false
string
undefined
ETH
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

Response

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
ETH
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

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 following BTC, ETH, USDT, USDC, BNB, LTC, TON.
400
BAD_REQUEST
Currency is required.
400
BAD_REQUEST
Payment Gateway Name is invalid. It should be one of the following ETH, BNB, TRX and align with the Currency field.
400
BAD_REQUEST
Payment Gateway Name is required.
400
BAD_REQUEST
Callback URL is invalid.
400
BAD_REQUEST
Callback URL is required.
400
BAD_REQUEST
Trading Account Login is invalid. It should be a string.
400
BAD_REQUEST
Trading Account Login is required.
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.", paymentGatewayName: "Payment Gateway Name 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 Deposit payments?

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

Tracking payment changes through callbacks

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
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

Tracking payment changes through BerrySDK

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

What are the statuses of Deposit 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.
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.