#Sarvesh
1 messages · Page 1 of 1 (latest)
Hi there, how can I help?
In paymentIntent succeed webhook event for direct charges can we get more details about the user Card details for last 4 digits and which card type he used etc just to show on invoice?
or I need to register another webhook for charges.updated / succeed to receive that information?
can I add those events to paymentintent webhook itself?
?
Sure, from the payment_intent.suceeded event, you can first retrieve the PaymentIntent's the PaymentMethod object, and from there you can get the last4 (https://stripe.com/docs/api/payment_methods/object#payment_method_object-card-last4) and brand (https://stripe.com/docs/api/payment_methods/object#payment_method_object-card-brand) of this card payment method.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok so when I receive a paymentinterent webook response, then take the paymentintent id and do another GET call to GET
/v1/payment_methods/:id to receive payment method object?
No you should take the payment_method from the PaymentIntent object (https://stripe.com/docs/api/payment_intents/object#payment_intent_object-payment_method) to retrieve the PaymentMethod object
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
payment_menthod->card->brand
payment_menthod->card->last4 directly possible to get to need to do another GET request using payment_method ID?
You need to do a GET request /v1/payment_methods/:id with the payment_method ID that you get form the payment_intent object to retrieve the payment_method object.
got it , thank you, I will try now
payment_intent ID : "pi_3MQ86FCYUydkTzYD0q9J3gCa",
payment_method ID: pm_1MQ87ECYUydkTzYDotYUEsRk
getting error with this code
$stripe = new StripeClient(config('services.stripe.stripeSecret'));
try{
$paymentMethodData = $stripe->paymentMethods->retrieve($paymentMethodId, []);
} catch(Exception $e) {
PM ERROR No such PaymentMethod: 'pm_1MQ87ECYUydkTzYDotYUEsRk'
while doing processing of paymentintent webhook response I am trying to retrive the payment_method details but it is not returning the payment_method object
Hi! Can you share the request ID (req_xxx)? Here's how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
req_9StXJhVdZyWlb8
You should specify a stripe_account in the request.
By specifying a stripe_account, you are telling Stripe that you want to make an API call on behalf of a connected account. You can refer to this doc to learn more about making API request for connected account (https://stripe.com/docs/connect/authentication)
This PaymentMethod was created in the connected account, so you need to specify stripe_account to make an API call on behalf of a connected account, like how you did when creating the PaymentIntent.
$paymentMethodData = $stripe->paymentMethods->retrieve($paymentMethodId, [], ['stripe_account' => 'acct_1MQ7WQCYUydkTzYD']);
with this request now it works and returned the payment_method object
if we store the payment_method object in our database then is it harmful/insecure anyway? We are not storing any user card details to our database but in this response last4 digits and card brand is mentioned
I don't think the last4 digit and card brand are sensitive information if this is your concern.
ok