#carbonara_unexpected
1 messages ¡ Page 1 of 1 (latest)
đ 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.
hi there, looking into this
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
Could you share with me the invoice paid in your test environment?
in_1Rl32KAIDeJhZYHqQKhSlsyk
Until the invoice_item was free it worked flawlessly
any news?
You shouldn't need to create a SetupIntent and then used the payment method to create a subscription right after that.
I see that you're using Payment Element, are you using it in subscription mode? https://docs.stripe.com/js/elements_object/create_without_intent#stripe_elements_no_intent-options-mode
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,
});
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
In test mode I used a card made to trigger 3D check, and it worked
pi_3Rl34jAIDeJhZYHq3jj5yCQ4 is currently in the state of requires_confirmation
it is not requesting for 3DS
ah ok, it's not 3DS
yes, you can verify it by looking up the payment intent in the Dashboard
It is expecting your integration to confirm the PaymentIntent: https://docs.stripe.com/api/payment_intents/confirm
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok, thank you
If you want to skip this step and have Stripe confirm the payment for you, you'd need to create the subscription by explicitly declaring allow_incomplete as the payment_behaviour: https://docs.stripe.com/api/subscriptions/create#create_subscription-payment_behavior
ok perfect, you saved me
you're welcome, let me know if there's anything else