#sergx_code

1 messages · Page 1 of 1 (latest)

golden sirenBOT
patent riverBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

golden sirenBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1243153168636973127

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

candid sable
#
$subscription = $this->stripe->subscriptions->create([
                'customer' => $currentUser->stripe_id,
                'items' => [
                    ['price' => $planPriceId, 'quantity' => 1],
                    ['price' => $employeesPriceId, 'quantity' => $request->employees],
                ],
                'proration_behavior' => 'always_invoice',
                'payment_behavior' => 'default_incomplete',
                'default_payment_method' => $currentUser->defaultPaymentMethod()->id,
                'metadata' => [
                    'client_id' => $newUser->id,
                    'client_name' => $newUser->name,
                ],
                'coupon' => config('app.agency_discount'),
                'description' => 'Suscripción cliente: ' . $newUser->name,
                'automatic_tax' => ['enabled' => true],
                'expand' => ['latest_invoice.payment_intent', 'pending_setup_intent'],
            ]);

#
$paymentIntent = $subscription->latest_invoice->payment_intent;
        if ($paymentIntent->status === 'requires_action' || $paymentIntent->status === 'requires_payment_method') {
            $clientSecret = $subscription->latest_invoice->payment_intent->client_secret;
            return response()->json([
                'requires_action' => true,
                'client_secret' => $clientSecret,
            ]);
        }
lean river
#

hi there!

candid sable
#

Request of subscription creation: req_ksvmjBtIKjZwlR

Request of setup intent: req_KPwxmqLEexZrwQ

#

For testing I'm using a card that requires 3Ds auth, and I was expecting to receive 'requires_action' as status parameter

lean river
#

I'm not sure I understand your question. the Subscription you shared has the PaymentIntent in requires_confirmation status. so next step is to confirm that PaymentIntent on the frontend to trigger the 3DS flow.

candid sable
#

oh I was looking at setup intent request where the status was 'requieres_payment_method' and I was a ltitle bit confused, sorry

#
$paymentIntent = $subscription->latest_invoice->payment_intent;
        if ($paymentIntent->status === 'requires_action' || $paymentIntent->status === 'requires_payment_method' || $paymentIntent->status === 'requires_confirmation') {
            $clientSecret = $subscription->latest_invoice->payment_intent->client_secret;
            return response()->json([
                'requires_action' => true,
                'client_secret' => $clientSecret,
            ]);
        }

wioth this it would be enough to handle 3ds secure in the backend?

#

I use confirm card payment in frontend with React!

lean river
#

yes you retrieve the client secret, send it to the frontend, and then call the function I shared above to trigger 3DS.

candid sable
#

Perfect thank you so much, it's working!