#Sen-default-payment-methods
1 messages · Page 1 of 1 (latest)
@versed hearth sure, you can pass either https://stripe.com/docs/api/subscriptions/create#create_subscription-default_payment_method or set https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
You can't set it at the same time as attaching, it's two API calls.
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
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
Greate so payment_method as paymentMethod Id right?
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
for example if you were following our guide for creating a subscription (https://stripe.com/docs/billing/subscriptions/elements) the payment method gets automatically attached when confirming the Invoice's PaymentIntent on the frontend
Actually, this way is not possible because i am creating an extension that is installing on third party user like nither me or stripe.
I don't think that makes anything not possible
It will work with minimal configuration. Only set API keys and so on
Thanks, Please tell me issue i will face because i don't know about it.
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.
really it's as straightforward as just following our guides. If you want to create a subscription, the easiest way is to use Checkout https://stripe.com/docs/billing/subscriptions/checkout and I'd always recommend that first; or if building your own payment page, https://stripe.com/docs/billing/subscriptions/elements
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.
sure but your plugin would generally be the one building the frontend page for the user.
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
cool, you can do all this using https://stripe.com/docs/billing/subscriptions/elements really.
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
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
you still have to pass pass either https://stripe.com/docs/api/subscriptions/create#create_subscription-default_payment_method or set https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
after attaching it
No attach successfully i have checked
attaching and setting as the default payment method are two separate things(and you probably only did the first one)
Sure, So can we are not able to set default method when customer create
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"}
});
but again, this is not really the intended way to use the API, you should use Payment/SetupIntents for attaching the card(per https://stripe.com/docs/billing/subscriptions/elements).
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?
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.
Thanks for your valuable support.
Have you reviewed RBI guidelines for Indians? Any new integration required for developer?
most likely yes, but https://support.stripe.com/email can give you the best answer there, it's a rapidly moving situation
Ok, My last question is when upgrade subscription with collection_method set charge_automatically then payment automatically deducted from customer bank account?
if the type of update to the subscription requires a payment or you make one required with proration_behavior:always_invoice (https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#immediate-payment) then yes, that will attempt to automatically charge the customer's saved payment method.
yeah, What happens when the subscription expired? Like send invoice or charge_automatically ??
what do you mean by 'expired'? Not sure I understand the question.
For example, my subscription period end date yesterday ( subscription expired ).
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
I mean how does payment takes place when recur? Like the end of recurring payment automatically take place?
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?
not sure what kind of configuration you mean but not really, this is just how subscriptions work