I want to handle the following use cases with Stripe:
Charge a customer on a regular schedule where the interval between charges is not a single number, e.g. charge on Tuesdays and Thursdays.
Charge the same customer at one off instances, e.g. they are regularly charged on Tuesdays and Thursdays but for this particular week, Saturday also.
Can I fulfill these use cases with Stripe without needing to generate a new token each time (i.e. take the payer's card details each time)?
You don't need a new card token each time. Card tokens are created client-side, for example via Elements. They allow you to collect card details securely client-side and then simply send the card token id (tok_1234) to your server to charge the card.
When using a token, you have two options. First, you can charge the card once using the Create Charge API. Otherwise, if you want the ability to charge the card more than once, you would save the card on a customer. This is covered in details in the documentation.
Once a card is saved on a customer, you can use the Create Charge API to charge that card. You would pass the customer id (cus_123) in the customer parameter and if you want a specific card you would also pass the card id (card_abc) in the source parameter.
You can try to charge the card as needed on days where you expect a payment. It's up to the cardholder's bank to decide if they want to let the charge go through or not.
Related
When I send an Invoice to a Customer by email, customer is able open an Invoice, but it's not possible to pay with credit card, so, this invoice seems like useless at all, because there is no option to pay it.
Some our customers can connect bank account, but by default all customers have to be able to pay with credit card.
We don't need to store customers' cards on our side, just allow to use cards.
What is easiest way to allow using credit cards for a customer? I see different options in Stripe doc:
Create PaymentMethod, then set invoice_settings.default_payment_method for a Customer
Create Sources, then set it to Customer.default_source.
But I'm not sure if it's possible to create payment method or source without card details.
There is a chance that our Stripe account is configured incorrectly, not sure what exactly I have to check.
Is it possible using stripe to hold money on a saved card, but days later the time of card insertion?
E.G:
I need to save the card at certain moment (e.g day58) before completing the transaction and receiving the money. I also need to hold the money a week before it is finally sent through to me, in order to verify that it is available and block it to grant that they stay available until transaction, or knowing failure from that week before.
Stripe does support authorization and capture (or placing a hold on a card) which lets you hold funds for up to 7 days. They cover this in this guide: https://stripe.com/docs/payments/capture-later
The idea here is that you have 3 separate steps in your flow:
You collect card details securely with a SetupIntent since you're not accepting a payment immediately. See this guide: https://stripe.com/docs/payments/save-and-reuse
7 days before the service being delivered, you create a PaymentIntent for the correct amount. You pass capture_method: 'manual' to indicate you only want to hold funds for now. You also pass the customer and payment_method parameters corresponding to the details you collected at step 1 and you confirm the PaymentIntent. If there's a decline, you get your customer on session to provide different card details.
Before the 7 days are up, you explicitly capture the PaymentIntent via the API
Is it possible with Stripe to perform a test transaction to ensure that an account is funded?
I would like to :
take the Credit Card ID at the moment of the booking (but no payment at that moment)
make the customer pay AFTER the service has been done
What you likely want is to place a hold on the card for the given amount, and then capture the funds later after the service has completed. When placing a hold the given amount is authorized and guaranteed by the cardholder's bank. You'll often see these types of transactions show up on your online bank statement when renting a car or when checking-in to a hotel room. When processing your payment with Stripe you would set the capture_method on the PaymentIntent to manual which tells Stripe to only authorize the given amount. Then, once the service is rendered you would capture the funds. The following guide covers the approach in detail:
https://stripe.com/docs/payments/capture-later
I'm using Stripe Checkout. In all the documentation I can find, Stripe recommends saving Customer information (including a default Source) during my first transaction with that customer, and using that default Source later when I want to create subsequent Charges. However, if a customer uses a different credit card during a subsequent Checkout transaction, it would be a mistake to charge the default Source.
So, it seems like I should always just use the token from stripe.js when making subsequent changes, and that I should create a new source for the customer whenever I detect the them using a card that's different from the default source.
However, in my testing it appears as though every token I get from stripe.js represents a unique card, even if I've used the same credit card number, expiration, and CVC. If I were to create a new card for each Checkout token and save it to the customer record, I'd potentially end up with mounds of duplicate card records for each customer.
Am I overlooking a way to associate stripe.js tokens with customers in a way that doesn't generate duplicates? Or am I going about this incorrectly?
Whenever you collect card details in Checkout, Stripe will create a new token for that card even if they use the same card details. The Token resource has the fingerprint property though.
That property is a unique identifier for a given card number in your account. This means that if I sign up today with my card and then I come back tomorrow with the same card under a different email address you'd see the same exact fingerprint on both Token or Card objects. The idea then would be to keep track of all the card fingerprints you see in your database to detect a returning customer. Whenever a customer adds a new card you'd first look if you've seen that card fingerprint before in your database and decide to create the customer or return an error based on this.
Separately, you should not offer Checkout for a customer that already has a saved card. Instead you should show them the card(s) available for example by showing the card brand and last 4 digits. And then the customer can either pay with one of those cards or add a new one.
You can add more than one card to a customer or replace the default one. You can also decide which card to charge by passing both the customer id in customer and the card id in source. This is all covered in details in Stripe's documentation here.
There was a bug in our system for a few days which meant we were taking payments on Stripe but weren't joining the card to the new customer. We need the card to be attached to the customer so that we can charge them again.
Knowing only the card information from the first charge (ie card_123) is it possible for me to add the card to the customer?
From what I see, I need a token to be able to do this and to generate a token I need the raw card data.
If you created the charge directly with a card token in the source parameter, then it's not possible to retrieve the card data afterwards and attach it to a customer object.
You will have to ask your customers to provide their card information again, generate a new token, and attach this token to customer objects.