我正在使用Stripe
接收來自多個用戶的貢獻的API。所以我想爲我們的客戶生成聲明,以便他們可以看到確切金額,扣費,交易計數等等。獲取條帶餘額中的零費用交易API響應
在查看Stripe API後,我發現有兩個API(Stripe::Transfer
和Stripe::BalanceTransaction
)可用於fullfil我的要求。
所以按照文檔Stripe API我打電話Stripe::Transfer
API和這個API返回像下面
transfer = #<Stripe::Transfer:0x3f997455ac88 id=tr_1xxxxxxxxxxxxxx> JSON: {
"id": "tr_1xxxxxxxxxxxxxxxxx",
"object": "transfer",
"amount": 9510,
"amount_reversed": 0,
"application_fee": null,
"balance_transaction": "txn_123",
"created": 1477485158,
"currency": "usd",
"date": 1477485158,
"description": null,
"destination": "acct_xxxxxxxxxxxxxx",
"destination_payment": "py_xxxxxxxxxxx",
"failure_code": null,
"failure_message": null,
"livemode": false,
"metadata": {},
"method": "standard",
"recipient": null,
"reversals": {"object":"list","data":[],"has_more":false,"total_count":0,"url":"/v1/transfers/tr_xx/reversals"},
"reversed": false,
"source_transaction": "ch_xxxxxxxxx",
"source_type": "card",
"statement_descriptor": null,
"status": "paid",
"type": "stripe_account"
}
我打電話條紋:: BalanceTransaction API來獲取詳細信息,尤其是傳輸的數據正確的響應
balance_transaction_id = transfer.balance_transaction
Stripe::BalanceTransaction.retrieve(balance_transaction_id)
獲得以下回復
#<Stripe::BalanceTransaction:0x3f9974f2f1c8 id=txn_123> JSON: {
"id": "txn_123",
"object": "balance_transaction",
"amount": -9510,
"available_on": 1478044800,
"created": 1477485158,
"currency": "usd",
"description": null,
"fee": 0,
"fee_details": [
],
"net": -9510,
"source": "tr_xxxxxxxx",
"sourced_transfers": {"object":"list","data": [],"has_more":false,"total_count":0,"url":"/v1/transfers? source_transaction=tr_xxxx"},
"status": "available",
"type": "transfer"
}
我設置申請費(2%)和條紋儀表板,但在上述響應我得到fee
這顯示正確的是0
因此,誰能幫助/建議我我如何能得到這個響應fee
和total_count
值
在此先感謝您的任何幫助和建議。
任何人都可以幫我完成我的要求嗎? –