Platfio Blog
Intermediate

Stripe

Lesson 38• Nov 6, 2024

Stripe

INTRO Hello and welcome. In this lesson, we’ll be discussing on how to use Stripe as a payment method for your app. Let’s get started.

EDITOR/EMULATOR Stripe is a critical component of how your app processes payments. To connect, the first thing you need to do is create a Stripe account if you do not have one yet. Once you have an account, you need to activate your account. That process differs in different countries. You need to put in the legal information about your business. Connect your bank account so that you can receive money and then the account will be activated.

The next step is to sarch for the API keys, and copy your publishable key and secret key into your app.

To copy the keys, go to the Platfio Editor, then integrations, and click on Stripe. Then paste the publishable key and the secret key on their respective lines and save it.

Please note that it’s better to manage your payments info via the app, for example, refunds, setting things up, checking on payments is much better to do in the app rather than in the stripe console.

If you do things in the Stripe console, it can break your app, so please be very careful.

STRIPE: The next thing we will discuss is if your app creates a new user, it is automatically created as a customer in stripe. If we go to the Manager, then users, select a user, then click on details and scroll down. You can then find that customer on stripe by grabbing the email address, your app id, or in particular, this customer id which is related to stripe to find that user.

Stripe gves you tools to see this user’s subscriptions, payments, payment methods, invoices, and importantly, logs.

TEST:

Now, let’s test the app by processing an order, booking, and subscription. First, we’ll purchase this Boxing Shirt. Let’s select "Large" and proceed to checkout. Next, we’ll book a boxing class. We’ll join the class and proceed to checkout. For the subscription, we’ll test two cards. With the first card, we’ll use one that succeeds with the payment. Let’s subscribe to the Boxing Subscription and use the card that we know will succeed. Afterward, we’ll subscribe to the Boxing Subscription Premium, but this time, we’ll use the card that fails. To check each product in the app, go to the Platfio Manager. Select the user, and first check "Orders." Here, we can see the order for a Large Boxing Shirt for $20. Next, go to "Bookings." Here, we see the Boxing Class booking processed for $180. Lastly, go to "Subscriptions." We can see both boxing subscriptions processed. Clicking on the Boxing Subscription for $50 shows the payment succeeded. Returning to the Boxing Subscription Premium for $100, we see the payment failed. We can also verify this information in Stripe. Go to "User Details," copy the Stripe ID, then search for it in Stripe. Here, we see Products and bookings displayed under "Payments," with the $20 shirt and the $180 boxing class. Above this, we see the subscriptions: one succeeded for $50, and one failed for $100. The payment details shown in Stripe are also accessible and can be managed via your app.

OUTRO Thank you for watching this tutorial on setting up Stripe for your app. If you have any questions or need further assistance, please don't hesitate to contact our team for support.

Ready to build your app?

Put what you've learned into practice with Platfio.

More Lessons