Create a Stripe refund

Hi,

I need to have a refund function with Stripe in my app, but The standard Stripe from Bubble does not have the action as I can see and I want to be able to use the Bubble Connector for this but fail miserably in my attempt.

I have read the docs and I do not understand what to put in the fields after authenticating:

If anyone could show me the first steps to adding such a function I would really appreciate it!

What I am looking for is:
Create a refund based on Charge ID, amount, currency.

K

Hi @kris,

Set your Authentication method to Private Key in Header.

Key Name = Authorization
Key Value = Bearer [Your Live SK key]

Dev Value = Bearer [Your Test SK key]


Gaby at Coaching No Code Apps

Courses, Private Coaching, and Custom App Development

Start Building Today :hammer_and_wrench:

Thanks again, @romanmg

I have now corrected the authentication. Now how do I execute a refund off a previously successfull charge?

I want to be able to create a refund with an amount field so I can subract a cancellation fee in a workflow.

All the best,
Kris

I have tried so many combinations of this,

https://stripe.com/docs/api/refunds/create

I always get errors like:

:frowning:

That particular error is coming up because you don’t have the right header added to your API Call. In the call, add a header with the following:

Key = content-type
Value = application/x-www-form-urlencoded

Example (with a different endpoint… just look at the header):

So, to create a refund for an existing charge, you’ll need to save the Charge ID whenever the charge is created. That way you can insert that ID into the parameter in the Create Refund call. Make sure to uncheck “private” on the charge ID parameter within the Create Refund call - this will allow you to insert a dynamic ID (in other words, an ID you’ve previously saved in your database) in the workflow action settings.

If this is your first time diving into APIs, I have a whole video series that walks you through a bunch of API features including the API Connector. I’m also happy to walk you through this in a coaching session. Hopefully this gets you moving forward!

@romanmg I see you have no available sessions until late June, let me know if you get a cancellation! I would love to book a session with you to get me to understanding the API/Bubble connector thing, but I need to get this refund thing going as soon as possible.

I still dont know what to do after authentication, but thanks for getting me that far :slight_smile:
If I may ask, what are the steps after authentication? Do I add a new parameter under that first authentication? (tried that) Do I add a New API call, is GET or POST? (tried that too) I really need to learn this, to be self sufficient. There are so many options that makes this hard to just -test until it works - kind of thing. I usually learn very fast by examples so any would be appreciated.

Kris

Try adding the parameter to the query string

2 Likes

This information is really helpful. However, i have a couple of questions.

  1. In the first image do we add the word Bearer in the field and then the key? Is there a space required between bearer and sk? which is also shown in the image by @romanmg you

  2. In the image by @badger you have two value inputs - where did you get these from to include?

These have not been set up in my app as yet.

@levon @ZeroqodeSupport

Hello, @Fiano
Thanks for tagging us here.

Please note that the configuration of the Stripe payment system should be finished by yourself (keys or APIs). That’s why it is not set in your application :pray:

As it was mentioned in the first message of the thread, The standard Stripe from Bubble does not have the action for refund.
Please check the screenshots, provided earlier in this thread (the space between the Bearer and sk is required):

Also, please allow to recommend you to check the documentation for the Bubble Stripe plugin:
https://docs.zeroqode.com/other/connecting-stripe-payment-using-stripe-plugin

Also, please find this official documentation for the Refunding and Canceling payments in Stripe:

Please check this first and let us know about the result.
Best regards,
Zeroqode Support team

Hello
Thanks a lot. May I ask:

  1. after we capture the charge ID at the moment of the payment (I assume) and save it in the DB, how do we then insert it in the call dynamically?
  2. How do we actually refund an X amount minus an Y which is a percentage of the X and, hence, also dynamic?

Many thanks to Zeroqode and to all reading and helping.

Hello @danpagano82,
Thanks for reaching out!

You can create a custom state with the Charge ID value in it and use it dynamically wherever you want. :slightly_smiling_face:

Yes, it’s also dynamic. You need to express the % value in proportion format. E.g.: 10% = price/100*10

If you have any other questions, please let us know.

Best regards,
Zeroqode Support Team

Hey THANKS TO YOU! Excuse me for the late response, but I’m not yet into the building…
Of the top of my head I still need to answer, unfortunately:

  1. How exactly do I capture the charge id? Using the dedicated command in the workflow?
    Thanks a lot, and hope to dive soon into this.

  2. Which element custom state do I set with the chargeID?

Hi @danpagano82,
Thanks for your questions. :pray:

You can store Charge ID when you use the “seller charges the customer” action. Please use the “set state of an element” action as the next step in your charging workflow with the following content/value:

You can just set it on your page: Screenshot by Lightshot

Hope this helps. :slightly_smiling_face:

Best regards,
Zeroqode Support Team

Hello
Thanks again.
So I am finally threading forward, thanks to you guys… but am still in deep waters.

As for now:

  1. I set in the DB , on the booking, a field for capturing the PRICE (which will then be refunded with the formula “X/100*88” [to refund all but a 12% fee];

  2. In the flows of the charging, set the state of the page to include the chargeid, as you suggested.
    ---- But where to save this charge id? Shall I create a field for that as well??

  3. I completed the API call parameters, but there’s obviously something wrong, like the dynamic charge id field itself. Please see the attached screenshots.

best regards and thanks


Hello @danpagano82,
Please accept our apologies for the late reply. :pray:

Could you please let us know which exact product you are using? As all information provided by us relates to our Stripe Marketplace Express Plugin (Stripe Marketplace Express Plugin for Bubble | Zeroqode). However, we suppose there was a misunderstanding.

In case you are using our Stripe Marketplace Express Plugin:

You can save the ‘Seller charge a customer’ Charge ID into your database and then use that ID when you need it in your application, to capture, to refund, etc.

As for the refund, you can use Create a refund action. It is used to refund a payment either to a seller by passing the “Stripe-account” parameter or to a platform if leaving that parameter empty. Also, you may want to pass the “amount” of a value of the total payment amount minus stripe’s fee which you will have to calculate.

If not, please provide more details about the product you are using and additional details. This will decrease misunderstanding possibility.

Thank you!

Best regards,
Zeroqode Support Team

Please don’t apologize, you are over-over-overdelivering, and it’s me who’s a bit lost and stolid. By all means, thank you and your team.

I am NOT using your plugin, but am finding that I am still able to save the chargeid, and implemented such thing, not saving it in a custom state, as previously suggested, but for sure in the database.
You may see how I charge+ collect a fee+ capture chargeID on database in the following 2 pics.


Now to what I believe the REAL PROBLEM is:

(Remember I am acting as a marketplace/third party and collect a fee)
In some cases I will allow the “buyers” to cancel their deal and hence want to be able to refund the paid price MINUS MY COLLECTED FEE to the “seller” .

Also based on this thread, I had understood I needed to create an API CALL with the API CONNECTOR to achieve the result I just described. Must I do so?
If yes, then the questions are in my previous post: what to insert in the call, apart from the keys which I already wrote?

Thank you

Hi @danpagano82,

While we appreciate your message, we regret to inform you that we are unable to assist with matters that are not related to our product or service. As much as we would like to help, our team’s expertise is limited to the products and services we offer.

However, we would be more than happy to help you with any queries or concerns related to our product. Please do not hesitate to reach out to us if you have any questions or issues.

Still, please uncheck the “private” option on the charge ID parameter within the Create Refund call in order to insert an ID that you have previously saved in your database in the workflow:

Summary


Thank you for understanding. :pray:

Best regards,
Zeroqode Support Team

Hello
I understand.
Will I still have to do the API call to reach the desired effect, even with your plugin, or the plugin makes it faster, easier and more intuitive?
Best regards

Hello @danpagano82,

Yes, we can say that it is easier and faster. For example, our plugin has a Create a refund action that is used to refund a payment either to a seller by passing the “Stripe-account” parameter or to a platform if leaving that parameter empty. Also, you can pass the “amount” of a value of the total payment amount minus stripe’s fee which you will have to calculate. Screenshot by Lightshot

Please check the plugin Live Demo page, Demo Editor page, and documentation to make sure it suits your expectations.:

If you have any other questions, let us know.

Best regards,
Zeroqode Support Team

Thank you.
I just extensively spoke with stripe and I understood that without a CONNECT CUSTOM account, the only way to reach a result similar to the one I desire is to_

  1. Check that the payer has fundsin the cc.
    2.NOT charge immediately
  2. When the time is right either: a. charge the full amount to the payer, b. charge the fee-penalty to the payer, who keeps the rest (as if he were refunded of the total minus a penalty).
    Does this sound familiar?
    Can the plugin help doing this?
    Best regards