#Matt P

1 messages · Page 1 of 1 (latest)

simple summitBOT
glossy girder
#

Hi there! Could you share an example subscription ID?

#

Does the coupon you're using apply to any of the items on the subscription?

flat cedar
#

it does apply to the sub but not the amount they first pay

#

cus_MyZEpnoGsY2ZOn
sub_1N3452JyFlemKh0g9QUbe8vC

#

And I have confirmed that the coupon is applied to the sub before I checkout

glossy girder
#

Okay, so I see the subscription was created with a 20% off coupon first and the invoice was finalized with that 20% off coupon. the request to update the subscription with the new 30% off coupon comes after the invoice was finalized

flat cedar
#

but we are calling to update the coupon before we checkout

glossy girder
#

That doesn't matter in this case. If a subscription's collection_method is charge_automatically, a subscription's first invoice will be automatically finalized and paid when the subscription is created

#

Out of curiosity, why is the 30% off coupon not being added initially?

flat cedar
#

Because we want the user to be able to add and modify their sub coupon before they checkout

#

for this particular sub we automatically add a 20% coupon

#

so the sub is in an incomplete when I call to update the coupon

prisma geyser
#

Roadrunner, what can we change the collection_method to so that it will not finalize the invoice until the user completes their checkout?

glossy girder
#

There are a few ways around this automatic finalization of the first invoice:

  • You can create the subscription with collection_method: send_invoice. This will give you a ~1hr period where the first invoice is in draft and you can update the coupon. If you go this route, you can update the collection_method after the first payment is complete so the next payment is automatic
#
  • If you want to keep collection_method: charge_automatically with the first invoice, you can create a subscription with a trial_end set a few seconds into the future. The first invoice will be created for $0, and once the trial period is over in a few seconds, a second non-zero invoice will be created. This second invoice will have a ~1hr draft period and the coupon you update on the subscription should apply to this second invoice
prisma geyser
#

If the second method works for us I think that's the easiest. I'll work on implementing that in our back end. Thank you.