#gyungi-terminal

1 messages ยท Page 1 of 1 (latest)

deft bronze
#

๐Ÿ‘‹ Happy to help

#

What is the issue you're facing?

full oar
#

Hiya! So my current flow is to create a payment intent server side, sent the client secret to the client, collect a payment method and then pass that to my server to capture the payment.

#

However, when I try and capture the payment, it gives an error telling me it's expecting a different status, namely it's expecting a payment intent with status requires_capture and what I'm handing it is something with the status requires_payment_method

#

For reference, this is the front-end code that's interacting with my backend:

#
      if (stripeClientSecret) {
        const result = await terminal?.collectPaymentMethod(stripeClientSecret)```
#

oh sorry I suppose I should have attached the whole bit of code

#
        companyId,
        amountDollars: centsToDollars(getValues("total")) ?? 0,
        customerId: customer?.id ?? "",
        saveCardToCustomer: false,
      })
      const stripeClientSecret = cardPresentPaymentData.data?.stripeClientSecret
      if (stripeClientSecret) {
        const result = await terminal?.collectPaymentMethod(stripeClientSecret)```
#

where initiateCardPresentPayment creates the paymentIntent object

deft bronze
#

Could you share the payment intent ID (pi_xxx)?

full oar
#

sure!

#

pi_3LAkQyJFfb8SRu7A0dx74uhh

#

this one was the one in question

deft bronze
#

It looks like you tried to capture the payment intent before a payment method is collected

#

Can you share the full code until capturing the payment intent?

full oar
#
    _, err := paymentintent.Capture(stripePaymentIntentID, params)```
#

so this is all I have on the server side for capturing the payment

#

and I guess I'm just not sure how I attach the payment method to the payment intent- I thought that was the whole point of the collectPaymentMethod call

deft bronze
#

When collectPaymentMethod is called, does your reader show up asking for payment?

full oar
#

Yup!

#

and then I scan the stripe test card

deft bronze
full oar
#

ahhhh nope I'm imagining that might be the missing piece

#

Totally missed that

#

let me try that thank you!

deft bronze
#

No problem! Payment intent status will only move to requires_capture after processPayment is called, then you can capture the payment

full oar
#

got it! Super helpful. Thanks!

deft bronze
#

Glad to help! Let me know if you have other question ๐Ÿ™‚

full oar
#

That worked!! You're a life saver ๐Ÿ™‚

deft bronze
#

Awesome! Great to hear that it works ๐Ÿ‘