Stripe implement instruction

Hi all, here is the Stripe instruction :

  • After creating Stripe account, you will have Secret Key in Test Mode for testing purpose with a demo card and Live mode for real charging with real cards. The secret key will be use in Headers of HTTP Requests we’re gonna make.

We will have 2 steps ( just 2 simple HTTP POST Requests ) :

  1. Create a Payment Method ( to inform Stripe that I’m going to charge this card now, please check if this card info is correct ) :
  • URL : https://api.stripe.com/v1/payment_methods

  • HTTP Method : POST

  • Headers : Authorization, value : Bearer Secret Key

  • Request Body : { type: “card”, “card[number]”: … , “card[exp_month]”: … , “card[exp_year]”: …}

( just need 3 those info : card number, exp month & year. CVV code is not required. )

  • Request Body Type : REMEMBER to choose “x-www-form-urlencoded”, NOT “json” type.
  1. Make the charge ( tell Stripe that Ok let’s charge the card I’ve just informed you with this amount : … ) :
  • URL : https://api.stripe.com/v1/payment_intents

  • HTTP Method : POST

  • Headers : Authorization, value : Bearer Secret Key

  • Request Body : {“payment_method”: outputs[“Create Payment Method”].resBody.id, “amount”: … , “currency”: … , “confirm”: true }

( This HTTP Request will be right after the first one and take the Payment Method ID we’ve just made in Step 1. You should read more about “currency” code and appropriate “amount” in Stripe Documents, because there are a few currencies those require special attention. You can also add a lots of optional keys into that Request Body, for example “receipt_email” to send email to customer when the charge be made .v.v. )

  • Request Body Type : REMEMBER to choose “x-www-form-urlencoded”, NOT “json” type.-

That’s all. For catching Errors ( card info is not correct / not enough balance / .v.v. ) you need to bind to OUTPUTS PORT 2 of those 2 HTTP POST request we made, not PORT 3. Good luck !

12 Likes

Good afternoon everyone, has anyone made a video on how to get this done or taken a few screenshots going through the process. If so please post it, I’m a complete beginner and I don’t completely understand.

2 Likes

Does this option, have any feedback to the app? meaning, how can we be sure that the payment is successfully completed?

Every HTTP request has response outputs, when a request is success, response will come out from Port 1, you can create an Alert/Toast or take that response object which contains the info of payment just made from it.

actually, im not talking about the http success but rather if the payment was successful

but from this i understand that there is a response from stripe for whether or not the payment was successful (meaning that the whole system is automated, you dont need to go and check if the user has made the payment)

and one last question, (to see if this way fits my needs), when you make the call, can you define the amount to be payed or you can only use predefined products in stripe?
Thanks for the help!

I might use this at some stage too. I already have stripe on my website but it would be nice to hook it into the app as well.

I don’t understand… Amount is defined in the request body as my instruction

I see then, because i thought that it wasnt possible and that you had to use predefined products in stripes, Thanks for the clarification!

Hi community,

Could I use this Stripe implement instruction, in order to get an in-app purchase solution?

@YakovTran I don’t understand how you input “Request Body” and “Request Body Type” informations in your POST?

I would have thought that if your app includes a way to make purchases directly to you then the app store and play store will insist that you enable in-app purchases via them as well, which I suspect will be more challenging.

The exception is if the purchase is for a physical product or service, in which case Apple and Google insist that you do something like this stripe implementation.

Yes @Phil_Evans, my plan is to include a payment through Stripe in my web app, when you will use it for the first time, on the first page + sell my native app at the same price on the app stores. In both cases, you will pay one time for getting the app forever (no subscription).

@Phil_Evans @Dimos_Vamvourellis @Donnico_Miller Have you succeed in implementing Stripe, because I don’t understand how @YakovTran input the Request Body…

My understanding of the app store Ts and Cs is that the in-app purchase can´t be done in this manner, it must be processed by the app store. If they allowed you to take payment directly then they miss out on their percentage. They don´t like that. Not 100% on this though.

I don´t have stripe integrated into my app as yet. Maybe in about 6 months based on current plans.

Can anyone confirm this? Is it possible to have payment system done this manner, approved by apple and paly store?

Actually it would help to know that someone has published an app with this integration.

OK it works :slight_smile:
You have to use HTTP request flow function in the flow function market.
You have to input this as a formula in the Request body field of the first function you have to name Create Payment Method
{ “type”: “card”, “card[number]”: pageVars.cardNumber , “card[exp_month]”: pageVars.expMonth, “card[exp_year]”: pageVars.expYear }
Change the variables’ names for yours.
You have to input this as a formula in the Request body field of the second function you can name Create Payment Intent
{ “payment_method”: outputs[“Create Payment Method”].resBody.id, “amount”: pageVars.amount*100, “currency”: pageVars.currency, “confirm”: true }
Change the variables’ names for yours.

I understand you are selling physical goods? In which case apple and google don´t want to get involved. Using stripe is fine.

image

2 Likes

Thanks, that was VERY helpful !

One i hope last question, is there any way that you get a response on payment success?, so you know to unlock the feature in the app?

I already answered u : Payment success status response will come from output port 1 of HTTP request, just mount any to it. The output of HTTP request is not just mean the HTTP request was made successfully, it also give us the response from server of which we just madr request. The response status code 200 and response payload body from Stripe contains payment info object just made will go out from that output port 1, so just connect some flow to it.

1 Like