Seeking Expert Feedback: Kajabi, Stripe, and PayPal API Integration Code - Help Me Validate It!

Michael J Stewart - Sep 12 - - Dev Community

Hey DEV community!

I'm reaching out for some expert assistance. I’m not a developer myself, but after doing quite a bit of research, I’ve managed to piece together a solution to help my wife’s business with a tricky integration between Kajabi, Stripe, and PayPal. However, I’m looking for someone with solid experience with these platforms to validate what I’ve built and ensure it works as intended.

The Situation:

Here’s what I’m trying to solve:

  1. Kajabi Automatically Creates New Products in Stripe

    Whenever a customer subscribes through Kajabi, it creates new products in Stripe, which messes up our existing payment plans. Instead, we want to ensure that Kajabi maps to existing products and plans in Stripe, so no new products are automatically created.

  2. Migrating PayPal Subscribers to Stripe

    Currently, billing is handled via Stripe and the products/services are on Kajabi from a customer standpoint. But they can also purchase the subscriptions through PayPal. In that scenerio, customers manage their subscriptions there (unsubscribing, billing updates, etc.). We want to migrate all those subscriptions to Stripe and have Stripe become the sole platform for managing billing, subscription changes, and cancellations.

The Solution I Built (Hopefully):

I’ve generated most of the code and file structure for this integration, including middleware that should map Kajabi products to existing Stripe products and a service to handle migrating customers from PayPal to Stripe.

I feel like everything ties together well, but honestly, I'm not 100% sure it’s correct. I’ve put a lot of effort into learning how these APIs work and doing my own research, but there are so many unknowns for me as a non-developer.

Here’s what I’m hoping you can help with:

  1. Validate the code: Does it logically make sense? Will it work as intended? I’ve included some code snippets and explanations below.
  2. Guide on Hosting and Running Continuously: We also need help understanding how to host this solution and run it continuously so that it stays updated. We’re not sure how to implement that part and keep it running without constant intervention.

The Code Structure:

Here’s a high-level overview of the project structure, along with some of the key files I’ve written:


project/

├── controllers/
│ ├── stripeController.js # Stripe API integration logic
│ ├── kajabiController.js # Kajabi product mapping logic
│ └── paypalController.js # PayPal to Stripe migration logic

├── routes/
│ ├── stripeRoutes.js # Routes for Stripe-related functions
│ ├── kajabiRoutes.js # Routes for Kajabi-related functions
│ └── paypalRoutes.js # Routes for PayPal migration

├── middleware/
│ ├── syncMiddleware.js # Middleware for syncing Kajabi and Stripe
│ └── webhookMiddleware.js # Handles Stripe webhooks

├── services/
│ ├── stripeService.js # Stripe API service logic
│ ├── kajabiService.js # Kajabi API communication
│ └── paypalService.js # PayPal to Stripe migration logic

├── utils/
│ ├── stripeUtils.js # Helper functions for Stripe
│ ├── paypalUtils.js # Helper functions for PayPal
│ └── kajabiUtils.js # Helper functions for Kajabi
├── app.js # Main Express app configuration

Questions I Need Help With:

Is the code logically correct?
For example, does the middleware for syncing Kajabi and Stripe products look like it will work as expected? Are there common pitfalls I should look out for with these APIs?

How do I host this and run it continuously?
I need guidance on how to host this project and keep it running reliably. Should I use something like Heroku, AWS, or another platform? How do I ensure it runs continuously, syncing products and handling migrations as needed without manual intervention?

Are there any obvious improvements?
I’m open to suggestions on how I can improve the structure, performance, or reliability of the solution.

Conclusion:

I’d really appreciate any feedback or suggestions on this. I’m close to getting everything working, but I don’t want to implement this without knowing if it’s fully viable. If you have experience with Kajabi, Stripe, PayPal, or API integration in general, your insights would be invaluable.

Thanks in advance for your help!

P.S. I've published the code on GitHub for review. Also, feel free to let me know if I’ve missed anything major that could break the solution.

Here's the repo on GitHub:
https://github.com/mrmichaeljstew/StripePPKajabi

.
Terabox Video Player