#feni-patel_api

1 messages ยท Page 1 of 1 (latest)

finite agateBOT
#

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

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

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.

noble remnant
#

Hello @thorn saddle

#

I am using separate charge and transfer method. I have used create payment intent id and transfer method. first i used pyment intent id creation method and used that intent id into transfer as source but into transfer i am getting error like, No such charge: 'pi_3QMnkxFhYfQgOdcB1nsla5Wi' . can you help me with this isuue ?

thorn saddle
#

request ID from the error req_xxx please

#

actually no

#

I already answered this question last week

#

@noble remnant do you have any followup questions?

noble remnant
#

what does paymentIntent.latest_charge mean?

thorn saddle
#

what do you think it means?

#

I'm unsure how I can explain this.

#

You have a PaymentIntent. it has a field called latest_charge. The value of that field is what you need to pass to the source_transaction parameter of the Transfer API.

#

is that clearer @noble remnant ?

noble remnant
#

yup

thorn saddle
#

@noble remnant did you try it and did things work? is it all working well now?

noble remnant
#

no not working

thorn saddle
#

can I help you then @noble remnant ?

noble remnant
#

yes, i need your help. i am getting latest_charge: null, from const paymentIntent = await stripe.paymentIntents.retrieve(req.body.paymentIntentId);

thorn saddle
#

what's the PaymentIntent ID in question?

noble remnant
#

pi_3QMpJHFhYfQgOdcB0WHn8T0r

thorn saddle
#

well that PaymentIntent hasn't been completed and paid yet, right?

#

so it makes no sense to be trying to do a transfer yet ๐Ÿ™‚

noble remnant
#

so how can i confimr this ?

thorn saddle
#

not sure what you're asking, can you elaborate?

noble remnant
#

how can i confirm from my end that this payment intent is confimr ?

thorn saddle
#

well in multiple ways:

  • look at the status field on the PaymentIntent object
  • check the code you wrote to actually collect payment details from a customer
    • and if you didn't write it, well that's the problem
  • check the Stripe Dashboard
noble remnant
#

Okay, let me check these points

#

so do i need to use cutomer meta data compulsory ?

thorn saddle
#

no, passing metadata is never compulsory in the API.

noble remnant
#

now i can see payment successed but still getting error in transfer like No such charge: 'pi_3QMpwiFhYfQgOdcB12BuTVFE'

thorn saddle
#

and we know how to fix that right @noble remnant ?

#

it was the first answer in the thread, about using latest_charge .

finite agateBOT
noble remnant
thorn saddle
#

You have a PaymentIntent. it has a field called latest_charge. The value of that field is what you need to pass to the source_transaction parameter of the Transfer API

noble remnant
#

that's what i told you when i try to log the intent then i am getting below resposne,
resposne {
id: 'pi_3QMpwiFhYfQgOdcB12BuTVFE',
object: 'payment_intent',
amount: 18500,
amount_capturable: 0,
amount_details: { tip: {} },
amount_received: 0,
application: null,
application_fee_amount: null,
automatic_payment_methods: null,
canceled_at: null,
cancellation_reason: null,
capture_method: 'automatic_async',
client_secret: 'pi_3QMpwiFhYfQgOdcB12BuTVFE_secret_d2zS2qmaYYNPe4ANggZ1VHmYW',
confirmation_method: 'automatic',
created: 1732017016,
currency: 'usd',
customer: null,
description: 'Payment for booking ID: 673c7b844bcd7c0d8c7d8528',
invoice: null,
last_payment_error: null,
latest_charge: null,
livemode: false,
metadata: {},
next_action: null,
on_behalf_of: null,
payment_method: 'pm_1QMpwhFhYfQgOdcBCtW2EVEl',
payment_method_configuration_details: null,
payment_method_options: {
card: {
installments: null,
mandate_options: null,
network: null,
request_three_d_secure: 'automatic'
}
},
payment_method_types: [ 'card' ],
processing: null,
receipt_email: null,
review: null,
setup_future_usage: null,
shipping: null,
source: null,
statement_descriptor: null,
statement_descriptor_suffix: null,
status: 'requires_confirmation',
transfer_data: null,
transfer_group: '673c7b844bcd7c0d8c7d8528'
}

thorn saddle
#

that's an old snapshot of the object

#

if you call stripe.paymentIntents.retrieve now, you'll see that it is status:succeeded, and that it has a latest_charge.

#

you need to make sure that you run this code that tries to create a Transfer, only after the PaymentIntent has fully completed(this is what webhooks can be useful for).

noble remnant
#

okay so do i need to use that webhook for the paymentIntent confirmation ?

#

bcz we are using one flutter package for the loading the card details. so does using this payment intent will be completed or do i compulsory need to use webhook ?

rose stirrup
#

hi! I'm taking over this thread.

#

the recommended approach:

  • have a webhook endpoint listening to the payment_intent.suceeded event
  • when you receive that event, you create the Transfert with the source_transaction as mentioned above
noble remnant
#

currently i am using transfer group and source_transaction bothy so i am getting error You cannot use transfer_group if the source_transaction already has one set. so which i need to use for transfer the amount?

rose stirrup
#

we recommend using source_transaction