I am trying to use Stripe API to get users to add payment option. This could be Credit Card or Apple Pay.
The stripe API documentation isn't really clear on how I can retrieve cards and know which is the default card. If anyone has implemented this and has a better explanation how they went about it, I would really appreciate.
Here is how I am adding card currently from fronted (iOS swift) and using NodeJS as backend.
Token is sent from tokenization of card on the client side
async addCard(req: Request, token: string) {
const cardx = await stripe.tokens.retrieve(token);
return cardx
}
Here is how I retrieve the card details.
async getCards(req: Request) {
const customer = await this.getCardCustomer(req.user);
const cardsx = await stripe.customers.retrieve(customer.id);
return cardsx
}
how do I know which card is the default card. Any help is welcomed