#aiwa-payment-methods
1 messages · Page 1 of 1 (latest)
Hello
I'm not sure what you mean by "card number also not getting in the response".
Can you clarify?
You can also disable Link via your Dashboard if you don't want to support it -- that depends on which integration you are using.
I was getting last 4 digits of the card....but right now am getting as null
already disabled it
Do you have an example you can share?
"paymentIntent": {
"id": "pi_3OUkJeHd7jiDEEHb13xXASnj",
"object": "payment_intent",
"amount": 50000,
"amount_capturable": 0,
"amount_details": {
"tip": {}
},
"amount_received": 50000,
"application": null,
"application_fee_amount": null,
"automatic_payment_methods": null,
"canceled_at": null,
"cancellation_reason": null,
"capture_method": "automatic",
"client_secret": "pi_3OUkJeHd7jiDEEHb13xXASnj_secret_A3Z1VR5As2NKGujp2HZowEDU8",
"confirmation_method": "automatic",
"created": 1704349326,
"currency": "aed",
"customer": "cus_PJN3xGQObOtAE3",
"description": "Subscription creation",
"invoice": "in_1OUkJdHd7jiDEEHbTiyQ4n8l",
"last_payment_error": null,
"latest_charge": "ch_3OUkJeHd7jiDEEHb1dU8grjt",
"livemode": false,
"metadata": {},
"next_action": null,
"on_behalf_of": null,
"payment_method": "pm_1OUkJcHd7jiDEEHbCYxu8HeW",
"payment_method_configuration_details": null,
"payment_method_options": {
"card": {
"installments": null,
"mandate_options": null,
"network": null,
"request_three_d_secure": "automatic",
"setup_future_usage": "off_session"
},
"link": {
"persistent_token": null
}
},
"payment_method_types": [
"card",
"link"
]
},
Thanks, looking at that PaymentIntent
payment_method_types its coming as both card and type why ?? i have activated only card ???
Okay you are creating Subscriptions here, so the Payment Methods are dictated by your settings here: https://dashboard.stripe.com/settings/billing/invoice?tab=general
So you wold need to turn off Link in those settings
but we are not getting last 4 digts in payment intetn id API
its working after deactivating
Where are you looking exactly?
You can find the last 4 as part of the Charge's payment_method_details.card.last4
not gettting that in the payment intent api
Are you expanding the latest_charge?
See: https://stripe.com/docs/expand for info on how to expand responses.
But to see the full charge object when looking at a PaymentIntent you would have to expand the latest_charge
{
"id": "pi_3OUrnrHd7jiDEEHb0ooLr4T2",
"object": "payment_intent",
"amount": 160000,
"amount_capturable": 0,
"amount_details": {
"tip": {}
},
"amount_received": 160000,
"application": null,
"application_fee_amount": null,
"automatic_payment_methods": null,
"canceled_at": null,
"cancellation_reason": null,
"capture_method": "automatic",
"client_secret": "pi_3OUrnrHd7jiDEEHb0ooLr4T2_secret_gB8oGM5jsEvfYiDHztOP1BnU8",
"confirmation_method": "automatic",
"created": 1704378107,
"currency": "aed",
"customer": "cus_PJUnBqWhrOD6iW",
"description": "Subscription creation",
"invoice": "in_1OUrnrHd7jiDEEHb969BrZVD",
"last_payment_error": null,
"latest_charge": "ch_3OUrnrHd7jiDEEHb0ZjQRezV",
"livemode": false,
"metadata": {},
"next_action": null,
"on_behalf_of": null,
"payment_method": "pm_1OUrnqHd7jiDEEHbYVx6y5A0",
"payment_method_configuration_details": null,
"payment_method_options": {
"card": {
"installments": null,
"mandate_options": null,
"network": null,
"request_three_d_secure": "automatic",
"setup_future_usage": "off_session"
}
},
"payment_method_types": [
"card"
],
"processing": null,
"receipt_email": null,
"review": null,
"setup_future_usage": "off_session",
"shipping": null,
"source": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"status": "succeeded",
"transfer_data": null,
"transfer_group": null
}
this is what am getting
what is that expanding latest_charge measn ?
you need to retrieve the PaymentIntent using https://stripe.com/docs/api/payment_intents/retrieve and when you do so you expand latest_charge. Please read through the doc I provided above which clarifies how to use expansion
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
coudnt find any cards in the above link
yes
Are you listening for payment_intent.succeeded?
yes
Great
So when you receive that Webhook it contains the PaymentIntent object
The last 4 is not returned, as it within the Charge object
So when you receive that Webhook, in your handler you want to immediately retrieve that PaymentIntent using https://stripe.com/docs/api/payment_intents/retrieve as I referenced above. Except, in this retrieval request, you need to expand latest_charge.
When you do that, you will now receive the full PaymentIntent object and within it the full Charge object
Which will contain the last4 that you are looking for.
sorry we are taking payment intetn id from invoice.paid webhook
That works fine too
Same idea
You just need the PaymentIntent ID for https://stripe.com/docs/api/payment_intents/retrieve
Right because you aren't expanding latest_charge
Can you show me your code for how you are retrieving the PaymentIntent?
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", stripeSecretKey);
var response = await client.GetAsync("https://api.stripe.com/v1/payment_intents/" + paymentIntentId);
var returnObject = await response.Content.ReadAsAsync<object>();
Can I ask why you aren't using one of our SDKs?
we implemnted in this way...
some version conflict was there
we were using an old stripe account....and getting all the values in that account....now we changed into another stripe account for going live....but this issue got
this is old one
Yeah with older API Versions we returned charges which included this info
That was removed
Can you try adding ?expand=latest_charge to your fetch
Like var response = await client.GetAsync("https://api.stripe.com/v1/payment_intents/" + paymentIntentId + "?expand=latest_charge");
getting invalid array
Try ?expand[]=latest_charge