#mamtabajaj_api

1 messages ¡ Page 1 of 1 (latest)

uncut vaporBOT
#

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

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

lethal tapir
#

hi there, can you describe what you mean by OTP? At what point in your flow does this occur? I want to be sure we're on the same page with terminology

soft wing
#

with OTP I mean 3DS

#

I executed two scenarios

#

In First case, stripe ask for 3DS at upfront payment, and later subscription was scheduled and active successfully

In second case, with same card, 3ds was not requested in upfront payment, but then subscription was marked as Incomplete

#

With message "3ds verification incomple"

lethal tapir
soft wing
#

const subscription = await stripe.subscriptions.create({
customer: customerId,
items: [{ price: subsPriceId }],
off_session: true,
payment_behavior: 'allow_incomplete',
automatic_tax: {
enabled: true,
},
default_payment_method: paymentMethodId,
payment_settings: {
save_default_payment_method: "on_subscription",
},
metadata: {
source: "checkout",
paymentIntentId,
}
});

#

yes I do have allow_incomplete

lethal tapir
#

default_incomplete is generally recommended over allow_incomplete to allow you to handle 3DS scenarios for Subscriptions

soft wing
#

subscription is created couple of days after the upfront payment
At that time, I don't have hold of customer

#

Customer makes upfront payment, and system ship the product. when product is delivered monthly subscription is started for customer until he keeps the product

#

So customer interaction is available during upfront payment only

lethal tapir
#

I see, so is the upfront payment being handled with a Payment Intent with setup_future_usage: off_session?

soft wing
#

Yes at the time of create payment intent I am using below api call
const paymentIntent = await stripe.paymentIntents.create({
amount: totalAmount, // already discounted before sending
currency: mainPrice.currency,
customer: customer.id,
automatic_payment_methods: { enabled: true },
setup_future_usage: "off_session",
metadata: {
mainPriceId,
subsPriceId,
baseAmount,
shippingAmount
}
});
here I have setup_future_usage: "off_session", parameters

lethal tapir
#

got it, thanks. so even when using setup_future_usage, it's still possible for the issuing bank to request 3DS on subsequent payments. Stripe doesn't control this, it's up to the bank. when this happens for an off-session payment, like a subscription payment, you'll need to redirect your customer bank to your site so that they can go through the 3DS flow and complete the payment

soft wing
#

but how we can redirect customer to 3DS flow

#

this is automated and behind the scene when customer is not present

#

do we need to send the invoice over email or something?

lethal tapir
#

you would need to send an email to the customer with a link to bring them to your site

soft wing
#

you mean invoice link?

#

I have to send the invoice link over customer email right ?

#

there ?

lethal tapir
soft wing
#

ok, thanks!

soft wing
#

there ?

lethal tapir
#

yes, did you have another question?

soft wing
#

yes

#

Query:-
at the time of update payment intent I am calculating the tax based on address and when confirm the payment intent stripe dashboard have 2 entries under transaction

  1. with label :- out of bond
  2. with label payment intent Id
    in the stripe dashboard.
    does this default stripe behaviour in case of slaes tax calculation?
lethal tapir
#

we're not super familiar with the dashboard or tax calculation in this channel, but I can try to answer. can you paste the ID of the Payment Intent here? it would look like pi_1234abcd

soft wing
#

pi_3T47qJD8a3BxMYPJ1GpkMLFB

#

above image is from test and payment intent ID is from LIVE enviornment

#

this is live transaction screenshot

lethal tapir
#

ah, so this is for invoice payments, can you share the Invoice ID? in_1234

#

my suspicion is that these are actually two separate transactions with the same amount. the "Paid out of band" sounds like an Invoice that was paid out of band separately from the Payment Intents you supplied

soft wing
#

I created the manually invoice

#

for the payment upfront payment

#

under invoices stripe shows one entry but under transaction it has 2 entries

#

invoice id is
in_1T47wsD8a3BxMYPJa2e6OEGW

#

I just need to confirm that is this stripe default behaviour

lethal tapir
#

got it, thanks for providing that Invoice ID. let me try to replicate this behavior, one moment

soft wing
#

Ok

lethal tapir
#

so yes, this is expected behavior, since you're creating a Payment Intent and then creating an Invoice and paying it out of band, this will create two separate records

uncut vaporBOT
soft wing
#

Ok

#

Thanks for the clarification

#

Please confirm , stripe will charge to customer only one and generate 2 transaction entries because of sales tax right?

lapis galleon
#

Hi there. I'm taking over for denton here, who had to step away

soft wing
#

Ok

#

Please confirm , stripe will charge to customer only one and generate 2 transaction entries because of sales tax right?

lapis galleon
#

give me a moment to catch up on your thread

soft wing
#

ok

lapis galleon
#

Okay, so for the smaller amount that says "pending" in the most recent screenshot - are you creating that PaymentIntent manually for a sales tax amount and attaching it to your Invoice?

#

I'm just trying to understand where that numer is coming from

soft wing
#

Actually I create and updated the payment intent using api with the sales tax based on address. i can see the 2 entries under transaction but under invoice i have one entry

#

after creating the payment intent I amn creating invoice with "paid out of bond"

lapis galleon
#

And your question is about the PaymentIntent that you've created previously, right?

#

so what's the PaymentIntent that corresponds to in_1T47wsD8a3BxMYPJa2e6OEGW?

soft wing
#

yes

lapis galleon
#

so what's the PaymentIntent that corresponds to in_1T47wsD8a3BxMYPJa2e6OEGW?

soft wing
#

pi_3T47qJD8a3BxMYPJ1GpkMLFB

lapis galleon
#

okay - this is just a one-off PaymentIntent which has already been paid. It may represent something related to in_1T47wsD8a3BxMYPJa2e6OEGW in your accounting, but it doesn't have a relationship with that Invoice in Stripe

#

in_1T47wsD8a3BxMYPJa2e6OEGW is marked paid out of band, so there is no charge to the Customer

soft wing
#

Ok

#

I have one more query

lapis galleon
#

Sure thing

soft wing
#

Can I discuss

lapis galleon
#

By all means

soft wing
#

I have created the customer and payment intent and when payment confirm I have updated the payment customer name,email and address information after webhook response. I am using the saved payment method to start the subscription later on after few days. please clarify is the below step required when I call the udate customer api
await stripe.customers.update(customer.id, {
invoice_settings: {
default_payment_method: paymentmethodId,
},
});

#

so I need to specify the invoice_settings parameter as well at the time of update customer information like email,name and address

#

invoice_settings parameter is required when I used the saved payment method to start the subscription without user interference

lapis galleon
#

Setting that parameter means that the payment method set as the value will be the default payment method used for all Subscriptions and Invoices where the Payment Method is not explicitly defined on the individual Invoice or Subscription

#

It isn't strictly speaking necessary, because you could instead choose to manage the Payment Method at the level of the individual Subscription or Invoice. But you have to do one or the other

#

To sum up, when Stripe chooses what payment method to charge for a Subscription or Invoice, the Payment Method set as default_payment_method on the Subscription or Invoice has precedence, if set, and after that we fall back to customer.invoice_settings.default_payment_method

uncut vaporBOT
soft wing
#

Ok thank you

rain ingot
#

Hi there, I took over for my colleague who had to step away...
You're welcome

soft wing
#

I have no other queries thank you

rain ingot
#

Perfect! Have a great rest of your day.

soft wing
#

You too