#tikitikitero_best-practices

1 messages ยท Page 1 of 1 (latest)

fickle oxideBOT
#

๐Ÿ‘‹ 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.

brittle frostBOT
hearty tartan
wet atlas
#

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);
    }```
hearty tartan
#

Have you tried with stripe trigger

#

What I'm suggesting is different

wet atlas
#

let me check

hearty tartan
#

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

wet atlas
#

I have the code in a remote server, will the trigger work in that case?

hearty tartan
#

all trigger does is generate the event

#

if you're listening to events on that server, then it should

wet atlas
#

No, I am not listening events in the server

#

I need an option to cancel the payment intent in real

#

simulating the expiration

hearty tartan
#

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

wet atlas
#

I mean, I have code in a test environment, I cannot do other deployments to add a webhook and listen for events

hearty tartan
#

You don't need to deploy anything

wet atlas
#

The trigger option requires that we have a webhook listening

#

right?

hearty tartan
#

You can do that locally too if you want

wet atlas
#

Maybe I am not understanding the possibilities of the trigger option

hearty tartan
wet atlas
#

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

hearty tartan
#

and i suggested something for you above

wet atlas
#

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?

hearty tartan
#

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

wet atlas
#

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"?

hearty tartan
#

that's not possible via the api

wet atlas
#

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?

hearty tartan
wet atlas
#

mmm same situation

#

it seems that is restricted ๐Ÿ˜ฆ

hearty tartan
#

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

wet atlas
#

wait

#

what about the Other option

#

I can add a note there

#

can I try that option setting the "automatic" value there?

hearty tartan
#

That's not what that does

wet atlas
#

what does is going to do?

hearty tartan
#

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

wet atlas
#

yeah, that is not working

#

"cancellation_reason": null,