#ceylon3388_api

1 messages · Page 1 of 1 (latest)

slender timberBOT
#

👋 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/1221996860626047066

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

bleak havenBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

royal glen
#
const cloned_payment_method = await stripe.paymentMethods
      .create(
        {
          customer: customer.id,
          payment_method: paymentMethodId
        },
        {
          stripeAccount: fleet.connectedStripeAccountId
        }
      )
      .catch(err => {
        throw "Error cloning payment method" + err;
      });

    const pi = await stripe.paymentIntents
      .create(
        {
          amount: amount,
          currency: "usd", // Set the appropriate currency
          payment_method: cloned_payment_method.id,
          capture_method: "manual",
          confirm: true,
          description: "Rental authorization: Amount " + amount,
          automatic_payment_methods: {
            enabled: true,
            allow_redirects: "never" // did not work without this
          },
          expand: ["latest_charge"],
          metadata: {
            customerId: customer?.id,
            fleetRef: fleet?.id,
            bookingId: booking?.bookingId,
            connected_account_id: fleet?.connectedStripeAccountId
          },
          return_url: "https://owner.fumes.app/#/dashboard"
        },
        {
          application_fee_amount: calculateFumesFee(amount),
          stripeAccount: connectedAccountId
        }
      )
      .catch(err => {
        throw "Failed at paymentIntents:" + err;
      });

bleak havenBOT
rigid jewel
royal glen
#

req_a2dhciy3wjGqOp

rigid jewel
royal glen
#

yes but its giving me a "requires_payment_method" status

#

please refer to the code block i posted above

#

is it correct?

#

im able to capture with the "requires_payment_method" status, but i worry how this will behave in production

rigid jewel
#

This request showed the status as succeeded. Where did you see requires_payment_method status from?

royal glen
#

i listen to payment intents on connected accounts. The event where it sets status to "requires_payment_method" is when this event fires.
"payment_intent.amount_capturable_updated"

rigid jewel
#

Not requires_payment_method status

#

requires_capture status is expected for payment_intent.amount_capturable_updated event

royal glen
#

evt_3OyMno4aQWfIHion1JVzO8il

#

this happened before i captured it

#

that status reflects on my UI

rigid jewel
#

This is expected

#

When a payment intent is created, it doesn't have a payment method yet - that's why the status in requires_payment_method

royal glen
#

but i am cloning the payment method when i make the authorization

#

just want to reiterate that

#

if thats how the api behaves then i have no issue, i just don't want to do something incorrectly just because its accepted

rigid jewel
#

Ah! I see where you're coming from. The payment method was set in the Payment Intent creation request and its response returned requires_capture status, but payment_intent.created event reflected as requires_payment_method status. Let me double check why this happened

#

We are unable to find out why this happened and it shouldn't be the case. Can I suggest writing to Support https://support.stripe.com/contact/email with the issue and example Payment Intent ID now, so that I can find the email and escalate to the relevant team?

#

We will follow up the issue from there

#

Let me know once you email in

royal glen
#

one more question

#

from the logs, how can i see how this request was made. Like what parameters?
req_kDDX2vn4bX4Axo

rigid jewel
royal glen
#

it says it used charge api but i cant see it used in the stripe shell

rigid jewel
#

This is the request created from Dashboard

#

Can you share what you're trying to do?

royal glen
#

im just trying to refund the payment intent but it says charge id or payment intent id does not exist. Again this is on a connected account.

    case "refund_charge":
      try {
        if (!amount) {
          throw "No amount to refund specified";
        }
        functions.logger.info("Refund Payment intent", paymentIntentId);
        // Payment Intent here is actually Charge ID
        return await stripe.refunds.create({
          charge: paymentIntentId,
          amount
        });
      } catch (error) {
        throw error;
      }```
#

also tried

        return await stripe.refunds.create({
          payment_intent: paymentIntentId,
          amount
        });```
bleak havenBOT
sly tangle
#

Hi @royal glen I'm taking over this thread

royal glen
#

thanks

sly tangle
royal glen
#

req_WQ7AKDnhr7KQUo

#

one i just created

#

webhook "payment_intent.created" gives me "requires_payment_method"

#

This is on a connected account

sly tangle
#

This request succeeded. Can you share with me the ID of the request that failed?

royal glen
#

No requests are failing

#

im getting "requires_payment_method" status when i cloned it upon creating the payment intent

sly tangle
#

You said "I'm just trying to refund the payment intent but it says charge id or payment intent id does not exist."

royal glen
#

oh that was a side question not my main issue

#

i have resolved it by passing the connected account id

#

are you able to look at my technical implementation?

sly tangle
#

OK. So what's the PaymentIntent ID?

royal glen
#

pi_3OyRhkQGkRLVMROd1lfPrydD

sly tangle
#

Its status is require_capture, not require_payment_method.

#

Ok, it's indeed require_payment_method in the payment_intent.created event

royal glen
#

I listen for the events on my webhook handler
payment_intent.created & payment_intent.amount_capturable_updated, either one can give me the require_payment_method status

#

can i show you how i create the payment intent?

sly tangle
#

In evt_3OyRhkQGkRLVMROd1V3E1Aqx I saw the status is already require_capture

royal glen
#

yes but sometimes its require_payment_method

#

either one can set that status

#

should i ignore that?

sly tangle
#

Do you have a payment_intent.amount_capturable_updated event with require_payment_method status? can you share with me the ID?