Stripe: Getting Credit Card's Last 4 Digits

stripe login
stripe test cards
stripe fees
stripe get card details
stripe stock
stripe connect
stripe reviews
stripe api

I have upgraded the to the latest version which is 20.3.0 and now I don't seem to find the .Last4 for the credit card. I had the following method:

    public void CreateLocalCustomer(Stripe.Customer stipeCustomer)
        var newCustomer = new Data.Models.Customer
            Email = stipeCustomer.Email,
            StripeCustomerId = stipeCustomer.Id,
            CardLast4 = stipeCustomer.Sources.Data[0].Card.Last4



But now the stipeCustomer.Sources.Data[0].Card.Last4 says 'IPaymentSource' does not contain a definition for 'Card'. Does anyone know how I can get the card details now? The flow is that I create the customer by passing the Stripe token to Stripe, then I get the above stripeCustomer. So I expect it to be somewhere in that object. But I can't find it. The release notes can be found here. Thank you.

In the old world of Stripe, there only used to be one type of payment method you could attach to a Customer; specifically, Card-objects. You would create a Card-object by using Stripe.js/v2 or the Create Token API Endpoint to first create a Token-object and then attach that token to a Customer-object with the Create Card API Endpoint.

Once Stripe expanded to support a number of other payment methods though, Stripe built support for a new object type that encapsulated a number of payment methods (including credit cards) called Source-objects. A Source-object is created either by using Stripe.js/v3 or the Create Source API Endpoint. It can also be attached to a Customer-object in much the same way as the Card-objects mentioned above, except they retain their object type. They're still a Source. You use the Attach Source API Endpoint to do this (that is notably identical to the Create Card API Endpoint mentioned above).

What I'm getting at here, is there are now two different object types (or more) that you can expect to see returned in the sources-array (or Sources in .NET). All of these methods though inherit from the IPaymentSource-interface. So if you know you have a Card-object getting returned, you can simply cast the returned object to the Card-class.

Something like this should get you going:

CardLast4 = ((Card) stipeCustomer.Sources.Data[0]).Last4

You can see what I mean by inheritance by looking at this line in the Card-class file:

Good luck!

Which cards and payment types can I accept with Stripe?, dashboard side menu, click on Settings and then click on Bank accounts and scheduling. Click on the Edit button next to the currently linked bank. Provide the new bank account information. Navy Federal is Proud to Serve All Who've Served & Their Families. Join Today!

As of, this is what works:

var chargeService = new ChargeService();
var charge = chargeService.Get(id);    
CardLast4 = ((Card)charge.Source).Last4;

It's getting hard not to panic when code breaks because of all the micro-changes Stripe makes.

Stripe showing up instead of business name on American Express , It's the corporate card we wanted for ourselves. Get started instantly. All you need to apply is a Stripe account—no paperwork or personal guarantee required. Credit limits that grow with you. Your credit limit is determined by your payment processing and bank history. Branded with your logo. Famous Companion Fare, $100 Statement Credit & 40,000 Bonus Mile Offers. Earn 3X Miles on Eligible Alaska Airlines Purchases & 1 Mile Per $1 on All Other Purchases

So after debugging, it looks like the Data[0] needs to be cast as Card to get the card. So it will be CardLast4 = ((Card)stipeCustomer.Sources.Data[0]).Last4.

Update existing bank account information : Stripe: Help & Support, Saving credit card details for later. Saving cards with Payment Intents? This page covers saving cards with the Charges API. To avoid an increase in declined  Get 0% Intro APR for 15 Months on Balance Transfers. Compare More Card Offers Now & Apply! 2x Miles on Every Purchase. Get 50,000 Bonus Miles & Travel Credits. Apply Now.

Save a card, You can always see the 10 most recent cards directly on a customer; this method lets you retrieve details about a specific card stored on the customer. Get your 100% Free Experian® Credit Report Today! What's on your Credit Report? See What Is On Your Credit Report. Account History, Inquiries, And More. Sign Up For Free!

Stripe Corporate Card: The corporate card for fast-growing businesses, It is a little ironic that it's taken years for credit cards to get added into the mix, considering Stripe's earliest homepages and marketing efforts  The Stripe Corporate Card is the easiest way for everyone in your company to handle expenses. Instantly provision cards, manage your company's spending in real-time, and get credit increases as your business grows. Rather than deal with complex rewards programs, you'll simply get extra cash back on the categories where you spent the most.

Saving cards, Compared to other options, Stripe credit card processing is fairly new on the Get weekly expert advice on finance, marketing, HR and other  What is Stripe? Stripe is the credit card processor we have chosen to partner with, to allow restaurants to manage customer payments inside GuestCenter. In order to vault your diners' credit card information in GuestCenter, and charge them, restaurants will need an active Stripe account. PCI Compliance & Credit Card Security