Reputation: 14066
I just using stripes. I tried all the samples.
How to get all cards of a user? I have a user with a userid in my app. Then I just create a card object and got a token.
How can I save that card to somewhere and how to get back those cards...
I read all of the samples and websites but that is not clear.
Is there a way to delete one card from my user cards from the android app later?
Or update...etc?
Any way to make a default card or select a card from my cards to pay with?
Thanks
Upvotes: 1
Views: 2435
Reputation: 10549
Stripe makes it easy to store card details and charge them later. You just need to attach the card details to a customer object. Once you’ve done that, you can charge the customer at any time.
Securely collecting payment information
Basically, for each user you have to create a customer and add cards into it that belong to the user. you can find customers under customer tab in stripe dashboard once you creating it. Stripe provides three methods for tokenizing your customer’s payment information over HTTPS. So first, you need to collect user card details using one of these method and then send the token to your backend that can be used to create a customer. instead of saving token you need to save customer id in your backend db that can be used to charge the customer. so when you charging using customer id the charge will be credited from the default card of the customer.
P.S.
Tokenization ensures that no sensitive card data ever needs to touch your server so your integration can operate in a PCI compliant way. If any card data were to pass through or be stored on your server, you would be responsible for any PCI DSS guidelines and audits that are required.
List all cards
Once you created a customer you can see list of the cards belonging to that customer.
Delete a card
You can delete cards from a customer. if you delete a card that is currently the default source, then the most recently added source will become the new default. If you delete a card that is the last remaining source on the customer then the default_source attribute will become null.
Update card / Set default card
You can retrieve a customer using Customer::retrieve({CUSTOMER_ID});
API and query the card that you want to update $card = $customer->sources->retrieve({CARD_ID});
then update it. default_source
property against the customer object with the card id value can be used to set a card to default.
Links to refer
Upvotes: 3