#ReneDenmark-sub-payment-method
1 messages ยท Page 1 of 1 (latest)
var service = new PaymentIntentService();
var paymentIntent = service.Get(invoice.PaymentIntentId);
var options = new SubscriptionUpdateOptions
{
DefaultPaymentMethod = paymentIntent.PaymentMethodId,
};
var subscriptionService = new SubscriptionService();
subscriptionService.Update(invoice.SubscriptionId, options);
Which hasn't been called for our customers the last month.
I didn't implement it ๐
Misread the docu. And only the "invoice.paid" function.
Now all our renewals fail and are set to "Incomplete".
And how were the PMs/Subscriptions created?
Got it. Do you have a related Customer ID you can share in this instance?
In all likelihood, the Payment Method will be 'attached' to the Customer but not set as the default
Sure. 2 sec
This one should not have a default payment method.
I can't send you a failed renewal just yet. I did them manually earlier today. But there will be more later today.
Yep, so that's a PI from the initial invoice for a subscription for this customer: https://dashboard.stripe.com/customers/cus_LCHL550CnuJDnl
That customer has a payment method attached (just a part of the subscription integration flow), but it's not set as the default
Yes. Is there a way for me to update that?
You can set the default PM for a subscription at either the subscription, or customer level. The subscription level takes precedence, but the customer level is the 'fallback' (if that makes sense?)
For example I have 2 subs:
- Sub X has pm_1 set as the default so recurring payments use that|
- Sub Y has no default set, so instead it uses pm_2 set on the customer
Which is your preference here?
First one.
Ok, so this is what you need to do:
- List all payment methods for the customer: https://stripe.com/docs/api/payment_methods/customer_list
- From what response, take the required
pm_xxxand update the subscription to set thedefault_payment_method: https://stripe.com/docs/billing/subscriptions/build-subscription?ui=elements#default-payment-method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Create and manage subscriptions to accept recurring payments.
Ahh. Great. So I kindda manually call the "invoice.payment_succeeded". Got it
Yes you'd just emulate that call but instead of juggling the Payment Intent IDs, just use the Customer ID
Didn't think of that. Thank you.
np!
You're using the PaymentIntentService
Understandable! Here to help
Last thing. I have updated the customer now. Could check if payment method is ok?
https://dashboard.stripe.com/subscriptions/sub_1KVqhjJsjvjUViQZ2b8n8j9t
Yeah I can see default_payment_method is set on that subscription: pm_1KVqibJsjvjUViQZ4jeD9qav
Perfect. You are a life/stress saver ๐ Ahh.. I can find it now myself.... Thanks again
Np!