money-go / money-go-api
money go 钱包的 API
1.40
2023-03-02 07:58 UTC
Requires
- php: ^7.2.5 || ^8.0
- ext-curl: *
- ext-json: *
Requires (Dev)
- larapack/dd: 1.*
- phpunit/phpunit: ^9.5
README
安装
composer require money-go/money-go-api
API 文档
https://moneygo.docs.apiary.io
用法
1. 通过联系我们获取 CLIENT_ID 和 CLIENT_SECRET
2. 使用方法获取 access_token
https://api.money-go.com/token
- 设置 client id
- 设置 client secret
- 使用 send 方法获取响应
- 获取 access_token 并将令牌设置为 ApiProvider 类
$apiProvider = new MoneyGoApi();
$clientId = '';
$secret = '';
$accessToken = $apiProvider->getToken()
->setClientId($clientId)
->setClientSecret($secret)
->send()
->getAccessToken();
$apiProvider->setAccessToken($accessToken);
3. 可用方法
获取我的账户信息
https://api.money-go.com/api/user/me
$apiProvider->getMe()
->send()
->getResult()
获取账户中可用钱包的信息
https://api.money-go.com/api/wallets
$apiProvider->getWallets()
->send()
->getResult()
搜索使用 MoneyGo 钱包的客户端钱包
https://api.money-go.com/api/wallets/search/WALLET_CODE
$apiProvider->searchWallet()
->setWalletNumber('CLIENT_WALLET_NUMBER')
->send()
->getResult()
检查是否存在使用 MoneyGo 钱包的客户端钱包
https://api.money-go.com/api/wallet-exists?number_to=&number_from=
$apiProvider->walletExists()
->setWalletFromNumber('CLIENT_WALLET_NUMBER')
->setWalletToNumber('YOUR_WALLET_NUMBER')
->send()
->getResult()
将钱提现到 moneyGO 客户端钱包
https://api.money-go.com/api/transaction/transfer
$apiProvider->transfer()
->setWalletFromNumber(YOUR_WALLET_NUMBER')
->setWalletToNumber(CLIENT_WALLET_NUMBER')
->setAmount(0.1)
->setPaymentId('EXAMPLE_PAYMENT_INFO')
->setDescription('EXAMPLE_DESCRIPTION')
->send()
->getResult()
获取 MoneyGo 上使用的所有货币
https://api.money-go.com/api/currencies
$apiProvider->currencies()
->send()
->getResult()
处理结账(创建支付链接,存入账户)
https://api.money-go.com/api/processing/checkout
$apiProvider->processingCheckout()
->setSecret('FORM_SECRET_KEY')
->setId('EXAMPLE_PAYMENT_INFO')
->setAmount(1)
->setUserInfo('EXAMPLE USER_INFO') //PLEASE fill user_info with unique user value
->setWalletToNumber('YOUR_WALLET_NUMBER')
->setWalletFromNumber('CLIENT_WALLET_NUMBER')
->setSuccessUrl('SUCCESS_URL') // link where redirect user after success
->setStatusUrl('STATUS_URL') // link where you get payment status e.g https://webhook.site
->setCancelUrl('CANCEL_URL') // link where redirect user after cancel
->send()
->getResult()