2016-11-27 5 views
0

私の目標は、顧客がサインアップしたプランの金額を変数$plan_amountに割り当てることです。私が見つけたprint_rからのストライプの計画額の値の検索

Stripe\Customer::__set_state(array('_opts' => Stripe\Util\RequestOptions::__set_state(array('headers' => array (), 'apiKey' => 'sk_test_M34wpZquafPJwZBmRjw6nGlf',)), '_values' => array ('id' => 'cus_9da91rn7gLhC2d', 'object' => 'customer', 'account_balance' => 0, 'created' => 1480215961, 'currency' => 'usd', 'default_source' => 'card_19KIzJI8DcpffB1bbUG87DhV', 'delinquent' => false, 'description' => NULL, 'discount' => NULL, 'email' => '[email protected]', 'livemode' => false, 'metadata' => Stripe\AttachedObject::__set_state(array('_opts' => Stripe\Util\RequestOptions::__set_state(array('headers' => array (), 'apiKey' => 'sk_test_M34wpZquafPJwZBmRjw6nGlf',)), '_values' => array ('user_id' => '129',), '_unsavedValues' => Stripe\Util\Set::__set_state(array('_elts' => array (),)), '_transientValues' => Stripe\Util\Set::__set_state(array('_elts' => array (),)), '_retrieveOptions' => array (), '_lastResponse' => NULL,)), 'shipping' => NULL, 'sources' => Stripe\Collection::__set_state(array('_requestParams' => array (), '_opts' => Stripe\Util\RequestOptions::__set_state(array('headers' => array (), 'apiKey' => 'sk_test_M34wpZquafPJwZBmRjw6nGlf',)), '_values' => array ('object' => 'list', 'data' => array (0 => Stripe\Card::__set_state(array('_opts' => Stripe\Util\RequestOptions::__set_state(array('headers' => array (), 'apiKey' => 'sk_test_M34wpZquafPJwZBmRjw6nGlf',)), '_values' => array ('id' => 'card_19KIzJI8DcpffB1bbUG87DhV', 'object' => 'card', '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, 'brand' => 'Visa', 'country' => 'US', 'customer' => 'cus_9da91rn7gLhC2d', 'cvc_check' => 'pass', 'dynamic_last4' => NULL, 'exp_month' => 1, 'exp_year' => 2019, 'fingerprint' => '7cCImrkBsKyb8S1A', 'funding' => 'credit', 'last4' => '4242', 'metadata' => Stripe\AttachedObject::__set_state(array('_opts' => Stripe\Util\RequestOptions::__set_state(array('headers' => array (), 'apiKey' => 'sk_test_M34wpZquafPJwZBmRjw6nGlf',)), '_values' => array (), '_unsavedValues' => Stripe\Util\Set::__set_state(array('_elts' => array (),)), '_transientValues' => Stripe\Util\Set::__set_state(array('_elts' => array (),)), '_retrieveOptions' => array (), '_lastResponse' => NULL,)), 'name' => '[email protected]', 'tokenization_method' => NULL,), '_unsavedValues' => Stripe\Util\Set::__set_state(array('_elts' => array (),)), '_transientValues' => Stripe\Util\Set::__set_state(array('_elts' => array (),)), '_retrieveOptions' => array (), '_lastResponse' => NULL,)),), 'has_more' => false, 'total_count' => 1, 'url' => '/v1/customers/cus_9da91rn7gLhC2d/sources',), '_unsavedValues' => Stripe\Util\Set::__set_state(array('_elts' => array (),)), '_transientValues' => Stripe\Util\Set::__set_state(array('_elts' => array (),)), '_retrieveOptions' => array (), '_lastResponse' => NULL,)), 'subscriptions' => Stripe\Collection::__set_state(array('_requestParams' => array (), '_opts' => Stripe\Util\RequestOptions::__set_state(array('headers' => array (), 'apiKey' => 'sk_test_M34wpZquafPJwZBmRjw6nGlf',)), '_values' => array ('object' => 'list', 'data' => array (0 => Stripe\Subscription::__set_state(array('_opts' => Stripe\Util\RequestOptions::__set_state(array('headers' => array (), 'apiKey' => 'sk_test_M34wpZquafPJwZBmRjw6nGlf',)), '_values' => array ('id' => 'sub_9da9u1VWytIjNq', 'object' => 'subscription', 'application_fee_percent' => NULL, 'cancel_at_period_end' => false, 'canceled_at' => NULL, 'created' => 1480215961, 'current_period_end' => 1482807961, 'current_period_start' => 1480215961, 'customer' => 'cus_9da91rn7gLhC2d', 'discount' => NULL, 'ended_at' => NULL, 'livemode' => false, 'metadata' => Stripe\AttachedObject::__set_state(array('_opts' => Stripe\Util\RequestOptions::__set_state(array('headers' => array (), 'apiKey' => 'sk_test_M34wpZquafPJwZBmRjw6nGlf',)), '_values' => array (), '_unsavedValues' => Stripe\Util\Set::__set_state(array('_elts' => array (),)), '_transientValues' => Stripe\Util\Set::__set_state(array('_elts' => array (),)), '_retrieveOptions' => array (), '_lastResponse' => NULL,)), 'plan' => Stripe\Plan::__set_state(array('_opts' => Stripe\Util\RequestOptions::__set_state(array('headers' => array (), 'apiKey' => 'sk_test_M34wpZquafPJwZBmRjw6nGlf',)), '_values' => array ('id' => 'Unlimited', 'object' => 'plan', 'amount' => 1000, 'created' => 1474078670, 'currency' => 'usd', 'interval' => 'month', 'interval_count' => 1, 'livemode' => false, 'metadata' => Stripe\AttachedObject::__set_state(array('_opts' => Stripe\Util\RequestOptions::__set_state(array('headers' => array (), 'apiKey' => 'sk_test_M34wpZquafPJwZBmRjw6nGlf',)), '_values' => array (), '_unsavedValues' => Stripe\Util\Set::__set_state(array('_elts' => array (),)), '_transientValues' => Stripe\Util\Set::__set_state(array('_elts' => array (),)), '_retrieveOptions' => array (), '_lastResponse' => NULL,)), 'name' => 'Unlimited', 'statement_descriptor' => 'BEATCART.FM', 'trial_period_days' => NULL,), '_unsavedValues' => Stripe\Util\Set::__set_state(array('_elts' => array (),)), '_transientValues' => Stripe\Util\Set::__set_state(array('_elts' => array (),)), '_retrieveOptions' => array (), '_lastResponse' => NULL,)), 'quantity' => 1, 'start' => 1480215961, 'status' => 'active', 'tax_percent' => NULL, 'trial_end' => NULL, 'trial_start' => NULL,), '_unsavedValues' => Stripe\Util\Set::__set_state(array('_elts' => array (),)), '_transientValues' => Stripe\Util\Set::__set_state(array('_elts' => array (),)), '_retrieveOptions' => array (), '_lastResponse' => NULL,)),), 'has_more' => false, 'total_count' => 1, 'url' => '/v1/customers/cus_9da91rn7gLhC2d/subscriptions',), '_unsavedValues' => Stripe\Util\Set::__set_state(array('_elts' => array (),)), '_transientValues' => Stripe\Util\Set::__set_state(array('_elts' => array (),)), '_retrieveOptions' => array (), '_lastResponse' => NULL,)),), '_unsavedValues' => Stripe\Util\Set::__set_state(array('_elts' => array (),)), '_transientValues' => Stripe\Util\Set::__set_state(array('_elts' => array (),)), '_retrieveOptions' => array (), '_lastResponse' => Stripe\ApiResponse::__set_state(array('headers' => array ('Server' => 'nginx', 'Date' => 'Sun, 27 Nov 2016 03:06:01 GMT', 'Content-Type' => 'application/json', 'Content-Length' => '2495', '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_9da94vcYeXgz5w', 'Stripe-Version' => '2016-07-06', 'Strict-Transport-Security' => 'max-age=31556926; includeSubDomains',), 'body' => '{ "id": "cus_9da91rn7gLhC2d", "object": "customer", "account_balance": 0, "created": 1480215961, "currency": "usd", "default_source": "card_19KIzJI8DcpffB1bbUG87DhV", "delinquent": false, "description": null, "discount": null, "email": "[email protected]", "livemode": false, "metadata": { "user_id": "129" }, "shipping": null, "sources": { "object": "list", "data": [ { "id": "card_19KIzJI8DcpffB1bbUG87DhV", "object": "card", "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, "brand": "Visa", "country": "US", "customer": "cus_9da91rn7gLhC2d", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 1, "exp_year": 2019, "fingerprint": "7cCImrkBsKyb8S1A", "funding": "credit", "last4": "4242", "metadata": {}, "name": "[email protected]", "tokenization_method": null } ], "has_more": false, "total_count": 1, "url": "/v1/customers/cus_9da91rn7gLhC2d/sources" }, "subscriptions": { "object": "list", "data": [ { "id": "sub_9da9u1VWytIjNq", "object": "subscription", "application_fee_percent": null, "cancel_at_period_end": false, "canceled_at": null, "created": 1480215961, "current_period_end": 1482807961, "current_period_start": 1480215961, "customer": "cus_9da91rn7gLhC2d", "discount": null, "ended_at": null, "livemode": false, "metadata": {}, "plan": { "id": "Unlimited", "object": "plan", "amount": 1000, "created": 1474078670, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": {}, "name": "Unlimited", "statement_descriptor": "BEATCART.FM", "trial_period_days": null }, "quantity": 1, "start": 1480215961, "status": "active", "tax_percent": null, "trial_end": null, "trial_start": null } ], "has_more": false, "total_count": 1, "url": "/v1/customers/cus_9da91rn7gLhC2d/subscriptions" } } ', 'json' => array ('id' => 'cus_9da91rn7gLhC2d', 'object' => 'customer', 'account_balance' => 0, 'created' => 1480215961, 'currency' => 'usd', 'default_source' => 'card_19KIzJI8DcpffB1bbUG87DhV', 'delinquent' => false, 'description' => NULL, 'discount' => NULL, 'email' => '[email protected]', 'livemode' => false, 'metadata' => array ('user_id' => '129',), 'shipping' => NULL, 'sources' => array ('object' => 'list', 'data' => array (0 => array ('id' => 'card_19KIzJI8DcpffB1bbUG87DhV', 'object' => 'card', '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, 'brand' => 'Visa', 'country' => 'US', 'customer' => 'cus_9da91rn7gLhC2d', 'cvc_check' => 'pass', 'dynamic_last4' => NULL, 'exp_month' => 1, 'exp_year' => 2019, 'fingerprint' => '7cCImrkBsKyb8S1A', 'funding' => 'credit', 'last4' => '4242', 'metadata' => array (), 'name' => '[email protected]', 'tokenization_method' => NULL,),), 'has_more' => false, 'total_count' => 1, 'url' => '/v1/customers/cus_9da91rn7gLhC2d/sources',), 'subscriptions' => array ('object' => 'list', 'data' => array (0 => array ('id' => 'sub_9da9u1VWytIjNq', 'object' => 'subscription', 'application_fee_percent' => NULL, 'cancel_at_period_end' => false, 'canceled_at' => NULL, 'created' => 1480215961, 'current_period_end' => 1482807961, 'current_period_start' => 1480215961, 'customer' => 'cus_9da91rn7gLhC2d', 'discount' => NULL, 'ended_at' => NULL, 'livemode' => false, 'metadata' => array (), 'plan' => array ('id' => 'Unlimited', 'object' => 'plan', 'amount' => 1000, 'created' => 1474078670, 'currency' => 'usd', 'interval' => 'month', 'interval_count' => 1, 'livemode' => false, 'metadata' => array (), 'name' => 'Unlimited', 'statement_descriptor' => 'BEATCART.FM', 'trial_period_days' => NULL,), 'quantity' => 1, 'start' => 1480215961, 'status' => 'active', 'tax_percent' => NULL, 'trial_end' => NULL, 'trial_start' => NULL,),), 'has_more' => false, 'total_count' => 1, 'url' => '/v1/customers/cus_9da91rn7gLhC2d/subscriptions',),), 'code' => 200,)),)) 
+0

**)**標準の 'php'以外に' stripe'を使用していますか? ** 2)**巨大な '配列'をコピー&ペーストしないでください。 ** 3)**顧客の 'id'は'変数 '' $ customer'のクラスのどこかにありますか? – Nytrix

+0

Hey Nytrix、はい、私は、データを解読することについてもっと知っている人が、print_r配列を見て計画額にアクセスする方法を知っているかもしれないと考えていました。 – Jeff

+0

'print_r'の代わりに' var_export($ customer) 'を表示できますか? –

答えて

0

:私は

$plan_amount = $customer->plan->amount; 

を試してみましたが、私var_export($customer);、これは私が得るデータである場合、それは

を動作しませんでした$customer_id = $customer->id;

を行うことで、顧客のIDを取得することができますそれは直接この質問に答えることはできませんが、私の元の問題の簡単な解決策です。

データは、私は隠された入力に計画量を格納し、最初のページのフォーム内のポストデータ

からそれを取り出すことができます掲載されているので:アクションページ内

<input type="hidden" value="999" name="planamount"> 

関連する問題