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?ParametersResponseErrorsHow to track Deposit payments?Tracking payment changes through callbacksTracking payment changes through BerrySDK
Check out older Deposits docs:
Deposits v1How 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', 'network' => 'ETH', 'partnerUserID' => '9d57ccb2-b9a8-40d4-b985-1c17be009e90', 'partnerPaymentID' => '0766167c-68dd-491d-a454-9fc5bb6eea3e', 'callbackUrl' => 'https://your-callback-url.com/webhook' ]; 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 | USDT | Currency that the Customer will send. |
network | false | string | undefined | ETH | Network on which the funds will be sent. If not set, it defaults to currency field |
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 | PROCESSING | Check out Deposit Payment Statuses > |
amount | string | 15.60 | Amount to be sent by the end user |
amountUSD | string | 15.60 | Amount in usd |
currency | string | USDT | Cryptocurrency that the Customer will send |
network | string | BNB | Network on which the funds will be sent |
address | string | Wallet address for sending the funds | |
checkoutUrl | string | Url to BerryPay for completing the transaction | |
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 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
callbackUrlprovided in thecreateDeposit
- Manually fetch the transaction with
getDepositmethod
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 | PROCESSING | Check out Deposit Payment Statuses > |
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 deposit was made |
address | string | Customer address for making the deposit | |
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 |
Tracking payment changes through BerrySDK
phptry { $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. |