php - Not able to get transaction id in subscription plan -


i working stripe payment option project. have recurring option , that's why have created plans in subscription page.

after creating plans have defined plan when new stripe customer register.

try {     $customer = \stripe\customer::create([     'source' => $token,     'email' => $email,     'plan' => '20-39-r',     'metadata' => [         "first name" => $first_name,         "last name" => $last_name     ]     ]); } catch (\stripe\error\card $e) {     return redirect()->route('order')         ->witherrors($e->getmessage())         ->withinput(); } 

when have dump($customer) variable not getting transaction id.

any idea why not getting transaction id during customer creation?here <code>dump($customer)</code> response

the customer object doesn't store list of transaction ids think you'd call id of charge made on customer's card right? customer holds information sources (used pay) , subscriptions created after customer subscribed plan.

here can see sub_xxxxx in subscriptions[data][0][id] corresponds id of subscription created on customer plan 20-39-r.

if want charge id, ch_xxxxx use list chargesapi , pass customer id, cus_xxxxx, in `customer parameter limit charges ones created on customer. first 1 in list latest charge , 1 corresponding subscription. confirm checking invoice associated charge , confirming it's subscription.


Comments

Popular posts from this blog

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -

c# - Populating Gridview inside Listview ItemTemplate On Web User Control from Code Behind -