Understanding Stripe API (App demo link below)

Authorization you api key goes here

wether you see this

curl https://api.stripe.com/v1/charges \
  -u sk_test_CFTRjaUvmZ1ZwcD0AQuwb4bS00JhEqWYgq: \
  -d amount=2000 \
  -d currency=eur \
  -d source=tok_mastercard \
  -d description="Charge for [email protected]"

the request url is like this

h ttps://api.stripe.com/v1/charges?amount=2000&currency=eur&source=tok_mastercard&description=“charge for [email protected]

how to get “source=tok_(mastercard-visa)” which is the details of the card

create a token card like this

this is what you see

curl https://api.stripe.com/v1/tokens \
  -u sk_test_CFTRjaUvmZ1ZwcD0AQuwb4bS00JhEqWYgq: \
  -d "card[number]=4242424242424242" \
  -d "card[exp_month]=12" \
  -d "card[exp_year]=2020" \
  -d "card[cvc]=123"
this is the request url

https://api.stripe.com/v1/tokens?card[number]=4242424242424242&card[exp_month]=12&card[exp_year]=2020&card[cvc]=123

In the response of this request, you get the id wich it would be the 
source=tok_(mastercard-visa)

if you want to create a customer so you don't have to ask every time for the card details this is how you save the card details in stripe so you don't have to save the details in your server putting in a risk

curl https://api.stripe.com/v1/customers \
  -u sk_test_CFTRjaUvmZ1ZwcD0AQuwb4bS00JhEqWYgq: \
  -d description="Customer for [email protected]" \
  -d source=tok_amex

web URL request

https://api.stripe.com/v1/customers?source=tok_mastercard-visa)&description="CustomerExample)

in the response you would have to store de customers ID wich is the one you will use instead of the source=tok_(mastercard-visa)
EXAMPLE:
h ttps://api.stripe.com/v1/charges?amount=2000&currency=eur&customer=(customer ID)&description="charge for [email protected]"


## Using Stripe and Apple Pay vs. in-app purchases

Apple Pay doesn’t replace Apple’s [In-App Purchase API](https://developer.apple.com/in-app-purchase). You can use any of Stripe’s supported payment methods and Apple Pay in your iOS app to sell physical goods (e.g., groceries and clothing) or for services your business provides (e.g., club memberships and hotel reservations). These payments are processed through Stripe and you only need to pay Stripe’s [processing fee](https://stripe.com/es/pricing).

Apple’s [developer terms](https://developer.apple.com/app-store/review/guidelines/) require their In-App Purchase API be used for digital “content, functionality, or services,” such as premium content for your app or subscriptions for digital content. Payments made using the In-App Purchase API are processed by Apple and subject to their transaction fees.

It is a simple example of how to understand the API of Stripe ... I haven't uploaded my app to the app store so I don't know more than this 

If anyone has more information please shared it !

https://x.thunkable.com/projectPage/5ea05d98cbe348258277cbd5
4 Likes

Would you mind sharing the link? I am creating in-app payment feature using web API and I am kind of stuck.
I think your instruction is really helpful.
Thank you!

1 Like

Thank you for sharing it!!
I will take a closer look.

Thank you for the instruction. I have a few questions about your codes (sorry, I am a beginner).

I followed most of your instructions and found out the code “200=status.” Could you tell me what this “200” means?

Second of all, for the API key (authorization: bear…), I put the test key because I actually do not want money to get transferred when testing, but the app screen remains unresponsive even if I type in the card info and submit it. Is there any other way to check if my codes are working? Or is this error/unresponsiveness coming from code block errors?

Thank you so much for your help (As far as I know, you are the only one who gives instruction about stripe API).

“200” means that the transaction was successful!

Oh god sorry for that I miss a detail

In the image when you click in the Web API component named " Stripe API" a menu on the right will show up in there is the box where you put the headers of the authorization as I explained on the card info ! sorry for the confusion didn’t know exactly how to explained on the app

3 Likes

Yes, I did put the header (your instruction was clear enough!).
Maybe it’s my issue that the screen remains unresponsive, so I will debug it.

Thank you so much for your help !!

1 Like

Thank you, Daniel for this tutorial, it is EXTREMELY helpful! We referenced your guide in integrating Stripe API to collect payments on orders in our StartShare app. It’s unfortunate the Stripe component was removed, but your workaround got us up and running!

1 Like

Hi @Daniel_Coglitore and @technovationhc4 -

I will be embarking on a similar challenge to integrate Stripe payments into my Thunkable X app via Web APIs. Any help would be very much appreciated. I plan on going step by step as described here unless there is some other tutorial that you can point me to that can help.

Daniel - I tried clicking on the link to you sample project listed above but it says that link expired. Could you, by any chance, renew or re-do. Looks like that was very helpful to technovationhc4.

For technovationhc4 - congrats on the launch of the app - looks great! Did you have any issues with IOS submissions? Are there any wisdoms you can part with with your journey to Stripe integration?

Thank you in advance for your help and I am planning, when all said and done, to share my experience and tips so that our Thunkable X community can benefit. Together we are stronger … no matter what Apps we are making.

Thanks,
Milan

Thank you Daniel. Much appreciated! I’ll try to connect it all based on demo app and instructions.

1 Like

App demo link!
https://x.thunkable.com/projectPage/5ea05d98cbe348258277cbd5

3 Likes

Thanks Daniel! I’m typing a rough draft for a Successfully Thunk’d forum post about my app and I’ll be sure to mention your tutorial in my post, because it’s currently the only working implementation of a payment method in Thunkable at this time.

3 Likes

Nice work, man!

3 Likes

yes! I had the same issue when stripe got removed didn’t find a payment method so I have to make this one =D I’m glad is been helpful

1 Like

Thanks for sharing @Daniel_Coglitore! :+1:

If you want you can just post a link to the Project Detail Page, since these links never expire.

Once there, users will be able to make their own copies of your project, and remixes are counted the same too.

1 Like

Found your awesome Stripe integration suggestions very useful thanks!!!, dedicated today to register card, customer, and charges in my app, it all worked fine after tweaking a few things in the process, for example when you send an amount to charge, the last 2 digits are the decimal component, for example if you send the amount “100” it will assume you are sending 1.00 and the amount is too little for stripe to accept, so to send “100.00” you must send “10000”, also the URL string joining can be shortened a little as shown: http://tinyurl.com/y6bgu62y

3 Likes