Getting Last4 Digits of Card using Customer Object - Stripe API with PHP

后端 未结 1 971
情歌与酒
情歌与酒 2021-01-04 00:54

I want to get the last 4 digits of a customers card using Stripe. I have already stored the Customer using:

      // Get the credit card details submitted          


        
相关标签:
1条回答
  • 2021-01-04 01:02

    $last4 = $StripeCustomer->sources->data[0]->last4;

    sources->data is an array so you'd have to select the first card.

    Side note: You're using the token twice, once to create the customer, and the second to create the charge, this will result in an error as the token can only be used once. You'd have to charge the customer instead of the token.

    0 讨论(0)
提交回复
热议问题