#cho_best-practices

1 messages ยท Page 1 of 1 (latest)

ember fieldBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1228341246179934248

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

swift plazaBOT
daring zenith
#

Sorry , I got cut off:

I am doing the following steps:

  • make a setup intent
  • create a subscription schedule
  • use payment method in setup intent to pay subscription schedule invoice manually
  • I await the result and check invoice.status === 'paid'
#

I modified my code yesterday, but essntially this is what I had

#

and the else block code never fired, ever, even though we have had payment failures

#

very peculiar since I expect invoice.status === 'open' when it fails

#

this is how i fire it

thick grove
#

Have you added some logs when you test this?

#

That way you can see the code path when a payment fails

daring zenith
#

I added logs into the else code

#

and it does not fire at all

thick grove
#

Outside that

daring zenith
#

I don't see the log

thick grove
#

So you can see the exact path the code takes when invoice payment fails

daring zenith
#

I don't quite get what you mean

thick grove
#

Like add a log in every single block

#

So you can trace the code

daring zenith
#

because there was no thing after the else

#

there was no return statement AFTER the else

#

because I had the if - else and returns in both typescript let me do that

#

Wait is invoice.status === 'paid' actually best practice?

#

because then I'll just have to do some heavy debugging with the logs

daring zenith
#

๐Ÿ˜ฆ

thick grove
#

You need to add more logging to figure out what your code is doing

#

Outside of that else block

daring zenith
#

So I actually have logs and database audits

#

Is there an alternative way to check the status of an order so I can try?

thick grove
#

What do you mean? Above is how you check an invoice's status. Your code isn't executing the if block, so you need to either comb your existing logs to understand what's happening or improve your logging so you get a better idea