I am having some issues currently wrapping my head around the process of adding a customer to a plan.

A very broad idea of the payment type is to think Twitch Streaming. You can follow users for free but pay a small fee to "subscribe" to them.

Currently, when the user fills out the payment form, i create a source in the frontend through react-stripe-elements and then pass the source.id to my backend.

This is where things start to fall apart for me.

  1. Should I create a different product per user so I can very easily view from the stripe dashboard which user/product is doing the best?

A way to go about this is when a user creates an account, my backend automatically creates a product for that specific user as well as a plan and then store the plan_id into the user model.

So when a user subscribes to another user, I can pull out the plan_id and create the subscription that way.

  1. Currently, I create a source whenever a user submits the payment form.
let attach_source = async ( customer_id, source_id ) => {

    await stripe.customers.createSource( customer_id, {
        source: source_id
    } )

}

Do I check if an error happened and see if the error is duplicate source? Or does Stripe take care of everything.

  1. I am also curious how Stripe handles multiple subscriptions on the same customer from different credit cards. I don't see anywhere that states that a subscription takes from a specific source.

Thank you for taking your time to read this. Appreciate the help!

1 Answers

1
wsw On Best Solutions

it looks like you are describing a billing user case from Stripe (https://stripe.com/docs/billing/subscriptions/creating)

  1. You can probably get away without creating one plans per one customer. what you could do is to create a Plan with usage (https://stripe.com/docs/billing/subscriptions/quantities) so a min plan of 5 dollars subscription, when they want to contribute more, update the quantity of the plan
  2. Currently stripe source has a fingerprint fields, where it will be unique for the same credit card number (https://stripe.com/docs/api/cards/object#card_object-fingerprint), you could compare fingerprint to determine if the card has been added. Stripe does not perform any duplication checking now

  3. There is a default_source (https://stripe.com/docs/api/subscriptions/create#create_subscription-default_source) parameters where you can set different card for different subscriptions;