#jackson-subscription-schedule

1 messages · Page 1 of 1 (latest)

hard shoal
#

You need to look at the underlying's Subscription associated with the schedule and its latest_invoice

#

you will have to finalize that invoice first and then you can look at its PaymentIntent's client_secret

celest yoke
#

There isnt really an underlying subscription.

 customer: customerId,
        end_behavior: "cancel",
        start_date: "now",
        phases: [
          {
            items: [
              {
                price_data: {
                  currency: "usd",
                  product: "prod_Lrp0JmZeQ6CI1b",
                  recurring: {
                    interval: "month",
                  },
                  unit_amount: price * 100,
                },
                quantity: 1,
              },
            ],
            iterations: 1,
          },
          {
            items: [
              {
                price_data: {
                  currency: "usd",
                  product: "prod_Lrp0JmZeQ6CI1b",
                  recurring: {
                    interval: "month",
                  },
                  unit_amount: monthlyPrice * 100,
                },
                quantity: 1,
              },
            ],
            iterations: cycle,
          },
        ],
hard shoal
#

There is though

celest yoke
#

I created the subscription schedule like that on the backend

hard shoal
#

you create a Schedule, the first phase starts now, so there is a Subscription created automatically

celest yoke
#

With custom payment

hard shoal
#

in the response you should see subscription: 'sub_123'

celest yoke
#

Yes I see it

#

Could you direct me on how to finalise the invoice to get a client secret

hard shoal
#

So you have a SubscriptionSchedule. It's associated with a Subscription. That Subscription is associated with an Invoice in latest_invoice: 'in_123'. Then you can use the API to Finalize the Invoice https://stripe.com/docs/api/invoices/finalize and then that Invoice is associated with a PaymentIntent in payment_intent that you can expand (https://stripe.com/docs/expand) and get the client_secret

celest yoke
#

Thanks

#

Also, could you tell me why the subscription I created shows active on the dashboard even when the invoice has not been finalised

hard shoal
#

because it's how it works, at this point it's active

celest yoke
#

Okay, thanks

#

Just con confirm I have to fetch the subscription, then fetch the invoice attached to it and then finalise.

hard shoal
#

yes

celest yoke
#

Okay, checking it out

#

Wow! expand is a good thing haha