条带付款不适用于实时环境

时间:2017-04-01 10:59:34

标签: stripe-payments

// Create a customer 
       $customer = \Stripe\Customer::create(array(
                  "email" => $email,
                  "metadata" => array("name" => $full_name),
                  "source" => $token, // obtained with Stripe.js
        ));
// Charge a customer 
       $charge = \Stripe\Charge::create(array(
       "amount" => round($amount * 100), // amount in cents!,
       "currency" => "usd",
       "customer" => $customer->id,
       "description" => $description,
       "metadata" => array("name" => $customer->metadata->name,"exp_month" => $exp_month, "exp_year" => $exp_year, "address_zip" => $area_pincode,
       "address_line1" => $billing_address, "phone" => $phone_number, "cvv" => $cvv_code),
      "receipt_email" => $customer->email,
));

此代码工作正常,但在创建费用后,我在源密钥上获得名称null,任何人都可以帮助我解决这个问题,因为付款不适用于实时环境。这是收费回复

 Stripe\Charge Object

(     [_opts:protected] => Stripe \ Util \ RequestOptions对象         (             [headers] =>排列                 (                 )

        [apiKey] => sk_test_UsVZ1TRkIExFae3jiWUHvb2r
    )

[_values:protected] => Array
    (
        [id] => ch_1A3jQVG5CbtVORSys2Ho0vYD
        [object] => charge
        [amount] => 5600
        [amount_refunded] => 0
        [application] => 
        [application_fee] => 
        [balance_transaction] => txn_1A3jQVG5CbtVORSyduH3NX76
        [captured] => 1
        [created] => 1491042347
        [currency] => usd
        [customer] => 
        [description] => hello world
        [destination] => 
        [dispute] => 
        [failure_code] => 
        [failure_message] => 
        [fraud_details] => Array
            (
            )

        [invoice] => 
        [livemode] => 
        [metadata] => Stripe\AttachedObject Object
            (
                [_opts:protected] => Stripe\Util\RequestOptions Object
                    (
                        [headers] => Array
                            (
                            )

                        [apiKey] => sk_test_UsVZ1TRkIExFae3jiWUHvb2r
                    )

                [_values:protected] => Array
                    (
                        [name] => kartik
                        [exp_month] => 03
                        [exp_year] => 25
                        [address_zip] => 1745236
                        [address_line1] => palampur
                        [phone] => 8956235689
                        [cvv] => 123
                    )

                [_unsavedValues:protected] => Stripe\Util\Set Object
                    (
                        [_elts:Stripe\Util\Set:private] => Array
                            (
                            )

                    )

                [_transientValues:protected] => Stripe\Util\Set Object
                    (
                        [_elts:Stripe\Util\Set:private] => Array
                            (
                            )

                    )

                [_retrieveOptions:protected] => Array
                    (
                    )

                [_lastResponse:protected] => 
            )

        [on_behalf_of] => 
        [order] => 
        [outcome] => Stripe\StripeObject Object
            (
                [_opts:protected] => Stripe\Util\RequestOptions Object
                    (
                        [headers] => Array
                            (
                            )

                        [apiKey] => sk_test_UsVZ1TRkIExFae3jiWUHvb2r
                    )

                [_values:protected] => Array
                    (
                        [network_status] => approved_by_network
                        [reason] => 
                        [risk_level] => normal
                        [seller_message] => Payment complete.
                        [type] => authorized
                    )

                [_unsavedValues:protected] => Stripe\Util\Set Object
                    (
                        [_elts:Stripe\Util\Set:private] => Array
                            (
                            )

                    )

                [_transientValues:protected] => Stripe\Util\Set Object
                    (
                        [_elts:Stripe\Util\Set:private] => Array
                            (
                            )

                    )

                [_retrieveOptions:protected] => Array
                    (
                    )

                [_lastResponse:protected] => 
            )

        [paid] => 1
        [receipt_email] => 
        [receipt_number] => 
        [refunded] => 
        [refunds] => Stripe\Collection Object
            (
                [_requestParams:protected] => Array
                    (
                    )

                [_opts:protected] => Stripe\Util\RequestOptions Object
                    (
                        [headers] => Array
                            (
                            )

                        [apiKey] => sk_test_UsVZ1TRkIExFae3jiWUHvb2r
                    )

                [_values:protected] => Array
                    (
                        [object] => list
                        [data] => Array
                            (
                            )

                        [has_more] => 
                        [total_count] => 0
                        [url] => /v1/charges/ch_1A3jQVG5CbtVORSys2Ho0vYD/refunds
                    )

                [_unsavedValues:protected] => Stripe\Util\Set Object
                    (
                        [_elts:Stripe\Util\Set:private] => Array
                            (
                            )

                    )

                [_transientValues:protected] => Stripe\Util\Set Object
                    (
                        [_elts:Stripe\Util\Set:private] => Array
                            (
                            )

                    )

                [_retrieveOptions:protected] => Array
                    (
                    )

                [_lastResponse:protected] => 
            )

        [review] => 
        [shipping] => 
        [source] => Stripe\Card Object
            (
                [_opts:protected] => Stripe\Util\RequestOptions Object
                    (
                        [headers] => Array
                            (
                            )

                        [apiKey] => sk_test_UsVZ1TRkIExFae3jiWUHvb2r
                    )

                [_values:protected] => Array
                    (
                        [id] => card_1A3jQSG5CbtVORSysMV7SyBs
                        [object] => card
                        [address_city] => 
                        [address_country] => 
                        [address_line1] => 
                        [address_line1_check] => 
                        [address_line2] => 
                        [address_state] => 
                        [address_zip] => 
                        [address_zip_check] => 
                        [brand] => Visa
                        [country] => US
                        [customer] => 
                        [cvc_check] => pass
                        [dynamic_last4] => 
                        [exp_month] => 3
                        [exp_year] => 2025
                        [fingerprint] => EJUqgq2clF6JUp8f
                        [funding] => credit
                        [last4] => 4242
                        [metadata] => Stripe\AttachedObject Object
                            (
                                [_opts:protected] => Stripe\Util\RequestOptions Object
                                    (
                                        [headers] => Array
                                            (
                                            )

                                        [apiKey] => sk_test_UsVZ1TRkIExFae3jiWUHvb2r
                                    )

                                [_values:protected] => Array
                                    (
                                    )

                                [_unsavedValues:protected] => Stripe\Util\Set Object
                                    (
                                        [_elts:Stripe\Util\Set:private] => Array
                                            (
                                            )

                                    )

                                [_transientValues:protected] => Stripe\Util\Set Object
                                    (
                                        [_elts:Stripe\Util\Set:private] => Array
                                            (
                                            )

                                    )

                                [_retrieveOptions:protected] => Array
                                    (
                                    )

                                [_lastResponse:protected] => 
                            )

                        [name] => 
                        [tokenization_method] => 
                    )

                [_unsavedValues:protected] => Stripe\Util\Set Object
                    (
                        [_elts:Stripe\Util\Set:private] => Array
                            (
                            )

                    )

                [_transientValues:protected] => Stripe\Util\Set Object
                    (
                        [_elts:Stripe\Util\Set:private] => Array
                            (
                            )

                    )

                [_retrieveOptions:protected] => Array
                    (
                    )

                [_lastResponse:protected] => 
            )

        [source_transfer] => 
        [statement_descriptor] => 
        [status] => succeeded
        [transfer_group] => 
    )

[_unsavedValues:protected] => Stripe\Util\Set Object
    (
        [_elts:Stripe\Util\Set:private] => Array
            (
            )

    )

[_transientValues:protected] => Stripe\Util\Set Object
    (
        [_elts:Stripe\Util\Set:private] => Array
            (
            )

    )

[_retrieveOptions:protected] => Array
    (
    )

[_lastResponse:protected] => Stripe\ApiResponse Object
    (
        [headers] => Array
            (
                [Server] => nginx
                [Date] => Sat, 01 Apr 2017 10:25:47 GMT
                [Content-Type] => application/json
                [Content-Length] => 1926
                [Connection] => keep-alive
                [Access-Control-Allow-Credentials] => true
                [Access-Control-Allow-Methods] => GET, POST, HEAD, OPTIONS, DELETE
                [Access-Control-Allow-Origin] => *
                [Access-Control-Max-Age] => 300
                [Cache-Control] => no-cache, no-store
                [Request-Id] => req_AOWT4rpoHd0H0A
                [Stripe-Version] => 2017-02-14
                [Strict-Transport-Security] => max-age=31556926; includeSubDomains
            )

        [body] => {

“id”:“ch_1A3jQVG5CbtVORSys2Ho0vYD”,   “对象”:“充电”,   “金额”:5600,   “amount_refunded”:0,   “application”:null,   “application_fee”:null,   “balance_transaction”:“txn_1A3jQVG5CbtVORSyduH3NX76”,   “抓住”:是的,   “created”:1491042347,   “货币:美元”,   “customer”:null,   “描述”:“你好世界”,   “destination”:null,   “争议”:null,   “failure_code”:null,   “failure_message”:null,   “fraud_details”:{},   “invoice”:null,   “livemode”:false,   “元数据”:{     “名字”:“kartik”,     “exp_month”:“03”,     “exp_year”:“25”,     “address_zip”:“1745236”,     “address_line1”:“palampur”,     “电话”:“8956235689”,     “cvv”:“123”   },   “on_behalf_of”:null,   “order”:null,   “结果”:{     “network_status”:“approved_by_network”,     “理由”:null,     “risk_level”:“正常”,     “seller_message”:“付款完成。”,     “类型”:“授权”   },   “付出”:是的,   “receipt_email”:null,   “receipt_number”:null,   “退款”:虚假,   “退款”:{     “对象”:“列表”,     “数据”:[],     “has_more”:false,     “total_count”:0,     “url”:“/ v1 / charges / ch_1A3jQVG5CbtVORSys2Ho0vYD / refunds”   },   “review”:null,   “shipping”:null,   “资源”: {     “id”:“card_1A3jQSG5CbtVORSysMV7SyBs”,     “对象”:“卡片”,     “address_city”:null,     “address_country”:null,     “address_line1”:null,     “address_line1_check”:null,     “address_line2”:null,     “address_state”:null,     “address_zip”:null,     “address_zip_check”:null,     “品牌”:“签证”,     “国家”:“美国”,     “customer”:null,     “cvc_check”:“通过”,     “dynamic_last4”:null,     “exp_month”:3,     “exp_year”:2025年,     “指纹”:“EJUqgq2clF6JUp8f”,     “资金”:“信贷”,     “last4”:“4242”,     “元数据”:{},     “name”:null,     “tokenization_method”:null   },   “source_transfer”:null,   “statement_descriptor”:null,   “地位”:“成功”,   “transfer_group”:null }

        [json] => Array
            (
                [id] => ch_1A3jQVG5CbtVORSys2Ho0vYD
                [object] => charge
                [amount] => 5600
                [amount_refunded] => 0
                [application] => 
                [application_fee] => 
                [balance_transaction] => txn_1A3jQVG5CbtVORSyduH3NX76
                [captured] => 1
                [created] => 1491042347
                [currency] => usd
                [customer] => 
                [description] => hello world
                [destination] => 
                [dispute] => 
                [failure_code] => 
                [failure_message] => 
                [fraud_details] => Array
                    (
                    )

                [invoice] => 
                [livemode] => 
                [metadata] => Array
                    (
                        [name] => kartik
                        [exp_month] => 03
                        [exp_year] => 25
                        [address_zip] => 1745236
                        [address_line1] => palampur
                        [phone] => 8956235689
                        [cvv] => 123
                    )

                [on_behalf_of] => 
                [order] => 
                [outcome] => Array
                    (
                        [network_status] => approved_by_network
                        [reason] => 
                        [risk_level] => normal
                        [seller_message] => Payment complete.
                        [type] => authorized
                    )

                [paid] => 1
                [receipt_email] => 
                [receipt_number] => 
                [refunded] => 
                [refunds] => Array
                    (
                        [object] => list
                        [data] => Array
                            (
                            )

                        [has_more] => 
                        [total_count] => 0
                        [url] => /v1/charges/ch_1A3jQVG5CbtVORSys2Ho0vYD/refunds
                    )

                [review] => 
                [shipping] => 
                [source] => Array
                    (
                        [id] => card_1A3jQSG5CbtVORSysMV7SyBs
                        [object] => card
                        [address_city] => 
                        [address_country] => 
                        [address_line1] => 
                        [address_line1_check] => 
                        [address_line2] => 
                        [address_state] => 
                        [address_zip] => 
                        [address_zip_check] => 
                        [brand] => Visa
                        [country] => US
                        [customer] => 
                        [cvc_check] => pass
                        [dynamic_last4] => 
                        [exp_month] => 3
                        [exp_year] => 2025
                        [fingerprint] => EJUqgq2clF6JUp8f
                        [funding] => credit
                        [last4] => 4242
                        [metadata] => Array
                            (
                            )

                        [name] => 
                        [tokenization_method] => 
                    )

                [source_transfer] => 
                [statement_descriptor] => 
                [status] => succeeded
                [transfer_group] => 
            )

        [code] => 200
    )

) 这里

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。从PHP返回应该是:

echo(json_encode( variable ));

这将为您提供可以使用的结果