#lamikam
1 messages · Page 1 of 1 (latest)
PaymentIntentCreateParams createParams = new PaymentIntentCreateParams.Builder()
.setCustomer(stripeEntities[0])
.addPaymentMethodType(type)
.setCurrency("usd")
.setAmount( Math.round(Double.parseDouble(amount) * 100)) // amounts always in cents
.setPaymentMethod(stripeEntities[1])
.setConfirm(true) // indicates to authorized right now
.setOffSession(true) // indicates to authorize right now
.putMetadata("reference", reference) // this metdata will contain the account number
.putMetadata("direct", "true") // need this later in webhook processing to ignore the charge from webhook
.build();
PaymentIntent paymentIntent = PaymentIntent.create(createParams);
PaymentIntent details = PaymentIntent.retrieve(paymentIntent.getId());
this is returning null - Charge charge = details.getLatestChargeObject();
this is for a us_bank_account payment method
Hello! Can you give me the ID of the Payment Intent so I can take a look?
sure once second...
need a minute
<com.stripe.model.PaymentIntent@761095866 id=pi_3Nv2QvDyHdg3Nb8m1fYakagC> JSON: {
"amount": 1098,
"amount_capturable": 0,
"amount_details": {
"tip": {
"amount": null
}
},
"amount_received": 0,
"application": null,
"application_fee_amount": null,
"automatic_payment_methods": null,
"canceled_at": null,
"cancellation_reason": null,
"capture_method": "automatic",
"client_secret": "pi_3Nv2QvDyHdg3Nb8m1fYakagC_secret_G6g4p7MYycHffqOhSb35M5jmO",
"
I'm wondering if the Charge hasn't quite been created yet. You're creating the Payment Intent and then immediately trying to read it and get the Charge back. If you introduce a slight delay between creation and reading it back does the Charge show up?
I will try that. This was working fine for months
That Payment Intent does have a latest_charge now, and there are no requests that modified it after it was created...
Hm, in the creation request response latest_charge is populated: https://dashboard.stripe.com/test/logs/req_rIDSaa8cYF7irC
That's strange.
mayve a java library issue?
I mean, the fact that it's populated isn't strange, what's strange is that you're running into this issue.
Perhaps. Did you upgrade recently?
upgraded to lib version 22 and it said to use getLatestChargeObject();
Where did it say that?
2022-11-15
Charge no longer auto-expands refunds by default. You can expand the list but for performance reasons we recommended against doing so unless needed.
The charges property on PaymentIntent has been removed. You can use the latest_charge property instead.
Yep, I mean you're not wrong, I'm just wondering if there's some guide or something that has a subtle incorrect thing. This is the PR for this specific change for reference: https://github.com/stripe/stripe-java/pull/1473
And getLatestChargeObject is correct...
Our of curiosity, why are you creating the Payment Intent and then immediately fetching it rather than using the result of the creation request?
my ignorance probably
isn't that what this does? PaymentIntent details = PaymentIntent.retrieve(paymentIntent.getId());
After this line: PaymentIntent paymentIntent = PaymentIntent.create(createParams); can you try Charge charge = paymentIntent.getLatestChargeObject(); and see if that works?
And then comment out PaymentIntent details = PaymentIntent.retrieve(paymentIntent.getId());.
22.0.0
Can you try 22.30.0 and see if it has the same behavior?
ok. that will take me a while. is there a way we can re-connect?