#f3ax_paymentintent-capture

1 messages ยท Page 1 of 1 (latest)

runic craterBOT
#

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

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

sinful ingot
#

@solar pier can you share an exact example so I can help you debug?

#

f3ax_paymentintent-capture

solar pier
#

Hey thank you for your reply, what exactly do you need me to provide

sinful ingot
#

An exact PaymentIntent id pi_123456 so I can look at what's wrong

solar pier
#

sure, so here is a payment intent id we tried capturing yesterday and there was a partial refund.

pi_3Pn1JWK8dZuyTTEK1CNaRHIW

#

Here is my usage of the API in zapier:

sinful ingot
#

That PaymentIntent was created with amount: 59054 and then you captured it by passing amount_to_capture: 59017
So you explicitly told us to capture less than what you authorized.

solar pier
#

So the problem is with my calculation for the amount?

#

Okay if I omit passing the amount_to_capture

#

does that solve it?

sinful ingot
#

yes if you omit the parameter it will capture the full amount
But I would recommend debugging why your calculation is off. It's pretty important to grasp why you ask for $X and then capture $Y

solar pier
#

I am using a form to calculate the amount and then I pass it into GoHighLevel. So I will trace it and see where the problem is. For now I will remove amount_to capture

#

Thanks a lot for the help.

sinful ingot
#

sure thing!

solar pier
#

One more thing please

sinful ingot
#

sure what's up?

solar pier
#

When we authorized the same payment intent, was it authorised for 59054 or 59017

#

Because it should have been authorized for 59017

sinful ingot
#

the amount was 59054

#

that's what you passed on creation at least

solar pier
#

Here is the thing:

#

This is how I create the payment intent

#

I am using the same Due Now Variable from GHL

sinful ingot
#

Sorry those are really just pictures.

#

All I can tell you is what you are sending in the API and it doesn't look like the amount you think you are passing

solar pier
#

Understood, but it cannot be because I am using the same variable for creating the payment intent and capturing it.

sinful ingot
#

We focus more on helping developers writing their own end to end code here. It looks like you're using some third-party no-code UI and I'm not sure how it works and what it does. But you are not passing the amount you think you are

solar pier
#

Figured this would be a developer thing even if it's no code UI.
Thanks again for the help.

runic craterBOT
sinful ingot
#

yeah it totally could be a developer thing, it's just not possible for me to tell you what part of the UI is wrong

#

I can only say what you are sending in the API. You as the developer can try to debug this on your own account, pass a certain amount and confirm it's what you end up setting on the PaymentIntent

solar pier
#

Yeah, I will be doing that. I will run a few tests on myself and see what happens. My confusion was regarding the part that I am using a variable so I don't know how can the variable change from creating the payment intent to capturing it.

sinful ingot
#

yeah that part I can't speak to, maybe your variable is changing between creation and capture and you're misunderstanding how that no-code UI works? Just a guess though

solar pier
#

Yeah I will trace it and see.
Last question:
If I was not able to trace the change, is there a way I can tell how much a payment intent is for?
I will use Python code and calculate the difference to adjust the amount before capture.

balmy echo
#

Hi ๐Ÿ‘‹

I'm stepping in as my colleague needs to go

solar pier
#

Do I use Retrieve a PaymentIntent?

#

Hey thank you, I do appreciate the support.

balmy echo
solar pier
#

Alright, and I would get the amount in the response body? is it in JSON so I can convert it to a dictionary and search for the key?

balmy echo
#

No need

#

The Stripe library will return an object so you can just do the following

pi = stripe.PaymentIntent.retrieve('pi_XXXXXXX')
print(pi.amount)
solar pier
#

Yeah, we treat payment intent as an object, great!
Thanks a lot, guys, that will be it for now.