Download the PHP package banxa/php-sdk without Composer
On this page you can find all versions of the php package banxa/php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download banxa/php-sdk
More information about banxa/php-sdk
Files in banxa/php-sdk
Package php-sdk
Short Description Banxa Official PHP API SDK for partners
License MIT
Homepage https://banxa.com
Informations about the package php-sdk
Banxa official PHP SDK
Table of Contents
- General info
- Installation
- Authentication
- Domain, ApiKey and ApiSecret
- Dependencies
- Usage
- Sandbox
- Production
- Localisation
- Countries
- US States
- Currencies
- Fiat
- Crypto
- Payment Methods
- Buy & Sell order type
- Buy order type
- Sell order type
- Prices
- Buy order types
- Buy order type
- Sell order types
- Sell order type
- Orders
- Retrieving Order(s)
- Fetch orders
- Fetch order
- Order creation
- Creating a buy order
- Creating a NFT buy order
- Creating a sell order
- Confirm sell order
- Retrieving Order(s)
- Identity
- Create Identity
General info
The Banxa SDK is a plug and play ready to go implementation to access our services.
It allows for a simple and fast integration.
Installation
Install the package via composer
Authentication
ApiKey and ApiSecret
While on-boarding with banxa, you will be provided with API keys and a subdomain ([partnername].banxa.com),
initially these will be for the sandbox
environment.
Once you are done testing the implementation, you will receive the credentials to use the production environment.
Dependencies
PHP | Guzzle |
---|---|
^8.0 | ^7.0 |
Usage
Property | type | required | description |
---|---|---|---|
$subdomain |
string |
true |
The subdomain provided by banxa. ([partnername].banxa.com) |
$apiKey |
string |
true |
Given API key |
$apiSecret |
string |
true |
Given API Secret |
$testMode |
bool |
false |
Enable if testing, and provide sandbox api key and secret to method |
Sandbox
`
Production
`
Localisation
Countries
Global
Fetch all available countries
Result Example
US States
Fetch all available US States
Result Example
Currencies
Fiat
Buy order type
Fetch all available fiat currencies for buy order type.
Sell order type
Fetch all available fiat currencies for sell order type.
Result Example
Crypto
Buy order type
Fetch all cryptocurrencies for buy order type.
Sell order type
Fetch all cryptocurrencies for sell-order type.
Result Example
Payment Methods
Buy & Sell order type payment methods
Fetch all available payment providers for buy and sell order type
Result Example
Buy order type payment methods
Fetch all available payment providers for buy order type
Property | type | required | description |
---|---|---|---|
$fiatCode |
string |
true |
Fiat code e.g. 'USD' or 'EUR' see Fiat to get a list all available fiats |
$coinCode |
string |
true |
Coin code e.g. 'BTC' or 'ETH' see Crypto to get a list all available crypto |
Result Example
Sell order type payment methods
Fetch all available payment methods for sell order type
Property | type | required | description |
---|---|---|---|
$coinCode |
string |
true |
Coin code e.g. 'BTC' or 'ETH' see Crypto to get a list all available crypto |
$fiatCode |
string |
true |
Fiat code e.g. 'USD' or 'EUR' see Fiat to get a list all available fiats |
Result Example
Prices
Get prices for Payment Methods to obtain a payment method id for each specific fiat.
Buy order types pricing
Fetch all available prices for buy order type
Property | description | required | description |
---|---|---|---|
$fiatCode |
string |
true |
Fiat code e.g. 'USD' or 'EUR' see Fiat to get a list all available fiats |
$coinCode |
string |
true |
Coin code e.g. 'BTC' or 'ETH' see Crypto to get a list all available crypto |
$fiatAmount |
string/int/float |
true |
Fiat amount |
$blockchain |
string |
false |
Blockchain code e.g. 'ETH' or 'TRON' see Crypto to get a list all available blockchains per coin. |
Result Example
Buy order type pricing
Fetch single price for buy order type for a specific payment method
Property | type | required | required |
---|---|---|---|
$fiatCode |
string |
true |
Fiat code e.g. 'USD' or 'EUR' see Fiat to get a list all available fiats |
$coinCode |
string |
true |
Coin code e.g. 'BTC' or 'ETH' see Crypto to get a list all available crypto |
$fiatAmount |
string/int/float |
true |
Fiat amount |
$paymentMethodId |
string/int |
true |
Unique ID for the payment method that you want to get prices for. see Payment Methods to get a list of payment providers. |
$blockchain |
string |
false |
Blockchain code e.g. 'ETH' or 'TRON' see Crypto to get a list all available blockchains per coin. |
Result Example
Sell order types pricing
Fetch all available prices for sell order type
Property | type | required | description |
---|---|---|---|
$coinCode |
string |
true |
Coin code e.g. 'BTC' or 'ETH' see Crypto to get a list all available crypto |
$fiatCode |
string |
true |
Fiat code e.g. 'USD' or 'EUR' see Fiat to get a list all available fiats |
$coinAmount |
string/int/float |
true |
Crypto amount that will be used to calculate the fiat amount |
Result Example
Sell order type pricing
Fetch single price for buy order type for a specific payment method
Property | type | required | description |
---|---|---|---|
$coinCode |
string |
true |
Coin code e.g. 'BTC' or 'ETH' see Crypto to get a list all available crypto |
$fiatCode |
string |
true |
Fiat code e.g. 'USD' or 'EUR' see Fiat to get a list all available fiats |
$coinAmount |
string/int/float |
true |
Crypto amount that will be used to calculate |
$paymentMethodId |
string/int |
true |
Unique ID for the payment method that you want to get prices for. see Payment Methods to get a list of payment providers. |
Result Example
Orders
Retrieving orders
Fetch orders
Fetch all orders within a specific time range. (paginated)
Property | type | required | description |
---|---|---|---|
$startDate |
string |
true |
Start date used for filtering orders. Must be a date in the format YYYY-MM-DD. |
$endDate |
string |
true |
End date used for filtering orders. Must be a date in the format YYYY-MM-DD. |
$statuses |
array |
false |
One or many order statuses (see 'Available Statuses') |
$perPage |
string/int |
false |
Page size. |
$page |
string/int |
false |
Page to retrieve. |
$accountReference |
string |
false |
Customer reference that was passed as a parameter when creating an order. Used to retrieve all orders for a customer. |
Available Statuses |
---|
OrderStatus::PENDING_PAYMENT |
OrderStatus::WAITING_PAYMENT |
OrderStatus::PAYMENT_RECEIVED |
OrderStatus::IN_PROGRESS |
OrderStatus::COIN_TRANSFERRED |
OrderStatus::CANCELLED |
OrderStatus::DECLINED |
OrderStatus::EXPIRED |
OrderStatus::COMPLETE |
OrderStatus::REFUNDED |
Result Example
Fetch order
Fetch single order
Property | description | required | description |
---|---|---|---|
$orderId |
string |
true |
Unique ID of the order to retrieve |
Result Example
Creating orders
Allows your customer to create a buy or sell crypto order with Banxa. Upon success, the response will contain a checkout URL which will be unique for the order. The customer will be redirected to this URL to complete the checkout process, which will expire after 1 minute if a redirect does not occur.
When creating an order you will be required to create a BuyOrderTransaction/SellOrderTransaction/NftBuyOrderTransaction object. This object will allow you to create a transaction using a fiat amount, coin amount, or if you require both, you can specify your own amount using the createDynamic method, this will depend on your business use case.
Creating a buy order
Property | type | required | description |
---|---|---|---|
$buyOrderTransaction |
Object |
true |
BuyOrderTransaction object |
$returnUrlOnSuccess |
string |
true |
The return url on success |
$returnUrlOnFailure |
string |
false |
The return url on failure |
$returnUrlOnCancelled |
string |
false |
The return url on cancelled |
$metadata |
string |
false |
Free form string that you can use to send us any information that will be returned in the Get Orders endpoint |
$readOnlyAmounts |
boolean |
false |
Will cause the cryptocurrency and fiat amounts on the Banxa screens to be read-only and un-editable. |
$iframeRefererDomain |
string |
false |
Used if you are embedding an iFrame. This must be the exact domain where the iFrame will be hosted. e.g. [yourCompany].com. Do not include https:// in front of the domain. |
$optionalOrderParameters |
Object |
false |
optionalOrderParameters object |
BuyOrderTransaction using Fiat as base amount
Property | type | required | description |
---|---|---|---|
$accountReference |
string |
true |
The customer's unique ID |
$fiatCode |
string |
true |
Fiat code e.g. 'USD' or 'EUR' see Fiat to get a list all available fiats |
$coinCode |
string |
true |
Coin code e.g. 'BTC' or 'ETH' see Crypto to get a list all available crypto |
$fiatAmount |
string/float |
true |
Fiat amount |
$walletAddress |
string |
true |
The target wallet address to transfer the coin to |
$paymentMethodId |
int/string |
false |
Unique ID for the payment method that you want to get prices for. see Payment Methods to get a list of payment providers. |
$blockchain |
string |
false |
Blockchain code, the list of available blockchains per coin see Crypto for all available blockchains per coin |
$walletAddressTag |
string |
false |
Wallet tag or memo associated with the wallet address. Should be sent for buy cryptocurrency orders only for BNB (Memo) or XRP (Tag). |
BuyOrderTransaction using Coin as base amount
Property | type | required | description |
---|---|---|---|
$accountReference |
string |
true |
The customer's unique ID |
$fiatCode |
string |
true |
Fiat code e.g. 'USD' or 'EUR' see Fiat to get a list all available fiats |
$coinCode |
string |
true |
Coin code e.g. 'BTC' or 'ETH' see Crypto to get a list all available crypto |
$coinAmount |
string/float |
true |
The coin amount |
$walletAddress |
string |
true |
The target wallet address to transfer the coin to |
$paymentMethodId |
int/string |
false |
Unique ID for the payment method that you want to get prices for. see Payment Methods to get a list of payment providers. |
$blockchain |
string |
false |
Blockchain code, the list of available blockchains per coin see Crypto for all available blockchains per coin |
$walletAddressTag |
string |
false |
Wallet tag or memo associated with the wallet address. Should be sent for buy cryptocurrency orders only for BNB (Memo) or XRP (Tag). |
BuyOrderTransaction using dynamic sourceAmount or targetAmount
When using BuyOrderTransaction::createDynamic you will need to specify
$source
(Fiat),$target
(Coin), and either$sourceAmount
or$targetAmount
Property | type | required | description |
---|---|---|---|
$accountReference |
string |
true |
The customer's unique ID |
$source |
string |
true |
Fiat code e.g. 'USD' or 'EUR' see Fiat to get a list all available fiats |
$target |
string |
true |
Coin code e.g. 'BTC' or 'ETH' see Crypto to get a list all available crypto |
$sourceAmount |
string/float/null |
true |
Source amount - null if targetAmount is set |
$targetAmount |
string/float/null |
true |
Target amount - null if sourceAmount is set |
$walletAddress |
string/null |
true |
The target wallet address to transfer the coin to - For Buy orders only |
$refundAddress |
string/null |
true |
The refund wallet address - For sell orders only |
$paymentMethodId |
int/string |
false |
Unique ID for the payment method that you want to get prices for. see Payment Methods to get a list of payment providers. |
$blockchain |
string |
false |
Blockchain code, the list of available blockchains per coin see Crypto for all available blockchains per coin |
$walletAddressTag |
string |
false |
Wallet tag or memo associated with the wallet address. Should be sent for buy cryptocurrency orders only for BNB (Memo) or XRP (Tag). |
optionalOrderParameters
Property | type | required | description |
---|---|---|---|
$sourceAddress |
string/null |
false |
Source wallet address. Should be sent for sell cryptocurrency orders only. |
$sourceAddressTag |
string/null |
false |
Source wallet address tag or memo. Should be sent for sell cryptocurrency orders only. Required when source wallet address for BNB (Memo) or XRP (Tag). |
$email |
string/null |
false |
Customer's email address. This will pre-populate the customers' email address field when they are redirected to Banxa checkout |
$mobile |
string/null |
false |
Customer's mobile number. This will pre-populate the customers' mobile number field when they are redirected to Banxa checkout |
Buy order full example
Result Example
Creating a NFT buy order
Property | type | required | description |
---|---|---|---|
$nftBuyOrderTransaction |
Object |
true |
NftBuyOrderTransaction object |
$nftData |
Object |
true |
NftData object |
$returnUrlOnSuccess |
string |
true |
The return url on success |
$returnUrlOnFailure |
string |
false |
The return url on failure |
$returnUrlOnCancelled |
string |
false |
The return url on cancelled |
$iframeRefererDomain |
string |
false |
Used if you are embedding an iFrame. This must be the exact domain where the iFrame will be hosted. e.g. [yourCompany].com. Do not include https:// in front of the domain. |
NftBuyOrderTransaction
Property | type | required | description |
---|---|---|---|
$accountReference |
string |
true |
The customer's unique ID |
$fiatCode |
string |
true |
Fiat code e.g. 'USD' or 'EUR' see Fiat to get a list all available fiats |
$coinCode |
string |
true |
Coin code e.g. 'BTC' or 'ETH' see Crypto to get a list all available crypto |
$fiatAmount |
string/float |
true |
Fiat amount |
$walletAddress |
string |
true |
The target wallet address to transfer the coin to |
$paymentMethodId |
int/string |
false |
Unique ID for the payment method that you want to get prices for. see Payment Methods to get a list of payment providers. |
$blockchain |
string |
false |
Blockchain code, the list of available blockchains per coin see Crypto for all available blockchains per coin |
$blockchain |
string |
false |
Blockchain code, the list of available blockchains per coin see Crypto for all available blockchains per coin |
$walletAddressTag |
string |
false |
Wallet tag or memo associated with the wallet address. Should be sent for buy cryptocurrency orders only for BNB (Memo) or XRP (Tag). |
NftData
Property | type | required | description |
---|---|---|---|
$purchaseReference |
string |
true |
A reference of the purchase |
$nft |
Object |
true |
Nft object |
$metaData |
array |
false |
Array of metaData |
Nft
Property | type | required | description |
---|---|---|---|
$name |
string |
true |
The name of the NFT |
$collection |
string |
true |
The Collection the NFT |
$nftMedia |
object |
true |
NftMedia object |
Create VideoNftMedia
Create ImageNftMedia
Property | type | required | description |
---|---|---|---|
link |
string |
true |
A link to the Nft video |
Nft buy order full example
Result Example
Creating a Sell order
Property | type | required | description |
---|---|---|---|
$sellOrderTransaction |
Object |
true |
SellOrdertransaction object |
$returnUrlOnSuccess |
string |
true |
The return url on success |
$returnUrlOnFailure |
string |
false |
The return url on failure |
$returnUrlOnCancelled |
string |
false |
The return url on cancelled |
$metadata |
string |
false |
Free form string that you can use to send us any information that will be returned in the Get Orders endpoint |
$readOnlyAmounts |
boolean |
false |
Will cause the cryptocurrency and fiat amounts on the Banxa screens to be read-only and un-editable. |
$iframeRefererDomain |
string |
false |
Used if you are embedding an iFrame. This must be the exact domain where the iFrame will be hosted. e.g. [yourCompany].com. Do not include https:// in front of the domain. |
$optionalOrderParameters |
Object |
false |
optionalOrderParameters object |
SellOrderTransaction using Fiat as base amount
Property | type | required | description |
---|---|---|---|
$accountReference |
string |
true |
The customer's unique ID |
$fiatCode |
string |
true |
Fiat code e.g. 'USD' or 'EUR' see Fiat to get a list all available fiats |
$coinCode |
string |
true |
Coin code e.g. 'BTC' or 'ETH' see Crypto to get a list all available crypto |
$fiatAmount |
string/float |
true |
Fiat amount |
$refundAddress |
string |
true |
The refund wallet address if the order gets rejected |
$paymentMethodId |
int/string |
false |
Unique ID for the payment method that you want to get prices for. see Payment Methods to get a list of payment providers. |
$blockchain |
string |
false |
Blockchain code, the list of available blockchains per coin see Crypto for all available blockchains per coin |
$walletAddressTag |
string |
false |
Wallet tag or memo associated with the wallet address. Should be sent for buy cryptocurrency orders only for BNB (Memo) or XRP (Tag). |
sellOrderTransaction using Coin as base amount
Property | type | required | description |
---|---|---|---|
$accountReference |
string |
true |
The customer's unique ID |
$fiatCode |
string |
true |
Fiat code e.g. 'USD' or 'EUR' see Fiat to get a list all available fiats |
$coinCode |
string |
true |
Coin code e.g. 'BTC' or 'ETH' see Crypto to get a list all available crypto |
$coinAmount |
string/float |
true |
The coin amount |
$refundAddress |
string |
true |
The refund wallet address if the order gets rejected |
$paymentMethodId |
int/string |
false |
Unique ID for the payment method that you want to get prices for. see Payment Methods to get a list of payment providers. |
$blockchain |
string |
false |
Blockchain code, the list of available blockchains per coin see Crypto for all available blockchains per coin |
$walletAddressTag |
string |
false |
Wallet tag or memo associated with the wallet address. Should be sent for buy cryptocurrency orders only for BNB (Memo) or XRP (Tag). |
sellOrderTransaction using dynamic sourceAmount or targetAmount
When using SellOrderTransaction::createDynamic you will need to specify
$source
(Coin),$target
(Fiat), and either$sourceAmount
or$targetAmount
Property | type | required | description |
---|---|---|---|
$accountReference |
string |
true |
The customer's unique ID |
$source |
string |
true |
Fiat code e.g. 'USD' or 'EUR' see Fiat to get a list all available fiats |
$target |
string |
true |
Coin code e.g. 'BTC' or 'ETH' see Crypto to get a list all available crypto |
$sourceAmount |
string/float/null |
true |
Source amount - null if targetAmount is set |
$targetAmount |
string/float/null |
true |
Target amount - null if sourceAmount is set |
$walletAddress |
string/null |
true |
The target wallet address to transfer the coin to - For Buy orders only |
$refundAddress |
string/null |
true |
The refund wallet address - For sell orders only |
$paymentMethodId |
int/string |
false |
Unique ID for the payment method that you want to get prices for. see Payment Methods to get a list of payment providers. |
$blockchain |
string |
false |
Blockchain code, the list of available blockchains per coin see Crypto for all available blockchains per coin |
$walletAddressTag |
string |
false |
Wallet tag or memo associated with the wallet address. Should be sent for buy cryptocurrency orders only for BNB (Memo) or XRP (Tag). |
optionalOrderParameters
Property | type | required | description |
---|---|---|---|
$sourceAddress |
string/null |
false |
Source wallet address. Should be sent for sell cryptocurrency orders only. |
$sourceAddressTag |
string/null |
false |
Source wallet address tag or memo. Should be sent for sell cryptocurrency orders only. Required when source wallet address for BNB (Memo) or XRP (Tag). |
$email |
string/null |
false |
Customer's email address. This will pre-populate the customers' email address field when they are redirected to Banxa checkout |
$mobile |
string/null |
false |
Customer's mobile number. This will pre-populate the customers' mobile number field when they are redirected to Banxa checkout |
Sell order full example
Result Example
Confirm sell order
Once the coin amount transfer for a Sell Order has been executed,
Banxa must be notified by sending a request to this endpoint with transaction hash, source and destination wallet address details.
Property | type | required | description |
---|---|---|---|
$orderId |
string |
true |
Unique ID for the the order |
$txHash |
string |
true |
Blockchain transaction hash of the order |
$sourceAddress |
string |
true |
The provided customer's source wallet address |
$destinationAddress |
string |
true |
The wallet address provided to merchants to transact to |
$sourceAddressTag |
string |
false |
The customer's source wallet address tag if the provided source wallet address requires it |
$destinationAddressTag |
string |
false |
The wallet address tag provided to merchants if the provided destination wallet address requires it |
Result Example
Identity
Create Identity
Allows you to share customer details with Banxa before an Order is created.
This reduces the need for customers to re-submit personal details and upload KYC documentation during the Banxa checkout flow.
Detailed guide on how to implement this API can be found here. You can also find Testing information here
Property | type | required | description |
---|---|---|---|
$identitySharingCollection |
Object |
true |
IdentitySharingCollection object |
$customerDetails |
Object |
true |
CustomerDetail object |
$residentialAddress |
Object |
true |
ResidentialAddress object |
$customerIdentity |
Object |
true |
CustomerIdentity object |
$identityDocumentCollection |
Object |
false |
IdentityDocumentCollection object |
IdentitySharingCollection
Property | type | required | description |
---|---|---|---|
$kycProviders |
array |
true |
array of IdentityProvider objects |
IdentitySharingProvider
Property | type | required | description |
---|---|---|---|
$provider |
string |
true |
Name of the provider e.g. 'sumsub' |
$token |
string |
true |
The unique provider token |
CustomerDetail
Property | type | required | description |
---|---|---|---|
$accountReference |
string |
true |
Unique customer reference provided by you. This should be the same value that is passed when calling the calling the Create Order endpoint. |
$mobileNumber |
string |
true |
Mobile number of customer |
$emailAddress |
string |
true |
Email address of customer |
ResidentialAddress
Property | type | required | description |
---|---|---|---|
$country |
string |
true |
Customer's country of residence. Required to be formatted using ISO 3166 two-letter country code e.g. "US" or "AU". |
$addressLine |
string |
false |
Customer's Street number, street name and street type/suffix. |
$suburb |
string |
false |
Customer's Address city or suburb. E.g. "2 Abbey Road". |
$postCode |
string |
false |
Customer's Address postal / PIN / ZIP code. |
$state |
string |
false |
Customer's Address state / region. |
CustomerIdentity
Property | type | required | description |
---|---|---|---|
$givenName |
string |
true |
Customer's Customer's given / first name. |
$surname |
string |
true |
Customer's surname / last name. |
$dateOfBirth |
string |
false |
Customer's Customer's date of birth (e.g. "1985-01-31"). Required to format as ISO 8601 Date format : YYYY-MM-DD. |
IdentityDocumentCollection
Property | type | description |
---|---|---|
$documents |
array |
An Array holding IdentityDocument objects |
IdentityDocument
Property | type | required | description |
---|---|---|---|
$documentType |
string |
true |
The document type (see 'Available document types') |
$imageLinks |
array |
true |
Array of image links for the documents type |
$documentNumber |
string |
true when document type is PASSPORT/IDENTIFICATION/DRIVING_LICENSE |
The document number, located on the document |
Available document types |
---|
IdentityDocument::DOCUMENT_TYPE_DRIVING_LICENCE |
IdentityDocument::DOCUMENT_TYPE_PASSPORT |
IdentityDocument::DOCUMENT_TYPE_IDENTIFICATION |
IdentityDocument::DOCUMENT_TYPE_SELFIE |
IdentityDocument::DOCUMENT_TYPE_PROOF_OF_ADDRESS |
Full Example
Result Example