Forum Academy Marketplace Showcase Pricing Features

[SOLVED] Charge a user using saved CC with Stripe?

I’m creating a crowd funding app and I’m trying to get the credit cards charged.

The flow of my app consists of:

  1. Multiple users pledge an amount that they will pay and I collect their CC information, but don’t charge.
    1.1. A separate record is created in a pledge data type capturing how much each user pledged to pay.
  2. Once the item that they are committing to pay for is completed, then the users need to be charged.

I think I should use the “Charge a user using saved CC”, but I’m not sure how to setup the fields in the below screenshot and how to charge all users that have a record(s) in the pledge data type.

One option could be to authorize the charge, not just save the CC info.

If you authorize the charge, you can collect the amount using either the Stripe dashboard or an API call. You also won’t have to worry about cards being declined after you’ve collected them. Granted, you’ll need to collect them within 7 days after authorization, or they’ll drop off.

Not sure how this fits into the scope of your app, but just an option.

Thanks natedogg, but it could be 30+ days before the users are charged.

@emmanuel, is this something that the Bubble API could handle? Maybe loop through the Pledge table and charge each user until it finds no more records to charge?

You could schedule a workflow and have a condition on the workflow thing to see if it could actually get ran at the end of the crowdfunding period. Then, it would charge each user. There is a little bit of work but I think it’s doable.

So you think it’s possible to have it loop through the table and charge each user one-by-one? Just having a hard time figuring out how to loop and setup the “Charge a user using saved CC” with the correct parameters.

I think I may need to hire someone for this – it’s getting a little too complex for my abilities. :slight_smile:

We have an action to schedule an API workflow on a list of things. That would be useful here

Yeah, that’s what I’m trying to use, but I don’t quite understand how to set it up, or all of the properties. Like what should the Key be?

Do I need to use the “API Connector” plugin in addition to setting up the “Schedule an API workflow”?

Not sure I see what the API connector has to do with this. You’d be using a stripe action. And the key would be the stripe key. It’s simpler than you think.

Hi Keith,
you asked for a private session to help with this, but since it’s not too complicated I will simply mention the solution here:

  1. enable APIs for your app
  2. Navigate to API workflows (from the page navigation menu)
  3. create a new endpoint
  4. add amount and user parameters to it as shown on the screenshot
  5. create an action for that API workflow as shown on this screenshot (basically user and amount fields will be populated with API workflows’ parameters)
  6. now in your main workflow when you schedule the charge you should create an action that’s called "schedule an API workflow on a list of things (see the next screenshot)
  7. you will need to define the list of users that have to be charged. Also you need to pass the amount parameter (Which can be static or dynamic). The only thing that I’m not sure of what to pass as a user parameter here. I thought maybe we should remove it but then the charge CC action cannot refer to a user. Maybe @emmanuel could help here?
    Hope this is helpful, if not feel free to let me know.
    Thanks,
    Levon.

    Founder at Bubblewits - Bubble Certified Partner
    http://bubblewits.com
    http://iambubble.com - one page Bubble demo
    http://builtonbubble.com - Collection of apps built on Bubble
    Dev.zeroqode.com - Reach out if you need help creating something on Bubble
3 Likes

Thanks Levon! I am storing all of the Amounts in another table, different from the user table – let’s call it the “pledges” table. One user could have multiple pledges for one product. So could the “List to run on” search for the sum of all pledges submitted by the user being charged?

I think it would be useful to walk through all of this on a Skype call. What do you think?

Hi Keith, seems like I figured what should be in the user parameter - it should be “this user” and yes, I guess we could sum up all the amounts for each user. I’ll send you a DM now to schedule a skype call.

Thanks,
Levon.

Founder at Bubblewits - Bubble Certified Partner


http://iambubble.com - one page Bubble demo
http://builtonbubble.com - Collection of apps built on Bubble

So I’m trying to do the same thing but when the workflow runs I get this in Stripe.

What do I need to do to fix this? I can mark as safe in Stripe but what triggered this?