#Sen-default-payment-methods

1 messages · Page 1 of 1 (latest)

barren forge
versed hearth
#

I know that after attach paymentMethod then I need to call another API customer update

#

Like stripe token, Can i use source as paymentmethod Id?

#

while create a customer pass source parameter

barren forge
#

tokens/sources are completely legacy so let's ignore them

#

you can pass a payment_method when creating a customer yes, as a shortcut to attach it at the same time

versed hearth
#

Greate so payment_method as paymentMethod Id right?

barren forge
#

yes! but really this is all the wrong way to use the API

#

you should never really attach methods directly like this, you should use SetupIntents or PaymentIntents

versed hearth
#

Actually, this way is not possible because i am creating an extension that is installing on third party user like nither me or stripe.

barren forge
#

I don't think that makes anything not possible

versed hearth
#

It will work with minimal configuration. Only set API keys and so on

versed hearth
barren forge
#

yep, it's a plugin, makes sense! It can (and should) still use our frontends like Elements/stripe.js and recommended integration flows like the one above.

Attaching cards directly a customer using those parameters above can and does cause problems with declines in Europe and other countries as cards need to be authenticated with 3D Secure before use.

versed hearth
#

Good, But third-party user doesn't know how to set up stripe.js with HTML. Also, we need custom logic applying while successfully subscribing.

barren forge
versed hearth
#

Yes, I have created a stripe payment field frontend that will use for the user.
As per use stripe JS flow, there are many get and post actions needed, and in the final steps, the subscription was created.

#

So that I am not able to applying custom logic and some other stuff

#

As per my current Flow is below:

  • User adds stripe fields with the plugin frontend.
  • Plugin use stripe JS to create PaymentMethod id.
  • This Id use while creating a customer and then a subscription.
  • After subscription is created automatically applying custom logic
barren forge
versed hearth
#

Also, Just Now tried payment_method when creating customer but the same error occurred:
This customer has no attached payment source or the default payment method.

When I checked the stripe dashboard with the customer then Payment methods attached

barren forge
#

sure but that's expected

#

I told you, it's two API calls.

#

you can pass a payment_method when creating a customer yes, as a shortcut to attach it at the same time

versed hearth
barren forge
#

attaching and setting as the default payment method are two separate things(and you probably only did the first one)

versed hearth
#

Sure, So can we are not able to set default method when customer create

barren forge
#

I think you can actually

let customer = await stripe.customers.create({
    email: "test@example.com",
    payment_method : "pm_xxx",
    invoice_settings:{default_payment_method:"pm_xxx"}
});
versed hearth
#

It works. I know recommend way is to use Payment/SetupIntents.
But stripe gives APIs and which working well then I think this way is better for my current situation.
I think the one issue is 3DS as you mentioned.
Is there a way to enable 3DS with my flow?

barren forge
#

well when you create the subscription and 3D Secure was required, the subscription status is incomplete, and you have to pass subscription.latest_invoice.payment_intent.client_secret to the frontend and call confirmCardPayment , so it can be done.

versed hearth
#

Thanks for your valuable support.
Have you reviewed RBI guidelines for Indians? Any new integration required for developer?

barren forge
versed hearth
#

Ok, My last question is when upgrade subscription with collection_method set charge_automatically then payment automatically deducted from customer bank account?

barren forge
versed hearth
#

yeah, What happens when the subscription expired? Like send invoice or charge_automatically ??

barren forge
#

what do you mean by 'expired'? Not sure I understand the question.

versed hearth
#

For example, my subscription period end date yesterday ( subscription expired ).

barren forge
#

ok, and what do you mean by "what happens"?

#

to be clear, subscriptions don't generally expire unless you explicitly cancel them or set them to cancel

#

they just recur ever month(or whatever interval you use) forever

versed hearth
versed hearth
#

Yes, I found Stripe tries to collect payment by either automatically charging the payment method on file, or sending the invoice to customers via email.
So for automatically charging any other configuration required?

barren forge
#

not sure what kind of configuration you mean but not really, this is just how subscriptions work