Download the PHP package chainberry/external-sdk-php without Composer
On this page you can find all versions of the php package chainberry/external-sdk-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download chainberry/external-sdk-php
More information about chainberry/external-sdk-php
Files in chainberry/external-sdk-php
Package external-sdk-php
Short Description Chainberry PHP SDK
License unlicense
Homepage https://chainberry.com
Informations about the package external-sdk-php
Chainberry SDK
For full details on how to use the ChainBerry SDK, check out the official documentation here: https://chainberry-docs.notaku.site. Please note that the docs are still a work in progress, and we're actively updating them - so feel free to reach out at [email protected] if something's missing or unclear!
Overview
This PHP SDK provides easy integration with the Chainberry API for deposits, crypto operations, and other API features. It includes both low-level API access and a high-level BerrySdk wrapper for simplified usage.
Features
- API Setup & Configuration: Easy initialization with environment variables or configuration arrays
- Deposit Management: Create and retrieve deposits with automatic signature generation
- Crypto Operations: Sign payloads and verify signatures using RSA-SHA256
- Dual API Coverage: Target both legacy V1 and modern V2 endpoints from one SDK
- Error Handling: Comprehensive error classes for different types of errors
- Retry Logic: Built-in retry mechanisms with exponential backoff
- Validation: Input validation with customizable rules
- Logging: Configurable logging system
- OAuth Authentication: Automatic OAuth token management
Installation & Usage
Requirements
PHP 8.1 and later.
Composer
To install the bindings via Composer, add the following to composer.json:
Then run composer install
Manual Installation
Download the files and include autoload.php:
Quick Start with BerrySdk
Configuration
Environment Variables
Set the following environment variables:
Configuration Array
Alternatively, you can pass configuration directly:
Environment and API Version Matrix (V1 vs V2)
The SDK uses two separate configuration values:
- Environment (
CB_API_ENVIRONMENTor$config['environment']): The deployment environment (staging, production, or local) - API Version (
CB_API_VERSIONor$config['apiVersion']): The API version to use (v1 or v2)
Both values are combined to determine the base URL. The API version defaults to v1 if not specified.
| Environment | Constant | API Version | Base URL | Typical use case |
|---|---|---|---|---|
staging |
Environment::STAGING |
v1 |
https://api-stg.chainberry.com/api/v1 |
Legacy flows in staging |
staging |
Environment::STAGING |
v2 |
https://api-stg.chainberry.com/api/v2 |
New V2 flows in staging |
production |
Environment::PRODUCTION |
v1 |
https://api.chainberry.com/api/v1 |
Legacy flows in production |
production |
Environment::PRODUCTION |
v2 |
https://api.chainberry.com/api/v2 |
New V2 flows in production |
local |
Environment::LOCAL |
v1 |
http://192.168.0.226:3001/api/v1 |
Local V1 gateway |
local |
Environment::LOCAL |
v2 |
http://192.168.0.226:3001/api/v2 |
Local V2 gateway |
You can call both V1 and V2 helpers from the same process, but make sure the
CB_API_VERSION(or$config['apiVersion']) matches the endpoints you want to invoke. Mixing V1 helpers with a V2 API version (or vice versa) will result in authentication failures.
Initialize the SDK (shared bootstrap)
V2 Quick Start Examples
Make sure CB_API_VERSION (or $config['apiVersion']) is set to v2 before calling the helpers in this section.
V1 Quick Start Examples (Legacy)
If you still rely on the original contracts, set CB_API_VERSION to v1 (or omit it, as v1 is the default).
Crypto Operations
Advanced Usage
Using the API Setup Directly
Using the Deposit Service
Using the Withdraw Service
Using the Checkout Service
Error Handling
Validation
Retry Logic
Logging
Low-Level API Usage
For direct API access without the BerrySdk wrapper, you can use the generated API classes directly:
API Endpoints
All URIs are relative to http://0.0.0.0:3001/api/v2
| Class | Method | HTTP request | Description |
|---|---|---|---|
| AssetApi | assetV2ControllerGetSupportedAssetsV2 | GET /asset | |
| BroadcastApi | broadcastV2ControllerAddBroadcastUrlV2 | POST /broadcast | Add a new broadcast webhook URL |
| BroadcastApi | broadcastV2ControllerDeleteBroadcastUrlV2 | DELETE /broadcast/{id} | Delete a broadcast webhook URL |
| BroadcastApi | broadcastV2ControllerGetAllBroadcastUrlsV2 | GET /broadcast | Get all broadcast webhook URLs |
| CheckoutsApi | checkoutV2ControllerCreateCheckoutV2 | POST /checkouts | |
| CheckoutsApi | checkoutV2ControllerGetCheckoutPaymentV2 | GET /checkouts/payments/{paymentId} | |
| CheckoutsApi | checkoutV2ControllerGetCheckoutV2 | GET /checkouts/{paymentId} | |
| CheckoutsApi | checkoutV2ControllerUpdateCheckoutV2 | PATCH /checkouts | |
| ConvertApi | autoConversionV2ControllerAutoConversionV2 | POST /convert | |
| DepositAddressApi | depositAddressControllerGetDepositAddressV2 | POST /deposit-address | |
| DepositsApi | depositV2ControllerCreateDepositV2 | POST /deposits | |
| DepositsApi | depositV2ControllerGetDepositPaymentV2 | GET /deposits/payments/{paymentId} | |
| DepositsApi | depositV2ControllerGetDepositV2 | GET /deposits/{paymentId} | |
| KytApi | kytV2ControllerFetchKytStatusesV2 | POST /kyt/fetch-kyt-statuses | |
| KytApi | kytV2ControllerHandleMonitorNotificationV2 | POST /kyt | Process KYT monitor notification |
| OauthApi | oAuthV2ControllerTokenV2 | POST /oauth/token | |
| PartnersApi | partnerV2ControllerGetSettingsV2 | GET /partners/settings/{partnerId} | |
| PreWebhookApi | preWebhookV2ControllerHandlePreWebhookV2 | POST /pre-webhook | Pre-process indexer webhook events |
| PublicKeyApi | publicKeyV2ControllerDownloadPublicKeyV2 | GET /public-key | |
| QuicknodeApi | quickNodeControllerSubscribeV2 | POST /quicknode/subscribe | |
| TestApi | testV2ControllerInitParamsV2 | POST /test/init-params | Test the init params with JWT token and apiToken |
| TestApi | testV2ControllerTestCallbackV2 | POST /test/callback | |
| TestDevApi | devV2ControllerGetCurrentPartnerV2 | GET /test/dev/partners/me | |
| TestDevApi | devV2ControllerTestJwtV2 | GET /test/dev/jwt | Test the API with JWT token |
| TestDevApi | devV2ControllerTestSignatureGenerationV2 | POST /test/dev/signature-generation | Test the API with signature generation |
| TestDevApi | devV2ControllerTestSignatureVerificationMiddlewareV2 | POST /test/dev/signature-verification | Test the API with signature verification middleware. Requires apiToken in body. ApiToken is partnerId |
| TestnetIndexerApi | testnetIndexerControllerSubscribeV2 | POST /testnet-indexer/subscribe | |
| TransactionDetailApi | transactionDetailControllerCreateV2 | POST /transaction-detail | |
| TransactionDetailApi | transactionDetailControllerDeleteV2 | DELETE /transaction-detail/{id} | |
| TransactionDetailApi | transactionDetailControllerFindAllV2 | GET /transaction-detail | |
| TransactionDetailApi | transactionDetailControllerFindByHashV2 | GET /transaction-detail/hash/{hash} | |
| TransactionDetailApi | transactionDetailControllerFindByIdV2 | GET /transaction-detail/{id} | |
| TransactionDetailApi | transactionDetailControllerUpdateV2 | PUT /transaction-detail/{id} | |
| UiCustomizationApi | uiCustomizationControllerGetCustomUiV2 | GET /ui-customization/{paymentId} | |
| WebhookApi | webhookV2ControllerHandleWebhookV2 | POST /webhook | |
| WebhookApi | webhookV2ControllerHandleWebhookV2V2 | POST /webhook/v2 | |
| WithdrawApi | withdrawV2ControllerCreateWithdrawV2 | POST /withdraw | |
| WithdrawApi | withdrawV2ControllerGetWithdrawV2 | GET /withdraw/{paymentId} |
Models
- AddBroadcastUrlDto
- AutoConversionRequestV2Dto
- AutoConversionResponseV2Dto
- BroadcastV2ControllerAddBroadcastUrlV2200Response
- BroadcastV2ControllerGetAllBroadcastUrlsV2200ResponseInner
- CheckoutPaymentResponseV2Dto
- CheckoutResponseV2Dto
- CreateCheckoutRequestDto
- CreateTransactionDetailDto
- CustomUiDto
- DepositAddressResponseDto
- DepositRequestV2Dto
- DepositResponseV2Dto
- GetDepositAddressRequestDto
- InitTestParamsDto
- KytFetchStatusDto
- KytMonitorNotificationDto
- PartnerDto
- PartnerResponseV2Dto
- PaymentResponseV2Dto
- PaymentResponseV2DtoCryptoTransactionInfoInner
- QuickNodeSubscribeDto
- SettingsResponseV2Dto
- SettingsResponseV2DtoSupportedAssetsInner
- SubscribeRequestDto
- SubscribeResponseDto
- SuccessDto
- SupportedAssetDto
- SupportedAssetInfo
- TokenRequestDto
- TokenResponseDto
- TransactionDetailResponseDto
- UpdateCheckoutRequestDto
- UpdateTransactionDetailDto
- WithdrawRequestV2Dto
- WithdrawResponseV2Dto
- WithdrawV2Dto
- WithdrawV2DtoCryptoTransactionInfoInner
Authorization
Authentication schemes defined for the API:
bearer
- Type: Bearer authentication (JWT)
api-key
- Type: API key
- API key parameter name: x-api-key
- Location: HTTP header
Tests
To run the tests, use:
Author
About this package
This PHP package is automatically generated by the OpenAPI Generator project:
- API version:
2.23- Generator version:
7.17.0
- Generator version:
- Build package:
org.openapitools.codegen.languages.PhpClientCodegen
All versions of external-sdk-php with dependencies
ext-curl Version *
ext-json Version *
ext-mbstring Version *
guzzlehttp/guzzle Version ^7.3
guzzlehttp/psr7 Version ^1.7 || ^2.0