#penguin420_
1 messages · Page 1 of 1 (latest)
hey!
Hey there, you can get the last 4 digits of a card payment method within the payment method 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.
wait
Well, what are you trying to do?
Not in that webhook, no. It would also be available on the latest_charge if expanded, but this is not exapnd in webhook event data.
how then i dont get it
But if you retrieve the payment intent's latest_charge from teh Charges API you'd have the same info there:
https://stripe.com/docs/api/charges/object?lang=curl#charge_object-payment_method_details-card-last4
where do i get the charge id
if is a subscribtion, will it change every month or stay the same
The charge will be a different one each month -- you might want to refer to the payment method configured for the subscription payments in that case
Either subscription.default_payment_method or customer.invoice_settings.default_payment_method depending on the details of your integration
wait is there a webhook that posts when it is updated
how do i retrive a subscribtion
When what is updated?
the payment method
Take a step back, what are you trying to achieve?
right
What are you looking at / starting from, and what are you trying to get?
so on the user's dashboard, i want to show there default payment method ( on my site )
In the billing block
Ok, and where are you saving that currently?
I am not
On the subscription or the customer settings?
You must be, in order for the subscription to auto charge on renewal
I am not saving there card last 4 digits etc
The payment method i mean
that line save_default_payment_method: 'on_subscription'
means you're saving the payment method on the subscription (as default_payment_method)
So you'd retrieve the subscription, look at the default_payment_method and either retrieve that or expand it in your subscription retrievakl
you can retrieve the subscription and optionally expand that
https://stripe.com/docs/api/expanding_objects
Or retrieve the payment method separately
how??
i want a new endpoint
to retrive it
thanks
I see you're typing in the main channel again -- if you have more questions you can ask them here
thank you!
also i didnt mean to lol
accidently pasted there
NP!
What do you mean?
Based on teh code you shared, it would be found on the subscription object
@sharp sonnet "id": "sub_1NdHY9L6k3oFrmnnaI81PhZm",
does this ever change
*if they dont cancel subscribtion
No, the subscription ID does not change
great!!!
and
how do i get the subscribtion id
The PaymentIntent has an invoice property which has a subscription property that is the ID of the subscription that the intent is from
It may be easier for you to listen for the invoice.paid event, that event will have the subscription ID already on it and also signals the success of a subscription payment
I'd recommend running this code yourself to see how it works
You can use expansion to get the invoice and subscription in the retrieve response https://stripe.com/docs/expand
that is session id?
I didn't mention a session ID, that doc section shows how you can expand the properties of an object that you are getting back in your response. In this case, you can expand the payment intent's invoice so that you can see the subscription it was a part of.
I'd suggest slowing down and being more careful about what you are doing with these tests and reading more of the docs to understand how these API calls work. Like maybe here just try retrieving a payment intent and expanding the invoice, then look at the data you get back and then move from there.
sorry, @magic violet is tehre a way to get a subscribtion by customerid