#akdj16

1 messages ยท Page 1 of 1 (latest)

violet parcelBOT
turbid helm
#

๐Ÿ‘‹ happy to help

#

would you mind explaining why are you opting for Subscription Schedules?

lapis rapids
#

Hello! it is because I want to apply more than one discount (coupon) on the first invoice of the subscription (let's me find the thread about that, it is in this channel)

indigo goblet
#

Hi! I'm taking over this thread.

#

Unfortunately it's not possible to set "payment_behavior" to "default_incomplete" in a subscription schedule. What exactly are you trying to accomplish here?

lapis rapids
#

Hi @indigo goblet it's been a while ๐Ÿ™‚

indigo goblet
#

Yes, I remember our conversation!

lapis rapids
#

and I want that the subscription becomes active after the payment

#

but because of the subscriptionSchedule, I cannot create a subscription with incomplete status ๐Ÿฅฒ so I am searching a way to have both: a subscription in incomplete status and be able to add discounts to the invoice

#

does the incomplete status will create draft invoice? if so, I may be able to have both?

indigo goblet
#

Thanks for the clarification. Give me a few minutes to look into this.

narrow veldt
#

Hi there ๐Ÿ‘‹ I'm jumping in as my teammate needs to step away. No, creating a Subscription with payment_behavior set to default_incomplete will not cause the first Invoice that is generated to wait before being finalized.

lapis rapids
#

do you mean the invoice will be in draft status?

narrow veldt
#

No, the Invoice will not sit in a draft status, it will immediately move to an open state.

lapis rapids
#

so, impossible to add new discount or new invoice item on it?

narrow veldt
#

Correct, it will be finalized immediately.

#

I scrolled through your previous conversation, but wanted to make sure I pulled out the right list of requirements that you're looking for. Is the below what you're looking for?

  • Be able to add multiple coupons
  • Have the Subscription in an incomplete state until the first payment succeeds
lapis rapids
#

yes, exactly ๐Ÿ™

narrow veldt
#

I don't think that's possible. Is it safe to assume that you're interested in the incomplete state mostly so you can track when it changes to active and can grant access to your product/service?

lapis rapids
#

yes, but I cannot remove the ability to have discounts on first month subscription in exchange for having the grant access feature

narrow veldt
#

I was thinking of it the other way around.

#

When you create the Subscription Schedule, you can retrieve the Subscription and it's first Invoice so you can apply the coupons to that Invoice. At that point you know the ID of the first Invoice and can store that, you can then listen for invoice.payment_succeeded events particularly looking for ones that match the ID of the Invoice that you noted earlier. Then you know the Invoice for that first Subscription was paid and can grant access accordingly.

lapis rapids
#

oh, in fact this way is already implemented. I already have the webhook handler for "invoicePayment.succeeded", and it works well. However, on the user's view, when the user do a subscription, the frontend will show as it is correctly subscribed even if the payment failed, there is a little delay for showing the contrary on the frontend.

narrow veldt
#

Hm, that's a good point. How quickly are you planning to add coupons to, and finalize, the draft invoices?

lapis rapids
#

immediately after the schedule is created

narrow veldt
#

Could you change your success page to say that the order is being processed instead of immediately telling them it was successful?

lapis rapids
#

I think yes, but I need to discuss with my team to confirm it. But before that, I have a question about the good way to do in a product view: I am thinking about create on the frontend a loading page between the page about "confirm your subscription" and "your subscription is successful created". And on this page, it will doing a pull event to the backend, to catch the payment.succeeded event. Like user will wait the loading page until the subscription creation is a success/failure.
Did you have an estimation about how long it will take to have an invoicePayment event after an invoice payment request? Could you tell me it is a good way to do?

narrow veldt
#

Those events should be generated within a matter of seconds from the successful payment. I think it's a good idea, but I'd be hesitant to dedicate the entire page to it in case it does take a long time. Personally I'd probably try to put it in a smaller portion of the page, or use the polling to trigger some sort of notification that is presented when the payment is successful, but you know your page best and how to make this align with the look and feel that you're after.

lapis rapids
#

Ok thanks a lot!