Untitled - Posted on September Thu 3rd 6:37 PM (Never Expires) - Format: text
  1. //Checkout page
  2.  
  3. $paymentIntent= \Stripe\PaymentIntent::create([
  4.                                                                                 'amount' => $final_price * 100,
  5.                                                                                 'currency' => strtolower($term->currency),
  6.                                                                                 'payment_method_types' => ['card'],
  7.                                                                                 'customer'=>$customer->id,
  8.                                                                                 'setup_future_usage'=>'off_session'
  9.                                                                 ]);
  10. //After JS processes the card, all data is send to setup page
  11.  
  12. $paymentIntent = \Stripe\PaymentIntent::retrieve($subscription['payment_intent_id']);
  13. if (isset($subscription['stored_card']) && $subscription['stored_card'] == 'stored_card') {
  14.     // $payment_method = \Stripe\PaymentMethod::retrieve($paymentIntent->payment_method->id);
  15. } else {
  16.     $payment_method = \Stripe\PaymentMethod::retrieve($subscription['payment_method_id']);
  17.     if (!isNotNull($payment_method->customer)) {
  18.         var_dump($payment_method);
  19.         exit;
  20.         $payment_method->attach(['customer' => $userPaymentAccount->external_id]);
  21.     }
  22. }

New Paste

Paste Options

Recent Pastes

12 days ago

stripe

12 days ago

Untitled

13 days ago

run stripe liste

15 days ago

Untitled

16 days ago

remove duplicate

19 days ago

Untitled

21 days ago

Untitled

21 days ago

Untitled

22 days ago

Untitled

22 days ago

try this one