Check if existing stripe customer's cards are still valid - stripe-payments

I have an application which uses Stripe. Stripe stores credit card information for every customer. Some of these cards are already expired and not valid anymore.
How can I go through all customers and validate their credit cards (if they are still valid or not)?

In many cases, Stripe will automatically update the cards: https://stripe.com/blog/smarter-saved-cards.
Otherwise, there is no way of checking that a saved card is still valid short of trying to charge it. But you should not try to create charges just to test if a card is still valid -- the credit card networks rules and Stripe's own ToS forbid from creating charges that are not for the actual selling of a good or service.

From Stripe documentation
In many cases, Stripe will automatically update the cards: https://stripe.com/blog/smarter-saved-cards.
Otherwise, there is no way of checking that a saved card is still valid short of trying to charge it. But you should not try to create charges just to test if a card is still valid -- the credit card networks rules and Stripe's own ToS forbid from creating charges that are not for the actual selling of a good or service.
Although you can always test the card without charging using the "save card" function
More here - https://support.stripe.com/questions/check-if-a-card-is-valid-without-a-charge

Related

Stripe: Card accepted in Platform account but declined in Connected account at the same time

We use Stripe Connect API to:
create customer + card in Platform account
clone the customer + card into Connected account
charge the card in Connected account
All steps are executed immidiately one after another.
Step 1. suceeds (the card is valid in Platform account), but step 2. fails with "card is declined".
The card is valid in platform Stripe account but declined in connected Stripe account, at the same time.
Stripe support didn't provided any useful info, they referred us to declined card help page:
the only way to resolve this is to ask your customer to reach out to their card-issuing bank to look at the transaction and determine why it was declined.
Unfortunately, We cannot ask the customer to help us.
Did anyone else encountered similar problem?
Declines are common and to be expected. They can be for a number of reasons (e.g. region of the connected account, card brand, supported merchant codes on the card, past card usage history and many more reasons) which are ultimately up to the card issuing bank.
To clarify, when you say
Step 1. suceeds (the card is valid in Platform account),
Just because a card succeeds being attached to a Customer does not mean that that card should be expected to work successfully going forward. Goes back to that this is up to the issuing bank and the best thing to do is prompt your end customer to use a different card.

Stripe on-session payments require always authentication

I am working with the Stripe API and I cannot find enough documentation regarding the on_session scenario.
I am saving the card after the first payment and setting the 'setup_future_usage' to 'on_session' because the customer is going to be always present in the checkout flow. However, this triggers authentication every time I try to pay something with the credit card number (4000002500003155). This type of credit card is intended to show only once the authentication process and to use the saved card for the subsequent off-session payment.
It's still totally possible that the issuing bank will require that you authenticate the future on-session payments. I don't think there's a test card to test the specific case you're trying to test though: https://stripe.com/docs/testing#regulatory-cards

Is it possible to query Stripe for a credit card belonging to any customer?

I have a subscription service for which free trials are allowed before signing up for the full payed service. I want to ask the customer to provide credit card details before gaining access to the free trial, to prevent abuse of the trial.
I'm using Stripe to handle payments so that I don't have to deal with storage of any sensitive payment information. This free trial scenario would seem to be very common, so I assumed there would be some way to query a card to make sure that it hasn't been used to sign up already. Just some API call that would accept the card number etc. and return a boolean.
I haven't seen anything like in the API docs. I know that fingerprints of cards are accessible after creating a card source, so is it advisable to store them myself and query them? Or have I missed something in the docs?
Just to be clear... I'm not looking to search a card for a particular customer. I know I can iterate over the cards to do that, but I'd have to iterate over the cards of every customer to accomplish what I want, which is not feasible.
Here you probaly want to contact the support team and suggest this as a new feature.
A possibility is the fingerprint you mention, in my opinion this would be the way i would do it too.
One single card should never be associated with one customer in a platform.
No, there is no way to check whether a credit card is used for another customer or not. And there shouldn't be. Because a customer has right to use his/her single credit card to maintain more than accounts.
You can easily integrate trial feature of a Subscription in Stripe which is best way to implement Trial feature using Stripe. If any customer's payment failed after trial expired then you will be notified by Stripe.
And Stripe and any other payment gateway is not advise to store any card info due to security issue.

Is it possible to "delay" payments with push-based synchronous/asynchronous method of payments?

I'm looking for a way to charge my customer after a request was successfully accepted.
To explain it further. I'm developing a marketplace where a private seller can sell his products to private customers. But the customer can only "request" the product and only when the seller accepts his conditions a deal is made.
Now comes the question that I have. Is it possible that the user is paying for the request but is only charged when the request is accepted?
If a request fails the charge has never been done or gets a full refund (but without the loss of transactions fees).
I've seen some couple of websites that use credit cards for that case.
If you look at credit cards as a payment method they are usually a pull-based, reusable and synchronous method of payment. This means that, after capturing the customer’s card details, you can debit arbitrary amounts from the customer’s card without them having to take any additional action and there is immediate confirmation about the success or failure of a payment.
So that is why you can charge someone after a specific period of time.
But in Germany, we don't use credit cards that often. Only pushed-based transactions like Sepa/Sofort/iDeal. Would it be possible to "delay" payments with these methods?
This should be possible. I'm not sure what payment processor you are using/want to use or what is available in Germany but I assume this would be possible with many of them. Probably some useful things to search for that might be similar to what you want would be saving payment methods for later, managing subscriptions, and tokenizing credit cards.
Stripe for example allows you to save credit cards for later under a customer record and then charge a customer later. https://stripe.com/docs/saving-cards
Braintree has recurring billing https://developers.braintreepayments.com/guides/recurring-billing/overview and a vault for storing payment methods https://articles.braintreepayments.com/control-panel/vault/overview.

Can Stripe support Offline Payments?

I am using Stripe for online payments but also users can pay offline (cash or check). I want to centralize all my invoices/charges in one place (Stripe).
I am not sure if I can add offline payments (cash or check) to stripe or not. I guess I can if I created customers, invoices, charges with livemode=false for my live keys.
Is this feasible and will Stripe accept having some (customers, invoices and charges) with livemode=false and others with livemode=true?
If yes, should I fill fake credit card info or should I set it as nil?
Stripe does not allow you to create a Subscription on a Customer if you don't have a credit card setup. More accurately, it does not allow you to create a subscription if a customer does not have a way to pay for the next invoice. So for offline payments, you could update the 'account_balance' on the customer to have a negative value equal to the amount the customer wired (credits). Stripe will then allow you to create a subscription for the customer because it knows that the customer has enough account balance to pay for the next invoice. This post has more details.
We don't currently support offline payments, so you'll want to look at a separate accounting system for those payments.
That said, it's totally understandable that you'd want to keep this data in one place. You might be interested in using our webhooks system to offer live updates to your accounting system without directly touching the code that creates the charge in Stripe.

Resources