正方形交易Api-检索请求结果

时间:2018-08-05 16:11:48

标签: api transactions square

请帮助我了解下一步需要做什么。我正在使用方形交易API接受电子商务网站上的付款。我从生成的表单中获得了现时的信息,并且希望在下面获得以下响应。现在,我需要从此响应中检索值并将它们存储在变量中,以便我可以继续创建要履行该订单的采购订单。

SquareConnect\Model\ChargeResponse Object
(
    [errors:protected] => 
    [transaction:protected] => SquareConnect\Model\Transaction Object
        (
            [id:protected] => ...
            [location_id:protected] => ...
            [created_at:protected] => 2018-08-05T15:45:48Z
            [tenders:protected] => Array
                (
                    [0] => SquareConnect\Model\Tender Object
                        (
                            [id:protected] => ...
                            [location_id:protected] => ..
                            [transaction_id:protected] => ...
                            [created_at:protected] => 2018-08-05T15:45:48Z
                            [note:protected] => Online Transaction
                            [amount_money:protected] => SquareConnect\Model\Money Object
                                (
                                    [amount:protected] => 20448
                                    [currency:protected] => USD
                                )

                            [tip_money:protected] => 
                            [processing_fee_money:protected] => 
                            [customer_id:protected] => 
                            [type:protected] => CARD
                            [card_details:protected] => SquareConnect\Model\TenderCardDetails Object
                                (
                                    [status:protected] => CAPTURED
                                    [card:protected] => SquareConnect\Model\Card Object
                                        (
                                            [id:protected] => 
                                            [card_brand:protected] => VISA
                                            [last_4:protected] => 1111
                                            [exp_month:protected] => 
                                            [exp_year:protected] => 
                                            [cardholder_name:protected] => 
                                            [billing_address:protected] => 
                                            [fingerprint:protected] =>...
                                        )

                                    [entry_method:protected] => KEYED
                                )

                            [cash_details:protected] => 
                            [additional_recipients:protected] => 
                        )

                )

            [refunds:protected] => 
            [reference_id:protected] => 
            [product:protected] => EXTERNAL_API
            [client_id:protected] => 
            [shipping_address:protected] => 
            [order_id:protected] => 
        )
)

我只需要确认卡已付款的交易结果

1 个答案:

答案 0 :(得分:0)

您将需要使用Getter方法来访问私有属性。例如:https://github.com/square/connect-php-sdk/blob/master/docs/Model/ChargeResponse.md