How to use dynamic pricing with Stripe

I’m working on Stripe integration and I’m trying to allow people to buy stuff on my marketplace. I’ve added a ‘charge a payment’ call using the Stripe.js PLUS plugin, but the price seems to be a set price in cents.

Not sure how to make this dynamic. Anyone have any ideas? If not I’ll reach out to the cobubble team and book in a session.

Cheers

1 Like

Hey @plund, you should be able to enter in your own dynamic values. Do you have any screenshots you can share? Stripe requires the amounts to be in cents, so you can have your dynamic value perform the calculation or save the calculated value first and pull from the database for the action.

If Product’s Price was in dollars, you can set the action’s Amount = Product’s Price * 100

1 Like

Hey @plund,

You should certainly convert your dollar amounts into a cent-equivalent anytime Stripe asks for an amount, excluding percentages for taxes and application fees. When formating your amount, do as @romanmg mentioned above and multiply your dollar amount by 100 to get cents. Keep in mind there may be situations where you have extra digits, such as $123.456 which would come to 12345.6¢ when multiplied; be sure to use the :formatted as module to format the amount as a Number with zero decimal places as a precaution. :slight_smile:

2 Likes

Thanks guys, I was along the right lines but wasn’t 100% sure if that was the way to go. Thanks for confirming it though!

I’m charging user’s payments on behalf of sellers (and then taking a % commission), so not sure if the plugin action ‘Charge a payment’ is the right way to go, but I have bought @copilot’s Payments Course so I will review :).

I probably first need to ‘create a customer’ (Only when current user’s Customer ID is empty, to prevent duplicate customers?). This is my setup at the moment but I will set up the correct actions once I review the course.

Just out of interest, @copilot, which section of your course best deals with charging customers on behalf of sellers (and allowing my marketplace to take a % commission)? Looks like Charges, Sellers: Bank Accounts & Charges and Sellers: Payouts may all be relevant? I’ll finish off the whole course anyway, but just wondering what to look out for specifically.

Thanks

The Platform Payments course really does go in-depth about everything you’d need to know about Stripe, but the Sellers section is the place where things are geared specifically towards Stripe’s Connected Accounts. There’s a planned progression to every course we make, so your question above (and likely others!) will hopefully be addressed somewhere in one of the many videos. If you’re ever stuck applying concepts to your own situation, you’re always welcome to book a session with us and get some one-on-one help. :slightly_smiling_face:

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.