Search code examples
stripe-paymentsstripe-connectstripe.js

Custom schedule payments with Stripe


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)?


Solution

  • 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.