#JohnM-charge-id

1 messages ยท Page 1 of 1 (latest)

grim yoke
rustic agate
#

Good morning Toby

grim yoke
#

Good morning! Please bear with me while I wrap up another train of thought.

rustic agate
#

absolutely

grim yoke
#

Thank you for you patience ๐Ÿ™‚

#

So, you have a charge.succeeded event, and you're trying to get the associated PaymentIntent from the information in that event?

rustic agate
#

really I want to know is what is populated in the object ID in the charge.successful webhook for the paymentIntent api. For ach charges created using the charge api, the id in the webhook is the id of the charge. For a paymentint... it is not the case. For example for a ACH charge, the id returned starts with a py_ which is in the object id . but for paymentintents... the ID starts with a ch_, which does not match a id returned from the paymentIntent

#

for example

#

in my charge.successful processor, I am keying off of the data.boject.id to lookup in my database to know how to process my payment information and transfer the funds from the charge to my connected account. but I need to know how this id is calculated for payment intents. It is not the id from the paymentIntent...... that starts with a pi_

grim yoke
#

Since the event is a charge.XXX event, it should return the charge as the object. The charge is related to the payment intent, but is a distinct object that actually handles the action of charging your customer's card.

#

I believe the py_123 objects are Payments rather than Payment Intents, but am working on confirming this.

rustic agate
#

this is what I was doing with my payment intents

#

PaymentIntent paymentIntent = PaymentIntent.create(params);
ChargeCollection chargeCollection = paymentIntent.getCharges();
StripeChargeInfo stripeChargeInfo = new StripeChargeInfo();
List<Charge> charges = chargeCollection.getData();
stripeChargeInfo.setChargeToken(charges.get(0).getId());

#

stripeChargeInfo is my own object to store charge id and balance transaction token like so

#

stripeChargeInfo.setChargeToken(charges.get(0).getId());
stripeChargeInfo.setBalanceTransactionToken(charges.get(0).getBalanceTransaction());

grim yoke
#

Sorry, I'm not sure I understand the question here.

rustic agate
#

The charge id I am retrieving from the payment is not matching the charge id in the wehhook

#

tell you what.. let me do some more research .... but the above logic... I should be able to get the charge id from the paymentintent what the api is executed, correct ? and this should be the id in the webhook

grim yoke
#

I'm a bit confused what Payment Intent you're referring to. If you're listening to these webhook events, then I'd expect you to use the information from there to retrieve the payment intent that you're looking for. I'm not sure how you'd be able to know that the payment intent you're working with is going to match an upcoming webhook event.

Also apologies, but I've got to step away and @simple raft will be taking over for me.

rustic agate
#

yea... no problem...

#

ok... never mind... I had some sort of mixup yesterday afternoon. I think it was a configuration issue. It appears to be working as expected today

simple raft
#

That is great to hear!

#

Just catching up on this. Any other outstanding issues in this thread?

rustic agate
#

nope. You can close

#

thanks