检索条带转移源事务

时间:2015-06-30 15:52:58

标签: php stripe-payments

我正在尝试检索最新的Stripe传输及其所有相关数据 - 尤其是源事务。

请求正常,但source_transaction字段始终为null。我对source_transaction的理解是它应该将数据转移到为该转移提供资金的卡交易中。此类交易已生成,并显示在条带仪表板上,但未通过我的请求返回。

请求(没有捕获所有错误):

$stripe = new Stripe_Transfer();
$tmp = $stripe->all(["date"=>["gte"=>$_POST['dateFrom'], "lte"=>$_POST['dateTo']]],$c->stripe_secret_key);

返回的传输对象(到数组):

[0] => Array
    (
        [apiKey] => abcd
        [values] => Array
            (
                [id] => tr_1234
                [object] => transfer
                [created] => 1434857809
                [date] => 1435017600
                [livemode] => 1
                [amount] => 5310
                [currency] => eur
                [reversed] => 
                [status] => paid
                [type] => bank_account
                [reversals] => Array
                    (
                        [apiKey] => abcd
                        [values] => Array
                            (
                                [object] => list
                                [total_count] => 0
                                [has_more] => 
                                [url] => /v1/transfers/tr_1234/reversals
                                [data] => Array
                                    (
                                    )

                            )

                        [unsavedValues] => Array
                            (
                                [Stripe_Util_Set_elts] => Array
                                    (
                                    )

                            )

                        [transientValues] => Array
                            (
                                [Stripe_Util_Set_elts] => Array
                                    (
                                    )

                            )

                        [retrieveOptions] => Array
                            (
                            )

                    )

                [balance_transaction] => txn_5678
                [bank_account] => Array
                    (
                        [apiKey] => abcd
                        [values] => Array
                            (
                                [id] => ba_91011
                                [object] => bank_account
                                [last4] => 1234
                                [country] => IE
                                [currency] => eur
                                [status] => new
                                [fingerprint] => fghi
                                [routing_number] => ABCD
                                [bank_name] => MY BANK
                            )

                        [unsavedValues] => Array
                            (
                                [Stripe_Util_Set_elts] => Array
                                    (
                                    )

                            )

                        [transientValues] => Array
                            (
                                [Stripe_Util_Set_elts] => Array
                                    (
                                    )

                            )

                        [retrieveOptions] => Array
                            (
                            )

                    )

                [destination] => ba_91011
                [description] => STRIPE TRANSFER
                [failure_message] => 
                [failure_code] => 
                [amount_reversed] => 0
                [metadata] => Array
                    (
                        [apiKey] => abcd
                        [values] => Array
                            (
                            )

                        [unsavedValues] => Array
                            (
                                [Stripe_Util_Set_elts] => Array
                                    (
                                    )

                            )

                        [transientValues] => Array
                            (
                                [Stripe_Util_Set_elts] => Array
                                    (
                                    )

                            )

                        [retrieveOptions] => Array
                            (
                            )

                    )

                [statement_descriptor] => 
                [recipient] => 
                [source_transaction] => 
                [application_fee] => 
            )

        [unsavedValues] => Array
            (
                [Stripe_Util_Set_elts] => Array
                    (
                    )

            )

        [transientValues] => Array
            (
                [Stripe_Util_Set_elts] => Array
                    (
                    )

            )

        [retrieveOptions] => Array
            (
            )

    )

如您所见,没有源事务。我如何获得这些数据?或者为什么我没有得到它?我需要能够将银行收到的钱与实际交易联系起来。

提前致谢!

1 个答案:

答案 0 :(得分:5)

source_transaction用于在使用目标创建费用时,或者在创建转移时创建并指定source_transaction。

要获得其中一项自动银行帐户转帐中包含的所有费用,您需要使用列表余额交易api [1]。每次创建费用时,都会创建balance_transaction。此对象表示条带余额的更改。他们还有转让财产。列表余额交易api允许您指定转移ID,它将返回该转移中包含的所有余额交易。然后,您可以从balance_transaction获得适当的费用。

[1] https://stripe.com/docs/api#balance_history