How do I show last 4 digits of cc with Stripe.js 2

I’m using stripe.js by copilot and I’m trying to show the last 4 digits of the customers CC. How would I call that? I can’t seem to figure it out. Thanks!

1 Like

There is a piece of returned data called ‘last4’ on the Stripe.js - List all customers PaymentMethod’s API call you can use:

Make sure you pass the customer ID to the data call to retrieve a list of all the connected cards for the customer, and it’ll only show the last 4 digits of each card.

Hope that helps!

3 Likes

@matt26

Hi Matt, if that was the solution please can you mark my answers ‘Solution’ just so the forum get’s updated?

Hi there,

I’m trying to do the same thing. I can use other retrieval methods for Stripe.js and get some information back, but when I try this one with a known and correct Customer ID, it just get empty results.

I’m trying to send the result to a custom State which I can reference elsewhere but it keeps coming back empty in all the exposed states to choose from. Not sure what I’m missing.

Is there a way to view the entire returned JSON block somewhere so I can confirm that I’m actually getting a result?

Thanks.