PHP-将stdClass对象转换为字符串到数组

时间:2019-07-29 09:32:43

标签: php wordpress woocommerce stripe-payments

我有捕获异常的代码。 我通过$ e-> getMessage()得到错误体 结果是以下字符串。 现在我要访问customer_email 我该怎么办?

我从Stripe API请求中收到此回复

stdClass Object
(
    [error] => stdClass Object
        (
            [charge] => ch_1F1UTrAMXDCOYAqpNzJLKFff
            [code] => card_declined
            [message] => Your card was declined.
            [payment_intent] => stdClass Object
                (
                    [id] => pi_1F1IwGAMXDCOYAqpSwoFHsN1
                    [amount_capturable] => 0
                    [metadata] => stdClass Object
                        (
                            [customer_name] => C B
                            [customer_email] => pippo@gmail.com
                            [order_id] => 363
                        )
                    [payment_method_options] => stdClass Object
                        (
                            [card] => stdClass Object
                                (
                                    [request_three_d_secure] => automatic
                                )
                        )
                    [payment_method_types] => Array
                        (
                            [0] => card
                        )
                    [receipt_email] => 
                    [review] => 
                )
            [source] => stdClass Object
                (
                    [id] => src_1F1UTnAMXDCOYAqpYOtW3GyR
                    [object] => source
                    [card] => stdClass Object
                        (
                            [exp_month] => 12
                            [exp_year] => 2020
                            [last4] => 9987
                            [country] => US
                        )
                    [client_secret] => src_client_secret_FWXYzYw3vPwPe4CzyveJdVMP
                    [created] => 1564389915
                    [flow] => none
                    [metadata] => stdClass Object
                        (
                        )
                        )
                [type] => card_error
            )

    )

0 个答案:

没有答案