#venkateshjsoft

1 messages · Page 1 of 1 (latest)

bold horizonBOT
proven viper
#

Hi there!

#

How can I help?

fervent loom
#

I created new payment intent and user authorize the payment and payment posted successfully.
When I collect the new payment for the same user, a new payment intent is created.

#

is there way I can get the old payment intent id for the new payment

#

because we store the first payment intent id for as a reference for the future payments

#

When we get the webhook for the new payment, it will be the new payment intent id so im not sure how to find our the oringal payment id so I can link it in my system.

#

clear?

proven viper
fervent loom
#

When I check the new payment I see the old payment intent as Setup for future usage

#

is there a way I can get it from the api

#

because getting all the payment intent for the customer then filter it with the one I have it my system can cause performance issues

bold horizonBOT
errant root
#

no, unfortuantely we don't provide a simple API field to indicate if the PaymentMethod has been set up before

fervent loom
#

when I make new payment for the same user with the original payment intent id, your api is creating new payment intent

#

and I believe the webhook also comes with the new payment intent id

#

so you mean only the customer id is the field to find the original payment intent id?

errant root
#

every new payment on a saved card is a new PaymentIntent yes

errant root
fervent loom
#

im storing the original payment id

#

payment intent id

#

but how can I get the original payment intent id from the new webhook

errant root
fervent loom
#

yes but when I make new payment, im using the old payment intent id right

errant root
#

so as mentioned you can list old PaymentIntents in the API, while handling the webhook, if you need to.

errant root
#

the old PaymentIntent ID has nothing to do with it. As I said, every new payment on a saved card is a new PaymentIntent.

fervent loom
#

wait

#

let me explain again

#
  1. I create new payment intent and store the payment intent id. I set this payment intent for future usage.
  2. User authorize the payment
  3. Payment completed and I received a webhook with the same payment intent id.
  4. I sent new payment request again after few days with the same payment intent id.
  5. Payment completed and I received a webhook with the new payment intent id.
#

in the step 5, I would like to know the original payment id which I used to post the payment in the step 4

errant root
#

sent new payment request again after few days with the same payment intent id.
that's not how it works though

#

you can't use the same PaymentIntent ID, it woudn't work at all. You create a new PaymentIntent ID when you're doing a new payment request

#

so the question doesn't make sense, so it's hard to answer

fervent loom
#

im able to make another payment with the same payment intent id

#

I can give the request if you want

#

first payment request: req_JBQ2Wc7Lyfy3UA

#

second payment request: req_CvtcankKTwfBxX

errant root
#

yeah, and those are two different PaymentIntents, as I said.

fervent loom
#

yes they are 2 different payment intent for the same user

errant root
fervent loom
#

but when I make second payment request, im passing the orignial payment intent id (first payment)

#

then how stripe is able to charge the same customer again

errant root
errant root
fervent loom
#

{
"paymentintent_id" : "pi_3NrdpnB4yD6nPBkB1KzXtHgK",
"amount" : 5600,
"type" : 1
}

#

this is the request im passing, I think stripe has some logic internally to find the payment method and transform the request

errant root
#

that's not the request being passed to our API though

#

so I assume you use some third party library/framework that I wouldn't know about

fervent loom
#

yes I got it

errant root
#

maybe that framework does some magic internally to figure out who the PaymentIntent belonged to and re-charge it , sure

fervent loom
#

yes your are correct

#

there is some logic internally gets the customer id using the payment intent and then get the last charge id and payment method from the last charge id

#

anyways its clear now. Thanks

#

one last question. is there a way to identify if the payment intent created is for the first time?

#

from the webhook

errant root
#

do you mean, is it the first PaymentIntent for that customer?

fervent loom
#

yes

#

We configure webhook and we have to process the payment intent differently

#

so we need to knwo if its for the first time or subsequent payment

errant root
#

or I suppose since it's a webhook after the PaymentIntent was created, if the list has 1 entry, then it's the first, and if it has more than 1, it's not