#carbonara_unexpected

1 messages ¡ Page 1 of 1 (latest)

forest hazelBOT
#

👋 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/1394579111019679775

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

indigo ether
#

hi there, looking into this

still knot
#

In test environment it ask the customer to do the 3D check and then pays. While in prod it just defaults to "Not Completed".
Before using the card we do a SetupIntent:

$setupIntent = SetupIntent::create([
        'customer'             => $customerId,
        'payment_method_types' => ['card'],
        'usage'                => 'off_session',
    ]);

and then when the user subscribes:

$subscription = Subscription::create([
        'customer' => $customerId,
        'items'    => [
            [
                'price_data' => [
                    'currency'    => 'eur',
                    'product'     => $_ENV['STRIPE_FOOD_ID'],
                    'unit_amount' => $regularPrice,
                    'recurring'   => [
                        'interval'       => 'week',
                        'interval_count' => 4,
                    ],
                ],
            ],
        ],
        'trial_period_days' => 14,
        'trial_settings'    => [
            'end_behavior' => ['missing_payment_method' => 'pause'],
        ],
        'metadata' => [
            'product_type' => 'food_plan',
        ],
        'payment_behavior'       => 'default_incomplete',
        'default_payment_method' => $paymentMethodId,
        'proration_behavior'     => 'none',
        'expand'                 => ['latest_invoice.payment_intent'],
        'add_invoice_items'      => [
            [
                'discounts'  => $sconti,
                'price_data' => [
                    'currency'    => 'eur',
                    'product'     => $_ENV['STRIPE_TRIAL_ID'],
                    'unit_amount' => $trialPrice,
                ],
            ],
        ],
    ]);

and return the client secret

indigo ether
#

Could you share with me the invoice paid in your test environment?

still knot
#

in_1Rl32KAIDeJhZYHqQKhSlsyk

#

Until the invoice_item was free it worked flawlessly

#

any news?

indigo ether
still knot
#

Customer setup their payment methods for making any other purchase on the platform. This is why I need to do a SetupIntent and Payment Element. At checkout I create the subscription in the backend and the send the secret to the frontend:
.confirmCardPayment(this.clientSecret, {
payment_method: this.chosenMethod.id,
return_url: url,
});

indigo ether
#

Also, payments in test environment aren't send to card issuers like banks so when testing 3DS, it is important to note that 3DS could occur in production if it doesn't occur in test mode. This is because whther or not 3DS is triggered is up to the card issuer's decision

#

but wait

still knot
#

In test mode I used a card made to trigger 3D check, and it worked

indigo ether
#

pi_3Rl34jAIDeJhZYHq3jj5yCQ4 is currently in the state of requires_confirmation

#

it is not requesting for 3DS

still knot
#

ah ok, it's not 3DS

indigo ether
#

yes, you can verify it by looking up the payment intent in the Dashboard

still knot
#

ok, thank you

indigo ether
still knot
#

ok perfect, you saved me

indigo ether
#

you're welcome, let me know if there's anything else