#emng-subscription

1 messages · Page 1 of 1 (latest)

real walrus
#

if default_payment_method isn't set on the subscription object, the subscription will use the invoices will use the customer’s invoice_settings.default_payment_method or default_source.

Retrieve the subscription and expand the parameters [0] e.g. customer.invoice_settings.default_payment_method

[0] https://stripe.com/docs/api/expanding_objects

clever pier
#

what if both invoice_settings.default_payment_method and default_source are null?

real walrus
#

then you can't make payment

#

the payment will fail

clever pier
#

so in the UI, I see this on the customer's subscription

#

I navigated here through customer -> actions -> update subscription. Is this suggesting that default_payment_method should be something other than null?

real walrus
#

no, not necessarily. You could have created a subscription with a trial via the API previously. At this point in time, the subscription doesn't need to have a default_payment_method nor does the customer need to have invoice_settings.default_payment_method or default_source set.

#

The customer could have that payment method before hand, but it's not the invoice_settings.default_payment_method or default_source

clever pier
#

so will this subscription charge ***4242 next cycle?

real walrus
#

can you share the subscription id so that i can take a look?

clever pier
#

I got here by creating a subscription on the server and passing the clientSecret to the UI and then making this call

      let { error } = await stripe.confirmCardPayment(data.clientSecret, {
        payment_method: {
          card: elements.getElement(CardElement),
          billing_details: {
            name: name,
          },
        },
      });

is this the correct way to make the subscription?

#

sure, this is using the test network, is that okay?

real walrus
#

you haven't updated either the default_payment_method on the subscription, or set that payment method as invoice_settings.default_payment_method

#

so no, payment wouldn't succeed

clever pier
#

subsequent payments, right? the initial payment looks like it went through fine

real walrus
#

yeah, subsequent payments

clever pier
#

I see so after the customer pays, I need to fetch the payment intent object and use it to set the default_payment_method on the subscription object?

real walrus
#

onesec, let me test something

clever pier
#

got it, thanks for the help!