banxa / php-sdk
Banxa官方PHP API SDK,适用于合作伙伴
Requires
- php: ^8.0
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- mockery/mockery: ^1.5
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-29 01:43:09 UTC
README
Banxa官方PHP SDK
目录
基本信息
Banxa SDK是一个即插即用的实现,可用于访问我们的服务。
它允许进行简单快速的集成。
安装
通过composer安装此包
composer require banxa/php-sdk
身份验证
ApiKey和ApiSecret
在Banxa入驻过程中,您将获得API密钥和一个子域名([partnername].banxa.com),
最初这些将用于沙盒环境。一旦您完成测试实施,您将收到用于生产环境的凭证。
依赖关系
使用方法
Banxa::create($subdomain, $apiKey, $apiSecret, $testMode)
沙盒环境
$subdomain = 'partner'; $sandboxApiKey = 'xxx-xxx-xxx-xxx-xxx'; $sandboxApiSecret = 'xxxx-xxxx-xxxx-xxxx'; $testMode = true; Banxa::create($subdomain, $sandboxApiKey, $sandboxApiSecret, $testMode)
生产环境
$subdomain = 'partner'; $apiKey = 'xxx-xxx-xxx-xxx-xxx'; $apiSecret = 'xxxx-xxxx-xxxx-xxxx'; Banxa::create($subdomain, $apiKey, $apiSecret)
本地化
国家
全局
获取所有可用的国家
$banxa->getCountries()
结果示例
[
[
"country_code" => "AD",
"country_name" => "Andora"
],
[
"country_code" => "AE",
"country_name" => "United Arab Emirates"
],
]
美国州
获取所有可用的美国州
$banxa->getUsStates()
结果示例
[
[
"state_code" => "AL",
"state_name" => "Alabama"
],
[
"state_code" => "AK",
"state_name" => "Alaska"
],
]
货币
法定货币
购买订单类型
获取所有可用的法定货币(用于购买订单类型)。
$banxa->getBuyFiatCurrencies()销售订单类型
获取所有可用的法定货币(用于销售订单类型)。
$banxa->getSellFiatCurrencies()
结果示例
[
[
"fiat_code" => "EUR",
"fiat_name" => "Euro",
"fiat_symbol" => "€",
],
[
"fiat_code" => "GBP",
"fiat_name" => "British Pound Sterling",
"fiat_symbol" => "£",
],
]
加密货币
购买订单类型
获取所有可用的加密货币(用于购买订单类型)。
$banxa->getBuyCryptoCurrencies()销售订单类型
获取所有可用的加密货币(用于销售订单类型)。
$banxa->getSellCryptoCurrencies()
结果示例
[
[
"coin_code"=> "BTC",
"coin_name"=> "Bitcoin",
"blockchains"=> [
[
"code"=> "BTC",
"description"=> "Bitcoin",
"is_default"=> true
]
]
],
[
"coin_code"=> "ETH",
"coin_name"=> "Ethereum",
"blockchains"=> [
[
"code"=> "ETH",
"description"=> "Ethereum (ERC-20)",
"is_default"=> true
],
[
"code"=> "MATIC",
"description"=> "Polygon",
"is_default"=> false
]
]
]
]
支付方式
买卖订单类型的支付方式
获取买卖订单类型所有可用的支付提供者
$banxa->getAllPaymentMethods()
结果示例
[
[
"id" => 6036,
"paymentType" => "WORLDPAYCREDIT",
"name" => "Visa/Mastercard",
"description" => "Conveniently buy digital currency using your personal VISA or MasterCard.",
"logo_url" => "https://partner.banxa.com/images/payment-providers/worlpaycredit.png",
"status" => "ACTIVE",
"supported_agents" => [
[
"os" => "ios",
"browser" => "safari"
],
[
"os" => "macos",
"browser" => "safari"
],
[
"os" => "ipados",
"browser" => "safari"
]
],
"type" => "FIAT_TO_CRYPTO",
"supported_fiat" => [
"AED",
],
"transaction_fees" => [
[
"fiat_code" => "AED",
"coin_code" => "BTC",
"fees" => [
[
"name" => "surcharge",
"amount" => 3,
"type" => "fixed"
]
]
],
]
],
[
"id" => 6036,
"paymentType" => "WORLDPAYAPPLE",
"name" => "Apple Pay",
"description" => "Conveniently buy digital currency using your Apple Pay wallet.",
"logo_url" => "https://partner.banxa.com/images/payment-providers/apple-pay.png",
"status" => "ACTIVE",
"supported_agents" => [
[
"os" => "ios",
"browser" => "safari"
],
[
"os" => "macos",
"browser" => "safari"
],
[
"os" => "ipados",
"browser" => "safari"
]
],
"type" => "CRYPTO_TO_FIAT",
"supported_fiat" => [
"AED",
],
"transaction_fees" => [
[
"fiat_code" => "AED",
"coin_code" => "BTC",
"fees" => [
[
"name" => "surcharge",
"amount" => 3,
"type" => "fixed"
]
]
],
]
]
];
购买订单类型的支付方式
获取购买订单类型所有可用的支付提供者
$banxa->getBuyPaymentMethods($fiatCode, $coinCode)
结果示例
[ "id" => 6036, "paymentType" => "WORLDPAYAPPLE", "name" => "Apple Pay", "description" => "Conveniently buy digital currency using your Apple Pay wallet.", "logo_url" => "https://partner.banxa.com/images/payment-providers/apple-pay.png", "status" => "ACTIVE", "supported_agents" => [ [ "os" => "ios", "browser" => "safari" ], [ "os" => "macos", "browser" => "safari" ], [ "os" => "ipados", "browser" => "safari" ] ], "type" => "FIAT_TO_CRYPTO", "supported_fiat" => [ "AED", ], "transaction_fees" => [ [ "fiat_code" => "AED", "coin_code" => "BTC", "fees" => [ [ "name" => "surcharge", "amount" => 3, "type" => "fixed" ] ] ], ] ]
销售订单类型的支付方式
获取销售订单类型所有可用的支付方式
$banxa->getSellPaymentMethods($coinCode, $fiatCode)
结果示例
[ "id" => 6036, "paymentType" => "DIRECTCREDIT", "name" => "Bank Transfer", "description" => "Sell digital currency to us and have the value directly credited to your bank account", "logo_url" => "https://partner.banxa.com/images/payment-providers/directcredit.png", "status" => "ACTIVE", "supported_agents" => [ [ "os" => "ios", "browser" => "safari" ], [ "os" => "macos", "browser" => "safari" ], [ "os" => "ipados", "browser" => "safari" ] ], "type" => "CRYPTO_TO_FIAT", "supported_fiat" => [ "AED", ], "transaction_fees" => [ [ "fiat_code" => "AED", "coin_code" => "BTC", "fees" => [ [ "name" => "surcharge", "amount" => 3, "type" => "fixed" ] ] ], ] ]
价格
获取支付方式的价格,以获取每个特定法定货币的支付方式ID。
购买订单类型定价
获取购买订单类型所有可用的价格
$banxa->getAllBuyPrices( $fiatCode, $coinCode, $fiatAmount, $blockchain )
结果示例
[
"spot_price" => "1.07",
"prices" => [
[
"payment_method_id" => 6047,
"type" => "FIAT_TO_CRYPTO",
"spot_price_fee" => "0.00",
"spot_price_including_fee" => "1.07",
"coin_amount" => "93.84000000",
"coin_code" => "USDT",
"fiat_amount" => "100.00",
"fiat_code" => "USD",
"fee_amount" => "0.00",
"network_fee" => "2.37"
],
[
"payment_method_id" => 6058,
"type" => "FIAT_TO_CRYPTO",
"spot_price_fee" => "0.00",
"spot_price_including_fee" => "1.09",
"coin_amount" => "93.84000000",
"coin_code" => "USDT",
"fiat_amount" => "100.00",
"fiat_code" => "USD",
"fee_amount" => "0.00",
"network_fee" => "2.37"
]
]
]
购买订单类型定价
获取特定支付方式的购买订单类型单个价格
$banxa->getBuyPrice( $fiatCode, $coinCode, $fiatAmount, $paymentMethodId, $blockchain )
结果示例
[
"payment_method_id" => 6058,
"type" => "FIAT_TO_CRYPTO",
"spot_price_fee" => "0.00",
"spot_price_including_fee" => "1.09",
"coin_amount" => "93.84000000",
"coin_code" => "USDT",
"fiat_amount" => "100.00",
"fiat_code" => "USD",
"fee_amount" => "0.00",
"network_fee" => "2.37"
]
销售订单类型定价
获取销售订单类型所有可用的价格
$banxa->getAllSellPrices( $coinCode, $fiatCode, $coinAmount )
结果示例
[
"spot_price" => "1.07",
"prices" => [
[
"payment_method_id" => 6045,
"type" => "CRYPTO_TO_FIAT",
"spot_price_fee" => "0.00",
"spot_price_including_fee" => "32500.00",
"coin_amount" => "0.02000000",
"coin_code" => "BTC",
"fiat_amount" => "100.00",
"fiat_code" => "AUD",
"fee_amount" => "0.00",
"network_fee" => "0.00"
],
[
"payment_method_id" => 6046,
"type" => "CRYPTO_TO_FIAT",
"spot_price_fee" => "0.00",
"spot_price_including_fee" => "32500.00",
"coin_amount" => "0.04000000",
"coin_code" => "BTC",
"fiat_amount" => "650.00",
"fiat_code" => "AUD",
"fee_amount" => "0.00",
"network_fee" => "0.00"
],
]
]
销售订单类型定价
获取特定支付方式的购买订单类型单个价格
$banxa->getSellPrice( $coinCode, $fiatCode, $coinAmount, $paymentMethodId )
结果示例
[
"payment_method_id" => 6033,
"type" => "CRYPTO_TO_FIAT",
"spot_price_fee" => "0.00",
"spot_price_including_fee" => "1.09",
"coin_amount" => "93.84000000",
"coin_code" => "USDT",
"fiat_amount" => "100.00",
"fiat_code" => "USD",
"fee_amount" => "0.00",
"network_fee" => "2.37"
]
订单
检索订单
获取订单
获取特定时间范围内的所有订单。(分页)
$banxa->getOrders( $startDate, $endDate, $statuses, $perPage, $page, $accountReference )
结果示例
[
[
"id" => "e7f3d4e436c8925af84a391f317aaa6e",
"account_id" => "ebfef819583ff4573e6db307abd9c126",
"account_reference" => "banxa-account",
"order_type" => "CRYPTO-BUY",
"ref" => 501903,
"country" => "AU",
"fiat_code" => "AUD",
"fiat_amount" => 100,
"coin_code" => "BTC",
"coin_amount" => 0.00704583,
"wallet_address" => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"wallet_address_tag" => null,
"fee" => 0,
"fee_tax" => 0,
"payment_fee" => 2.14,
"payment_fee_tax" => 0.19,
"commission" => 0,
"tx_hash" => "sync-tx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"tx_confirms" => 10,
"created_date" => "01-Jul-2022",
"created_at" => "01-Jul-2022 07:51:18",
"payment_type" => "WorldPay Credit Card",
"status" => "complete",
"completed_at" => "01-Jul-2022 07:55:19",
"merchant_fee" => 0,
"merchant_commission" => 0,
"meta_data" => null,
"blockchain" => [
"code" => "BTC",
"description" => "Bitcoin"
]
],
[
"id" => "b719377e3541921297ebef33016fb068",
"account_id" => "ebfef819583ff4573e6db307abd9c126",
"account_reference" => "banxa-account",
"order_type" => "CRYPTO-BUY",
"ref" => 501902,
"country" => "AU",
"fiat_code" => "AUD",
"fiat_amount" => 320,
"coin_code" => "BTC",
"coin_amount" => 0.02255405,
"wallet_address" => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"wallet_address_tag" => null,
"fee" => 0,
"fee_tax" => 0,
"payment_fee" => 6.83,
"payment_fee_tax" => 0.62,
"commission" => 0,
"tx_hash" => "sync-tx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"tx_confirms" => 10,
"created_date" => "01-Jul-2022",
"created_at" => "01-Jul-2022 07:51:18",
"payment_type" => "WorldPay Credit Card",
"status" => "complete",
"completed_at" => "01-Jul-2022 07:55:19",
"merchant_fee" => 0,
"merchant_commission" => 0,
"meta_data" => null,
"blockchain" => [
"code" => "BTC",
"description" => "Bitcoin"
]
]
]
获取单个订单
获取单个订单
$banxa->getOrder($orderId);
结果示例
[
"id" => "b719377e3541921297ebef33016fb068",
"account_id" => "ebfef819583ff4573e6db307abd9c126",
"account_reference" => "banxa-account",
"order_type" => "CRYPTO-BUY",
"ref" => 501902,
"country" => "AU",
"fiat_code" => "AUD",
"fiat_amount" => 320,
"coin_code" => "BTC",
"coin_amount" => 0.02255405,
"wallet_address" => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"wallet_address_tag" => null,
"fee" => 0,
"fee_tax" => 0,
"payment_fee" => 6.83,
"payment_fee_tax" => 0.62,
"commission" => 0,
"tx_hash" => "sync-tx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"tx_confirms" => 10,
"created_date" => "01-Jul-2022",
"created_at" => "01-Jul-2022 07:51:18",
"payment_type" => "WorldPay Credit Card",
"status" => "complete",
"completed_at" => "01-Jul-2022 07:55:19",
"merchant_fee" => 0,
"merchant_commission" => 0,
"meta_data" => null,
"blockchain" => [
"code" => "BTC",
"description" => "Bitcoin"
]
]
创建订单
允许您的客户使用Banxa创建购买或销售加密货币订单。成功后,响应将包含一个唯一的结账URL。客户将被重定向到该URL以完成结账流程,如果1分钟内未发生重定向,则该URL将过期。
在创建订单时,您需要创建一个BuyOrderTransaction/SellOrderTransaction/NftBuyOrderTransaction对象。此对象允许您使用法定金额、代币金额或如果您需要两者,可以使用createDynamic方法指定自己的金额,这取决于您的业务用例。
创建购买订单
$banxa->createBuyOrder( $buyOrderTransaction, $returnUrlOnSuccess, $returnUrlOnFailure, $returnUrlOnCancelled, $metadata, $readOnlyAmounts, $iframeRefererDomain, $optionalOrderParameters );
使用法定货币作为基准金额的BuyOrderTransaction
$buyOrderTransaction = BuyOrderTransaction::createFromFiatAmount( $accountReference, $fiatCode, $coinCode, $fiatAmount, $walletAddress, $paymentMethodId );
使用代币作为基准金额的BuyOrderTransaction
$buyOrderTransaction = BuyOrderTransaction::createFromCoinAmount( $accountReference, $fiatCode, $coinCode, $coinAmount, $walletAddress, $paymentMethodId );
使用动态sourceAmount或targetAmount的BuyOrderTransaction
当使用BuyOrderTransaction::createDynamic时,您需要指定
$source(法定货币),$target(代币),以及$sourceAmount或$targetAmount之一$buyOrderTransaction = BuyOrderTransaction::createDynamic( $accountReference, $source, $target, $sourceAmount, $targetAmount, $walletAddress, $refundAddress, $paymentMethodId, $blockchain, $walletAddressTag );
可选订单参数
$optionalOrderParameters = optionalOrderParameters::create( $sourceAddress, $sourceAddressTag, $email, $mobile, );
购买订单完整示例
$buyOrderTransaction = BuyOrderTransaction::createFromFiatAmount($accountReference, $fiatCode, $coinCode, $fiatAmount, $walletAddress, $paymentMethodId, $blockchain, $walletAddressTag);// From Fiat Amount$buyOrderTransaction = BuyOrderTransaction::createFromCoinAmount($accountReference, $fiatCode, $coinCode, $coinAmount, $walletAddress, $paymentMethodId, $blockchain, $walletAddressTag);// From Coin Amount$buyOrderTransaction = BuyOrderTransaction::createDynamic($accountReference, $source, $target, $sourceAmount, null, $walletAddress, null, $paymentMethodId, $blockchain, $walletAddressTag); // Dynamic$buyOrderTransaction = BuyOrderTransaction::createDynamic($accountReference, $source, $target, null, $targetAmount, $walletAddress, null, $paymentMethodId, $blockchain, $walletAddressTag); // Dynamic$optionalOrderParameters = OptionalOrderParameters::create($sourceAddress, $sourceAddressTag, $email, $mobile);$banxa->createBuyOrder( $buyOrderTransaction, $returnUrlOnSuccess, $returnUrlOnFailure, $returnUrlOnCancelled, $metadata, $readOnlyAmounts, $iframeRefererDomain, $optionalOrderParameters );结果示例
[ "id" => "b890df4aee4583a25ca8da17eb863c81", "account_id" => "3ec8d3c67617af11d84a18931c4e369d", "account_reference" => "banxa-test-01", "order_type" => "CRYPTO-BUY", "fiat_code" => "AUD", "fiat_amount" => 1, "coin_code" => "BTC", "wallet_address" => "1LbQ1WNTsm1Nzj1hbh3WDCbEim1oUg5rfi", "blockchain" => [ "id" => 1, "code" => "BTC", "description" => "Bitcoin" ], "created_at" => "17-Aug-2022 00:09:03", "checkout_url" => "https://your-return-url" ]
创建NFT购买订单
$banxa->createNftBuyOrder( $nftBuyOrderTransaction, $nftData, $returnUrlOnSuccess, $returnUrlOnFailure, $returnUrlOnCancelled, $iframeRefererDomain );
NftBuyOrderTransaction
$nftBuyOrderTransaction = NftBuyOrderTransaction::create( $accountReference, $fiatCode, $coinCode, $fiatAmount, $walletAddress, $paymentMethodId = null, $blockchain = null, $walletAddressTag = null );
非同质化代币数据
$nftData = NftData::create( $purchaseReference, $nft, $metaData );
非同质化代币
$nft = Nft::create( $name, $collection, $nftMedia, );
创建视频NftMedia
$nftMedia = VideoNftMedia::create($link);创建图像NftMedia
$nftMedia = ImageNftMedia::create($link);
Nft购买订单完整示例
$nftBuyOrderTransaction = NftBuyOrderTransaction::create( $accountReference, $fiatCode, $coinCode, $fiatAmount, $walletAddress, $paymentMethodId, $blockchain, $walletAddressTag ); $nftMedia = ImageNftMedia::create($link); // OR $nftMedia = VideoNftMedia::create($link) $nft = Nft::create( $name, $collection, $nftMedia, ); $nftData = NftData::create( $purchaseReference, $nft, $metaData ); $banxa->createNftBuyOrder( $nftBuyOrderTransaction, $nftData, $returnUrlOnSuccess, $returnUrlOnFailure, $returnUrlOnCancelled, $iframeRefererDomain, );结果示例
[ "id" => "b890df4aee4583a25ca8da17eb863c81", "account_id" => "3ec8d3c67617af11d84a18931c4e369d", "account_reference" => "Banxa-Testing-01", "order_type" => "NFT-BUY", "blockchain" => [ "id" => 1, "code" => "ETH", "description" => "Ethereum (ERC-20)" ], "created_at" => "17-Aug-2022 00:09:03", "checkout_url" => "https://your-return-url" ]
创建卖出订单
$banxa->createSellOrder( $sellOrderTransaction, $returnUrlOnSuccess, $returnUrlOnFailure, $returnUrlOnCancelled, $metadata, $readOnlyAmounts, $iframeRefererDomain, $optionalOrderParameters, )
使用法定货币作为基准金额的sellOrderTransaction
$sellOrderTransaction = SellOrderTransaction::createFromFiatAmount( $accountReference, $fiatCode, $coinCode, $fiatAmount, $refundAddress, $paymentMethodId, $blockchain, $walletAddressTag, );
使用硬币作为基准金额的sellOrderTransaction
$sellOrderTransaction = SellOrderTransaction::createFromCoinAmount( $accountReference, $fiatCode, $coinCode, $coinAmount, $refundAddress, $paymentMethodId, $blockchain, $walletAddressTag, );
使用动态的sourceAmount或targetAmount的sellOrderTransaction
当使用SellOrderTransaction::createDynamic时,您需要指定
$source(硬币),$target(法定货币),以及$sourceAmount或$targetAmount中的任意一个$sellOrderTransaction = SellOrderTransaction::createDynamic( $accountReference, $source, $target, $sourceAmount, $targetAmount, $walletAddress, $refundAddress, $paymentMethodId, $blockchain, $walletAddressTag );
可选订单参数
$optionalOrderParameters = optionalOrderParameters::create( $sourceAddress, $sourceAddressTag, $email, $mobile, );
卖出订单完整示例
$sellOrderTransaction = SellOrderTransaction::createFromFiatAmount($accountReference, $fiatCode, $coinCode, $fiatAmount, $refundAddress, $paymentMethodId, $blockchain, $walletAddressTag);// From Fiat Amount$sellOrderTransaction = SellOrderTransaction::createFromCoinAmount($accountReference, $fiatCode, $coinCode, $coinAmount, $refundAddress, $paymentMethodId, $blockchain, $walletAddressTag);// From Coin Amount$sellOrderTransaction = SellOrderTransaction::createDynamic($accountReference, $source, $target, $sourceAmount, null, null, $refundAddress, $paymentMethodId, $blockchain, $walletAddressTag); // Dynamic$sellOrderTransaction = SellOrderTransaction::createDynamic($accountReference, $source, $target, null, $targetAmount, null, $refundAddress, $paymentMethodId, $blockchain, $walletAddressTag); // Dynamic$optionalOrderParameters = OptionalOrderParameters::create($sourceAddress, $sourceAddressTag, $email, $mobile);$banxa->createSellOrder( $sellOrderTransaction, $returnUrlOnSuccess, $returnUrlOnFailure, $returnUrlOnCancelled, $metadata, $readOnlyAmounts, $iframeRefererDomain, $optionalOrderParameters, );结果示例
[ "id" => "b890df4aee4583a25ca8da17eb863c81", "account_id" => "3ec8d3c67617af11d84a18931c4e369d", "account_reference" => "banxa-test-01", "order_type" => "CRYPTO-SELL", "fiat_code" => "AUD", "fiat_amount" => 1, "coin_code" => "BTC", "wallet_address" => "1LbQ1WNTsm1Nzj1hbh3WDCbEim1oUg5rfi", "blockchain" => [ "id" => 1, "code" => "BTC", "description" => "Bitcoin" ], "created_at" => "17-Aug-2022 00:09:03", "checkout_url" => "https://your-return-url" ]
确认销售订单
一旦执行了卖出订单的硬币金额转账,
Banxa必须通过发送请求到该端点并包含交易哈希、源和目标钱包地址详情来通知。$banxa->confirmSellOrder( $orderId, $txHash, $sourceAddress, $destinationAddress, $sourceAddressTag, $destinationAddressTag )
结果示例
[
"id" => "ee94a43403fb608f341dd5c4c899b846",
"account_id" => "d6e7ab2b8f638bed61dc0ac5bec37d4d",
"account_reference" => "banxa-account",
"order_type" => "CRYPTO-SELL",
"payment_type" => "CLEARJCNSELLFP",
"ref" => 507000,
"fiat_code" => "AUD",
"fiat_amount" => 100,
"coin_code" => "BTC",
"coin_amount" => 0.00286436,
"wallet_address" => null,
"wallet_address_tag" => null,
"fee" => 9.1,
"fee_tax" => 0,
"payment_fee" => 0,
"payment_fee_tax" => 0,
"commission" => 0.1,
"tx_hash" => null,
"tx_confirms" => 0,
"created_date" => "01-Jul-2022",
"created_at" => "01-Jul-2022 07:51:18",
"status" => "in progress",
"completed_at" => null,
"merchant_fee" => 6.54,
"merchant_commission" => 0.05,
"meta_data" => null,
"blockchain" => [
"id" => 1,
"code" => "BTC",
"description" => "Bitcoin"
]
]
身份
创建身份
允许在创建订单之前与Banxa分享客户详情。
这减少了客户在Banxa结账流程中重新提交个人详情和上传KYC文件的需求。
有关如何实现此API的详细指南可在此处找到:这里。您还可以在此处找到测试信息:这里$banxa->createIdentity( $identitySharingCollection, $customerDetails, $residentialAddress $customerIdentity, $identityDocumentCollection, )
IdentitySharingCollection
IdentitySharingCollection::create($kycProviders)
IdentitySharingProvider
IdentitySharingProvider::create($provider, $token)
客户详情
$customerDetail = CustomerDetail::create($accountReference, $mobileNumber, $emailAddress);
居住地址
$residentialAddress = ResidentialAddress::create($country, $addressLine, $suburb, $postCode, $state);
客户身份
$customerIdentity = CustomerIdentity::create($givenName, $surname, $dateOfBirth);
身份证明文件集合
身份证明文件
IdentityDocument::create($documentType, $imageLinks, $documentNumber)
完整示例
$kycProviders = [ IdentitySharingProvider::create($provider, $token), IdentitySharingProvider::create($provider, $token), ]; $documents = [ IdentityDocument::create($documentType, $imageLinks, $documentNumber), IdentityDocument::create($documentType, $imageLinks), ]; $identitySharingCollection = IdentitySharingCollection::create($kycProviders); $customerDetail = CustomerDetail::create($accountReference, $mobileNumber, $emailAddress); $residentialAddress = ResidentialAddress::create($country, $addressLine, $suburb, $postCode, $state); $customerIdentity = CustomerIdentity::create($givenName, $surname, $dateOfBirth); $identityDocumentCollection = IdentityDocumentCollection::create($documents); $banxa->createIdentity( $identitySharingCollection, $customerDetail, $residentialAddress, $customerIdentity, $identityDocumentCollection );
结果示例
[
"account_id" => "28d517af407a0566204acd75e3a8e5b7",
"account_reference" => "test001001"
]