#heyaco_error
1 messages ¡ Page 1 of 1 (latest)
đ 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/1270128318032773232
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there
Your command should look like this:
actually, hold on
So, taking a step back
ok
When you trigger an event, we use a set of API calls to create the necessary objects to ultimately end up triggering that event. So, for invoice.payment_failed, we create a customer, add a payment method, create an invoice item, create an invoice, then pay that invoice: https://github.com/stripe/stripe-cli/blob/master/pkg/fixtures/triggers/invoice.payment_failed.json
When you create an Invoice, it's not possible to set a custom billing_reason so this isn't possible
@hearty wing let me know if this makes sense!
i see. how would i test a failed payment for a renewal period of a subscription? currently i listen for invoice.payment_failed events and if the billing_reason == subscription_cycle i remove the access for that user. my code looks right to me, but i'd like to test this edge case. say they don't have sufficient funds or the card expired or god knows what.
Sorry for the delay! I recommend using Test Clocks for this: https://docs.stripe.com/billing/testing/test-clocks/api-advanced-usage
You can create a Subscription with collection_method: 'charge_automatically' within a Test Clock where the first invoice is paid with a test card number that reuslts in a successful payment. Then, remove the payment method and advance the time to the next billing cycle to see the invoice payment fail
cool. thanks. i'll look into test clocks. didn't know about this.
Happy to help!