logo
This section describes how to integrate checkout flows using BerrySDK and interact with the embedded BerryPay widget programmatically. It covers creating checkout transactions, automatically provisioning wallets in the background when needed, tracking payment status, and connecting users to the BerryPay checkout flow for a seamless crypto payment experience.
There are currently two checkout methods:
  • createCheckout — creates a checkout transaction for the end user and automatically provisions a wallet in the background
  • getCheckout — retrieves and tracks the status of an existing checkout transaction
What will you find here?
How to create a Checkout Payment?
The createCheckout method is used to create a checkout transaction within the ChainBerry infrastructure.
php
$checkoutParams = [ 'amountUsd' => '100.00', 'partnerUserID' => '9d57ccb2-b9a8-40d4-b985-1c17be009e90', 'partnerPaymentID' => '0766167c-68dd-491d-a454-9fc5bb6eea3e', 'callbackUrl' => 'https://your-callback-url.com/webhook' ]; try { $checkout = BerrySdk::createCheckout($checkoutParams); echo "Checkout created: " . $checkout['paymentId']; } catch (Exception $e) { echo "Error: " . $e->getMessage(); }

Parameters

Parameter
Required
Type
Default
Example
Description
amountUsd
true
string
undefined
100.00
Amount of usd to deposit in the ##.## format
partnerUserID
false
string
undefined
Reference ID for the user provided by the partner
partnerPaymentID
true
string
undefined
Payment ID provided by the Partner. Should be a unique value
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
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
partner.name
string
Name of the partner
partner.logo
string
Partner logo

Errors

Status
Error
Message
401
UNAUTHORIZED
API Token is incorrect or missing.
401
UNAUTHORIZED
Payload Signature is incorrect or missing.
400
BAD_REQUEST
AmountUsd is invalid. It should be a ##.## formatted string.
400
BAD_REQUEST
AmountUsd 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: "AmountUsd is invalid. It should be a ##.## formatted string.", 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 createCheckout
  • Manually fetch the transaction with getCheckout 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
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 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

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

Powered by Notaku