#tikitikitero_best-practices
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/1218186309051613264
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
You should be able to generate it via https://docs.stripe.com/cli/trigger
I think you could use override to set cancellation_reason: https://docs.stripe.com/cli/trigger#trigger-override
I wanted to do something like this but the PaymentIntentCancelParams.CancellationReason.AUTOMATIC is not valid
final var options = RequestOptions
.builder()
.setStripeAccount(accountId)
.build();
final var paymentIntent = PaymentIntent.retrieve(paymentIntentId, (Map) null, options);
final var cancelParams = PaymentIntentCancelParams.builder()
.setCancellationReason(PaymentIntentCancelParams.CancellationReason.AUTOMATIC)
.build();
return paymentIntent.cancel(cancelParams, options);
}```
let me check
It also may not work (override doesn't work with every param), but recommend trying
It's a way to generate test events via the cli
I have the code in a remote server, will the trigger work in that case?
all trigger does is generate the event
if you're listening to events on that server, then it should
No, I am not listening events in the server
I need an option to cancel the payment intent in real
simulating the expiration
You'll need to wait 7 days
Because test mode behaves like live mode
You can generate test events like i said
but if you need it to be real, then there's no other way than to wait
why would you need it to be real though
I mean, I have code in a test environment, I cannot do other deployments to add a webhook and listen for events
You don't need to deploy anything
You can do that locally too if you want
Maybe I am not understanding the possibilities of the trigger option
Basically I have a payment intent id and an account id and I need that payment intent has the status cancelled with the "automatic" cancellation reason
as soon as possible, to not wait for 7 days, that is my requirement
and i suggested something for you above
I am so sorry, but I am not understanding how that trigger will help to change the status of the payment intent I have
Could you please explain differntly?
Ah never mind. Doesn't look like you can set cancellation_reason anyway with stripe trigger. Just tested
So basically your two options are: generate some mock test event data yourself and feed that to your endpoint or wait 7 days
mm what about a postman API call?
will postman allow me to cancel the payment intent with "automatic" cancellation reason?
or an error will be thrown in the API if I set "automatic"?
no
that's not possible via the api
will the API thrown an error in that case?
using the dashboard?
I can see a Cancel option there
What happens if I click that?
yes
Yes I've already said the only way to achieve what you want is either generate mocked test event data yourself and send it to your endpoint or wait 7 days
wait
what about the Other option
I can add a note there
can I try that option setting the "automatic" value there?
That's not what that does
what does is going to do?
Not sure we just help with the api
We don't really know anything about dashboard functionality
You can try it, but there's only a few valid values for cancelation_reason
So I'd imagine that sets something completely different
again, your two options are to generate some mock test event data yourself and feed that to your endpoint or wait 7 days