1
votes

I'm planning to use Stripe for processing credit cards.

However, I already have a program that calculates customer's monthly pay based on their subscription to our products, and because the calculation is pretty complicated I don't want to remake the whole thing using Stripe's system.

So,

  1. Is it possible to charge customers recurringly without using Stripe's PLAN api?

  2. If so, how do I get to achieve that?

1

1 Answers

3
votes

Yes, you can charge customers in Stripe without using their Subscriptions logic.

To do this you'd want to collect card information on your front-end, then save it to a Customer in Stripe; you would store the id of this customer in your database.

When it comes to charge the user, you can have your application charge the saved card on a Customer you've created within Stripe.

# Create a Customer:
customer = Stripe::Customer.create({
    source: 'tok_mastercard',
    email: '[email protected]',
})

# Charge the Customer instead of the card:
charge = Stripe::Charge.create({
    amount: 1000,
    currency: 'usd',
    customer: customer.id,
})

# YOUR CODE: Save the customer ID and other info in a database for later.

# When it's time to charge the customer again, retrieve the customer ID.
charge = Stripe::Charge.create({
    amount: 1500, # $15.00 this time
    currency: 'usd',
    customer: customer_id, # Previously stored, then retrieved
})

See https://stripe.com/docs/saving-cards for more