#meghna_error

1 messages ยท Page 1 of 1 (latest)

final coyoteBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1255972318132572281

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

marsh drift
ocean mountain
#

I don't have the requestID. I don't see it in Developer Logs

#

FYI, I only get this error sometimes. It's sporadic. sometimes it works fine

marsh drift
#

Hm, can you share how you're making the requests then?

ocean mountain
#

PaymentIntent paymentIntent = PaymentIntent.create(paramMap); Charge omedaCharge = Charge.retrieve(paymentIntent.getLatestCharge());
Transfer transfer = Transfer.retrieve(omedaCharge.getTransfer());

        RequestOptions requestOptions = RequestOptions.builder().setStripeAccount(connectedAccountId).build();

        Charge destinationPayment = Charge.retrieve(transfer.getDestinationPayment(), requestOptions);

        ChargeUpdateParams params = ChargeUpdateParams.builder().
                putMetadata("Customer Name", customerName).
                putMetadata("Omeda Stripe CustomerId", omedaCharge.getCustomer()).build();

        Charge charge = destinationPayment.update(params, requestOptions);
#

This is java code

#

I get this error when retrieving transfer object. Can this be because transfer has not initiated when code tries to find it?

marsh drift
#

Hard to say yet. Can you share the ID of a Payment Intent or Charge that you were working with when the error occurred?

ocean mountain
#

Sure. Payment Intent ID - pi_3PWK8WFuWYLdpKW50eOFMhFD

#

This is in test mode, btw.

marsh drift
#

Thank you, taking a closer look.

#

Ah, I think I see what's going on, and agree with your suspicion that the Transfer may not have existed when you tried to retrieve it.

You're on a newer API version where the default capture_method is automatic_async. With that we perform the capture asynchronously, so we can respond to your request faster, but one of the risks with that is that certain downstream objects may not be available right away. We talk through this in more detail here:
https://docs.stripe.com/payments/payment-intents/asynchronous-capture#opt-in-async-capture

That seems like it would align with you only seeing this sometimes, as it effectively creates a race condition between our backend and when you make the next request.

I would either suggest adding error handling that checks whether the Transfer ID is populated, and waits if not, before you try to retrieve the Transfer. Or, see if switching back to automatic for your capture_method helps avoid the occurrence of that error:
https://docs.stripe.com/api/payment_intents/create#create_payment_intent-capture_method

ocean mountain
#

Okay. that makes sense

#

Thank you.