#ashishchicmic

1 messages · Page 1 of 1 (latest)

latent ridgeBOT
sick nimbus
#

You can try yes, but there is always a chance the bank will request 3DS/auth again. We do optimise to reduce chances of that though

compact flame
#
    const data = {
        customer,
        items: [
            { price },
        ],
        default_payment_method: cardId,
        collection_method: 'charge_automatically',
        transfer_data: {
            destination: config.STRIPE.ADMIN_CONNECT_ACCOUNT_ID,
            amount_percent: referralPercentages,
        },
        payment_behavior: 'default_incomplete',
        payment_settings: { save_default_payment_method: 'on_subscription' },
        expand: ['latest_invoice.payment_intent'],
    };

Above is the data which is used to create a asubscription, do I need to modify something?

sick nimbus
#

Seems mostly fine. Is there a specific error?

compact flame
#

i'm only getting invoice.created event

#

what about invoice.paid?

sick nimbus
#

Can you share the sub_xxx ID that is generated?

compact flame
#

sub_1NffjCKKfDNzQrclO9vdPgw7

sick nimbus
#

It's because you're passing payment_behavior: 'default_incomplete'

#

The Subscription will always start in an incomplete status with that param, until you manually confirm the associated Payment Intent

#

You can omit that, and it'll default to allow_incomplete which will automatically attempt payment

compact flame
#

Just did that, but now i'm getting invoice.payment_failed. Below is the request data while creating subscription:

{
  customer: 'cus_OSZ13YqsMKT0FF',
  items: [ { price: 'price_1N5mAtKKfDNzQrclMr6knebz' } ],
  default_payment_method: 'card_1NfdtAKKfDNzQrclc4xBy9Yh',
  collection_method: 'charge_automatically',
  transfer_data: { destination: 'acct_1NR9UZQKJsJv3hQy', amount_percent: 86.8 },
  payment_settings: { save_default_payment_method: 'on_subscription' },
  expand: [ 'latest_invoice.payment_intent' ]
}
sick nimbus
#

Again, the ID is more helpful

compact flame
#

sub_1Nfft1KKfDNzQrclpQXAoEVq

sick nimbus
#

I suspect that 3DS is requested. Any reason why you're using card_xxx objects?

#

So you'd need to bring your user on-session and confirm the Payment Intent

compact flame
#

According to my frontend dev, to confirm payment intent, we need a card element. But in this case while creating another subscription we don't have card element. is there another way?

sick nimbus
#

Well as I explained, you're using card_xxx objects which don't support being correctly setup/saved for future 3DS re-use like this

#

You should be using Payment Method objects that are generated via an initial Subscription or a Setup Intent

compact flame
#

So you are suggesting I should pass payment method id in default_payment_method?

sick nimbus
#

Well, yes. But the more pertinent question is whether the pm_xxx ID you have is correctly setup for off-session usage

#

To confirm, these are scenarios where your users are off-session yes?

#

We can request 3DS exemptions in those scenarios

compact flame
#

When I create inital subscription for the user then we follow the confirmation part from the user. is this what you mean by setup?

sick nimbus
#

Yes, that should generate a pm_xxx ID. Use that

#

Also, as I stated, if for these subsequent Subscriptions the user is offline (i.e. not present), then you need to pass off_session: true on creation

#

We can request exemptions which may reduce the likelihood of 3DS being requested

compact flame
#

ok. let me check it and get back

#

I guess there is some issue with my initial subscription also. because I checked when i get invoice.paid during initial subscription, the default payment method id null

#

I dont know what i'm doing wrong

#

what i'm doing is:

  1. create stripe customer
  2. create a card for that customer using stripe customer id and the card token i receive from frontend.
await stripe.customers.createSource(
    customerId,
    { source: token },
);
  1. create a subscription
autumn tendon
compact flame
#

now we are following same approach, using payment intents client secret to confirm payment on frontend. Also i'm getting invoice.create and invoice.paid event, but still i'm seeing default payment as null in invoice.paid event

#

sub_1NfgTNKKfDNzQrcljsLTAK5u , its the subsciption id

autumn tendon
#

if you are getting invoice.paid event that means the invoice was paid.

#

What are you looking for exactly ?

compact flame
autumn tendon
#

You need to refer to the invoice's payment_intent's payment method in order to get the PaymentMethod Id.

compact flame
#

this is my invoice.paid event id evt_1NfglOKKfDNzQrclY6GhdSUP. When i'm fetching payment intent details from this, i still get default payment method as null

autumn tendon
#

That event is for this invoice in_1NfglCKKfDNzQrclPH1TatYv with this PaymentIntent pi_3NfglCKKfDNzQrcl05fLMHCA and the payment_method is pm_1NfglGKKfDNzQrclLDz2Z0Cq

#

refer to the payment_method field of the PaymentIntent and not default_payment_method field of the invoice