PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.1
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.1
1.7.1 1.7.0 1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 All 51 releases
← All changes | app/Modules/PaymentMethods/StripeGateway/Stripe.php +20 -16 1.6.5 → 1.7.1 View file →
@@ -91,8 +91,9 @@
91 91 'description' => $storeName . ' #' . $order->invoice_no, // @todo: We will replace with order summary with item names later
92 92 'customer_email' => $paymentInstance->order->email,
93 93 'success_url' => $paymentInstance->transaction->getSuccessUrl(),
94 94 'gateway_return_url' => Processor::getOnsiteGatewayReturnUrl($paymentInstance->transaction),
95 + 'trx_hash' => $paymentInstance->transaction->uuid,
95 96 'custom_payment_url' => PaymentHelper::getCustomPaymentLink($paymentInstance->order->uuid)
96 97 );
97 98
98 99 if ($paymentInstance->subscription) {
@@ -480,8 +481,11 @@
480 481 'redirecting for action' => __('redirecting for action', 'fluent-cart'),
481 482 'You will be redirected to Stripe to complete your payment securely.' => __('You will be redirected to Stripe to complete your payment securely.', 'fluent-cart'),
482 483 'Something went wrong' => __('Something went wrong', 'fluent-cart'),
483 484 'Payment confirmation failed' => __('Payment confirmation failed', 'fluent-cart'),
485 + 'Payment failed. Please try again.' => __('Payment failed. Please try again.', 'fluent-cart'),
486 + 'We could not record that failed attempt. Please reload the page before trying again.' => __('We could not record that failed attempt. Please reload the page before trying again.', 'fluent-cart'),
487 + 'We could not verify your payment status. Please do not pay again. Contact the store to check your order status.' => __('We could not verify your payment status. Please do not pay again. Contact the store to check your order status.', 'fluent-cart'),
484 488 ]
485 489 ]
486 490 ];
487 491 }
@@ -839,11 +843,13 @@
839 843 // mode — a zero-amount payment mode is invalid — and consent becomes a
840 844 // required checkbox: without a saved card the trial can never bill.
841 845 $payableNow = \FluentCart\App\Services\OrderService::getItemsAmountTotal($cart->cart_data ?? [], false, false);
842 846 if ($payableNow <= 0) {
847 + // Match the SetupIntent usage even when the optional save-card flag is set.
843 848 $intentData = [
844 - 'mode' => 'setup',
845 - 'currency' => strtolower($storeCurrency),
849 + 'mode' => 'setup',
850 + 'currency' => strtolower($storeCurrency),
851 + 'setup_future_usage' => 'off_session',
846 852 ];
847 853 $consentRequired = true;
848 854 }
849 855 }
@@ -854,22 +860,20 @@
854 860 } elseif (empty($intentData['setup_future_usage']) && Arr::get($data, 'save_payment_method') === 'yes') {
855 861 $intentData['setup_future_usage'] = 'on_session';
856 862 }
857 863
858 - // The browser cannot pass setup_future_usage per-request (this endpoint
859 - // receives no body), so extensions that vault cards (e.g. saved payment
860 - // methods) resolve it here, server-side. Must be matched on the actual
861 - // PaymentIntent at place-order (fluent_cart/payments/stripe_onetime_intent_args)
862 - // or Stripe rejects the confirmation for a setup_future_usage mismatch.
863 - $setupFutureUsage = apply_filters(
864 - 'fluent_cart/stripe/client_setup_future_usage',
865 - Arr::get($intentData, 'setup_future_usage'),
866 - ['data' => $data, 'has_subscription' => $hasSubscription]
867 - );
868 - if ($setupFutureUsage) {
869 - $intentData['setup_future_usage'] = $setupFutureUsage;
870 - } else {
871 - unset($intentData['setup_future_usage']);
864 + // a one-time payment may be changed here.
865 + if ($intentData['mode'] === 'payment') {
866 + $setupFutureUsage = apply_filters(
867 + 'fluent_cart/stripe/client_setup_future_usage',
868 + Arr::get($intentData, 'setup_future_usage'),
869 + ['data' => $data, 'has_subscription' => $hasSubscription]
870 + );
871 + if ($setupFutureUsage) {
872 + $intentData['setup_future_usage'] = $setupFutureUsage;
873 + } else {
874 + unset($intentData['setup_future_usage']);
875 + }
872 876 }
873 877
874 878 wp_send_json(
875 879 [