#mekhami

1 messages ยท Page 1 of 1 (latest)

slate harnessBOT
mental crypt
#

It covers all invoices. For one-off payments, are you using invoices or Payment Intents?

valid wharf
#

payment intent

mental crypt
#

If you just use a payment intent, then invoice.paid wouldn't be generated

valid wharf
#

okay great. that works just fine for me.

#

curious.. using stripe cli, i triggered the invoice.paid event and that also ended up firing the payment_intent.succeeded event

#

so i ended up firing that event that i'm trying not to fire

mental crypt
#

Yeah so invoices use payment intents under the hood. Invoices will generate payment_intent.succeeded events but payment intents won't generate invoice.paid events. One thing you could do to differentiate the one-time payment_intent.succeeded events from the subscription ones is to see if the invoice field is populated (it will be for subscription payments but not one-time): https://stripe.com/docs/api/payment_intents/object#payment_intent_object-invoice

valid wharf
#

okay great. i'll try these options, thank you!

valid wharf
#

Is it then possible to get the Subscription object for a given Invoice?

mental crypt
valid wharf
#

ahh my eyes glossed over it cause it's null in the documentation haha. sorry for the bother.

mental crypt
#

No worries

valid wharf
#

I'm trying to test this with the stripe cli webhook system, and I'm getting the following error:

~ ๎‚ฐ stripe trigger invoice.paid --override invoice:subscription=sub_1LnNEqFwUgn76hu7CYT4rJOT
Setting up fixture for: customer
Running fixture for: customer
Setting up fixture for: payment_method
Running fixture for: payment_method
Setting up fixture for: invoiceitem
Running fixture for: invoiceitem
Setting up fixture for: invoice
Running fixture for: invoice
Trigger failed: Request failed, status=400, body={
  "error": {
    "message": "You may only specify one of these parameters: pending_invoice_items_behavior, subscription.",
    "param": "pending_invoice_items_behavior",
    "type": "invalid_request_error"
  }
}
#

I'm trying to override the subscription id to be one that I have locally in my system, but I'm sure I'm getting the wrong path or something?

mental crypt
#

Ok let me take a look

mental crypt
#

So yeah looks like the fixture sets pending_invoice_items_behavior behind the scenes

#

And you can only specify one of pending_invoice_items_behavior or subscription

#

Let me try one thing

valid wharf
#

it's sorta hard to resend an event when i'm testing subscription renewal :/ hmm.

#

i have to trigger the subscription renewal somehow.

mental crypt
#

That's the recommended way to test subscription renewal out currently

valid wharf
#

right but that's via the dashboard, and isn't automatable as far as i can tell?

mental crypt
#

Nah you can do it through the API. Just select the API tab on that page

valid wharf
#

oooh okay. thank you ๐Ÿ™‚

#

and apparently test clocks are only available to paying customers? :/ i'm a consultancy, my clients have paying accounts, i just have a test account for development purposes. so that's a bit brutal

strong onyx
#

Test clocks don't require payment I don't believe

#

Where are you seeing that?

valid wharf
strong onyx
#

Sure but that .5% is only on live charges

#

You can use test clocks in testmode without any charge

valid wharf
#

that's... a bit ridiculous. why in the world would you paywall a testing feature.

#

it'd be one thing if the CLI worked to renew a subscription but it doesn't.

strong onyx
#

Are you using an older account?

valid wharf
#

i don't really know how old the account is.

strong onyx
#

There are also many ways to test renewal events without using test clocks. Like you can update a Sub to test a renewal.

#

I think you are seeing that banner because you are on an older account with grandfathered pricing. If you created a new account for instance I believe that test clocks would be included but that the default pricing is 0.5%

#

I don't know a ton about pricing though

valid wharf
#

Like you can update a Sub to test a renewal.
Can you clarify that?

strong onyx
#

For instance, if you reset the billing cycle anchor on a Subscription then a "renewal" would occur. You can turn off proration to just have a new invoice be generated

#

It wouldn't be exactly like a natural renewal as there will be a couple pieces of different data in your customer.subscription.updated event

#

But if you are just looking to generate the events

#

Then it would work fine

valid wharf
#

okay i'll give that a shot.