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

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -