I want to add order number in strip metadata. Added a code in stripe.php but order number get generated after order competition which means the order generated after payment approval from strip. So how I can add order number in strip metadata. Is there any module or API that I can add order number in strip after order get generated or any other idea achieve this.
Drupal community link of same question: Link here
strip.php in commerce_strip module // ‘description’ => ‘Order #: $order->GetOrderNumber(),
public function createPaymentIntent(OrderInterface $order, $capture = TRUE) { /** @var Drupalcommerce_paymentEntityPaymentMethodInterface $payment_method */ $payment_method = $order->get('payment_method')->entity; $payment_method_remote_id = $payment_method->getRemoteId(); $customer_remote_id = $this->getRemoteCustomerId($order->getCustomer()); $amount = $this->toMinorUnits($order->getTotalPrice()); $order_id = $order->id(); $capture_method = $capture ? 'automatic' : 'manual'; $intent_array = [ 'amount' => $amount, 'currency' => strtolower($order->getTotalPrice()->getCurrencyCode()), 'payment_method_types' => ['card'], 'description' => 'Order #: $order->GetOrderNumber(), 'metadata' => [ 'order_id' => $order_id, 'store_id' => $order->getStoreId(), ], 'payment_method' => $payment_method_remote_id, 'capture_method' => $capture_method, ]; if (!empty($customer_remote_id)) { $intent_array['customer'] = $customer_remote_id; } try { $intent = StripePaymentIntent::create($intent_array); $order->setData('stripe_intent', $intent->id)->save(); } catch (StripeExceptionApiErrorException $e) { ErrorHelper::handleException($e); } return $intent; }