Challenges with Stripe integration in Meteor - javascript

I haven't been able to find any real solid tutorials / examples of integrating payment into a Meteor app, just what's available using Nodes.JS with Express
Stripe guide I'm trying (and failing) to follow / integrate into my app
This is a possible solution, but I could use help dissecting it for Stripe integration following the guide listed above
Are there any simple guides that do not include mrgalaxy:stripe as their solution
That package hasn't been updated since 2016 and I'd really prefer more up to date dependencies
I'm specifically stuck on await / async / promises and could use some help with the checkout portion
If I need to paste code I will, but mainly I'm looking for something more recent that can help me integrate a simple checkout process
Thanks!

It seems that Meteor has good compatibility with npm packages, so there shouldn't be anything necessary here. It looks like you've also asked over in the Meteor forums so you may get a better & more specific answer there.

I have integrated Stripe into my Meteor app. As previously stated you can use the stripe npm on the server side.
meteor npm install stripe
I tend to have a file somewhere in my project that I initialize my stripe from. eg. /imports/stripe.js:
import { Meteor } from 'meteor/meteor'
import Stripe from 'stripe'
const stripe = new Stripe(Meteor.settings.Stripe.secretKey, {
maxNetworkRetries: 2,
})
export default stripe
Then whenever I need to use the stripe api from my project I can just do:
import stripe from '/imports/stripe'
And to take advantage of checkout.js or other front end integration for the client side if you wish. They tend to be as easy as dropping <script> tag into your project index.html
https://stripe.com/docs/payments/checkout/accept-a-payment#redirect-checkout

Related

Node.js MVC App with sqlite not fully operational

Trying to delve into Node.js terminology and functionality. Been consulting the following MVC example https://www.sitepoint.com/node-js-mvc-application/ that also has its GitHub repository https://github.com/sitepoint-editors/notes-board. However, when I build the app with all npm installed packages, except sqlite3 (I installed version 5), app is irresponsive in case there is a need to write to sqlite db, however it is able to read and delete any queries, but when there is a need to publish, it simply does not show any reactions. I am banging my head for a while now, so is there any advice or instruction out there what to do....

Adding server side rendering to an existing React site created with create-react-app

I've been building a site for a client using CRA(create-react-app) and react-router v4.2.0 and was unaware of the implications regarding google's SEO. When I index the page from Google Search Console, I get this:
I found several similar issues which suggested adding 'babel-polyfill' to my entry point, but this only causes my root component to render in the console, not taking into account my react-router routes. I'm aware that CRA is not designed for SSR. I was hoping to find a workaround within CRA, or migrate gracefully to another library such as Next.js without having to rebuild the entire site. Let me know if any additional information is needed. Thanks for any suggestions.
You can try on https://github.com/antonybudianto/cra-universal/
It's a CLI companion for universal create-react-app, without eject + zero config by default.
$ cd my-cra-app
$ npm start // start CRA client
$ npx cra-universal start // start CRA server
For existing code, you need to customize, it depends on your app's stack.
You can visit the repo's wiki for React router/redux integration on server.

Add NodeJS backend code to an Angular-seed based project

I recently abandoned the awesome LAMP solution for Node/AngularJS and I have some serious (and noob) difficulties to begin.
I took an existing AngularJS project based on Angular Seed and I didn't figure out how can I add some backend javascript code.
In online tutorials, I always find an app.js file, in which there is some "requires" and where I can add an extra server code. To launch this kind of project I have to node app.js
In my Angular-seed based project, there is only a package.json that contains script commands.
Also, I noticed that to launch it, I have to npm start.
Where can I put my NodeJS code in this project ?
Thanks in advance !
Usually you will have two differents projects. The backend (Nodejs) and the frontend (Angular). You can expose your backend logic using a public API that your frontend will use. For example you can expose a REST API using nodejs with help of express. I recommend you to take a look at swagger that can help you to define your api.
After that using your angular app you can send different requests to that API and consume the info that receive from it.
To sum up you will have two different projects. Hope this helps

How do I install Stripe for Meteor 1.3?

I'm creating a meteor web app that will sell one of our customer's products. I've decided to try and use Stripe to handle the payments (in particular Stripe Connect), and to charge an 'application fee' for each sale.
My questions:
Do I still need to use mrgalaxy:stripe or kadira:stripe-connect in order to use the Node API for Stripe? I am getting incredibly confused with the documentation of these packages, which I now believe are outdated.
If not, exactly how should I install and import Stripe for my app?
What do I need to do differently on client and on server to import Stripe?
What I have tried:
In my app directory:
meteor npm install --save stripe.
In my client side javascript code:
import stripe from "stripe"
var stripe = require("stripe"("sk_******************")
Meteor.startup(function() {
stripe.setPublishableKey("sk_******************");
});
I believe the first are meant to do the same thing, but neither works!
Chrome debugger gives me :
Uncaught TypeError: require("http").createServer is not a function
which is running in node_modules/stripe/lib/stripe.js
I am epically confused right now and would give my right index finger for clear instruction on what exactly to write in my javascript file, so I can go from where I am now to creating my first charge object.
Thanks in advance!
The Stripe npm package needs to be run on the server side, not client side. Stripe.js if for client side. You create a token with Stripe.js and then send that token to your server and use the NPM package to create a charge.

How to connect node.js to mysql and wamp/xampp server?

I'm a PHP programmer and currently working with WP, CI, OC.
I am absolute beginner of node.js, want to know how to connect MySql and WAMP/XAMPP in step by step method.
If I am going to live it, then what will be the live server setup.
Please let me know in step by step method.
Follow this tutorial.
Tutorial Here
To use node.js you need to install the packet manager NPM and use it to install the dependencies of your project.
In the example tutorial I posted above hes uses NPM to install all his dependencies to connect to mysql just as you requested. He also provides sample code.
Good luck!
Here is another few tutorials you might follow,
Click Here
This uses mongoDB instead of mysql but following this tut will help you get things running quicker then you can find something to help with mySQL.
Click Here
After installing npm with the tutorial right above here and you check and make sure you have npm installed then follow this youtube tutorial to get mysql set up with node.
And here is a youtube video.
Click Here
It might help to use this package Node Mysql Package. Also you can find the resources in the answer to this question here.

Categories

Resources