#ReneDenmark-sub-payment-method

1 messages ยท Page 1 of 1 (latest)

small lance
#

Hey! What API call does your webhook function make?

quick token
#

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.

small lance
#

And how was that failing? Seems ok to me

#

Ah, so there's no actual error?

quick token
#

I didn't implement it ๐Ÿ™‚

#

Misread the docu. And only the "invoice.paid" function.

#

Now all our renewals fail and are set to "Incomplete".

small lance
#

And how were the PMs/Subscriptions created?

quick token
#

Using that tutorial

small lance
#

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

quick token
#

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.

small lance
#

That customer has a payment method attached (just a part of the subscription integration flow), but it's not set as the default

quick token
#

Yes. Is there a way for me to update that?

small lance
#

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?

quick token
#

First one.

small lance
#

Ok, so this is what you need to do:

Create and manage subscriptions to accept recurring payments.

quick token
#

Ahh. Great. So I kindda manually call the "invoice.payment_succeeded". Got it

small lance
#

Yes you'd just emulate that call but instead of juggling the Payment Intent IDs, just use the Customer ID

quick token
#

Didn't think of that. Thank you.

small lance
#

np!

quick token
#

Hi. I get a PM not found. But I can find it in the dashboard.

small lance
#

You're using the PaymentIntentService

quick token
#

Oh.. Yeah. I can drop that step

#

Sorry. Stressed about this issue ๐Ÿ™‚

small lance
#

Understandable! Here to help

quick token
small lance
#

Yeah I can see default_payment_method is set on that subscription: pm_1KVqibJsjvjUViQZ4jeD9qav

quick token
#

Perfect. You are a life/stress saver ๐Ÿ™‚ Ahh.. I can find it now myself.... Thanks again

small lance
#

Np!