Stripe integration with Application

Login into stripe account Stripe. Stripe Users with Administrator permissions can access a Stripe account’s API keys by navigating to the Developers section of the Stripe dashboard and clicking on API Keys.Copy Publishable key and secret.



Login into Application using superadmin login details and open Settings > Payment Credentials > Online Payment and paste the copied secret and publishable key into Publishable Key and  Stripe Secret.




Add Webhook:-


Copy the webhook url from the application and open Developers > webhook on stripe and clieck on "+ Add Webhook"  paste the copied webhook "Endpoint Url" and select payment_intent.succeeded, payment_intent.payment_failed, invoice.payment_succeeded and invoice.payment_failed from Event to send field and save the webhook. Now click on created webhook and copy the signing secret and paste that into application Stripe Webhook Secret field as shown in above given image.






 

Recurring Payment Setup

1. Understand Stripe's terminology (Products, Plans, Subscriptions, and Customers)

It's important for you to understand Stripe's terminology, especially since it can be a bit misleading if you're new to Stripe. For instance, it might be tempting to jump right into Stripe's Subscription object, but you should really start with Stripe's Product object. So what's the difference?

A Product is essentially the subscription service you are offering. A Product can have many Plans. A Subscription connects a Customer to a Plan.

Here's a diagram that might help you visualize these terms:

A diagram of Stripe Products, Plans, Subscriptions, and Customers

2. Create a Product

You can create a product using the Stripe API or Dashboard. Because we only need to create 1 Stripe Product, it makes more sense to use the Stripe Dashboard. (As mentioned above, we'll be covering how to create products and plans via the API in an upcoming post.)

Navigate to your Stripe Dashboard (www.dashboard.stripe.com). In the left sidebar, click on the "Billing" menu item to expand your options. Once expanded, click on "Products".

Click on the "+  Add Product" option in the subheader to create a new product.

Creating a Product is as simple as entering a name. In this case, we'll call our Product "Worksuite - Saas".

   

When you create a Product in the Dashboard, Stripe automatically assumes that you want to attach a pricing Plan to that Product.So you can add plan also while you create product. 

3. Create a Plan

Stripe gives you numerous options when allowing you to create your pricing Plan.

If you're having trouble creating this plan, navigate back to the "Products" page ("Billing > Products" from the left sidebar). Click on a product  you'll see the option to "+ Add pricing plan". Click on that option, and repeat the process outlined above to now create the Professional Plan.



Choose the pricing model, choose currency,put price and select recurring.


Because we selected the "Recurring quantity" Pricing option, we can now select the Billing Interval. We will choose "Monthly". Stripe gives you a lot of flexibility with the Billing Interval. If you wanted to charge $20.00/2 months, you could select "Custom" and specify the billing interval type (Month) and number (2).

Lastly, you can specify the Trial Period if you'd like. You typically want a Trial Period if you want users to enter card numbers up front but also want to give them the option to cancel before the trial period ends.

Once you have created the Plan you need to copy the APP ID.


4. Migrate with application

Login using superadmin login details and open packages.Here you can create a new package or you can use any existing package. If you have already created a package then edit the package and insert the copied APP ID into stripe plan id. Here you need to remember  that if you created a monthly plan then you need to put on Stripe monthly plan id field or if that is yearly then put into Stripe yearly plan id.