#JohnM-charge-id
1 messages ยท Page 1 of 1 (latest)
Good morning Toby
Good morning! Please bear with me while I wrap up another train of thought.
absolutely
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?
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
webhook sucessful paymentIntent
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_
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.
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());
Sorry, I'm not sure I understand the question here.
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
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.
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