Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,718 members, 7,809,727 topics. Date: Friday, 26 April 2024 at 02:01 PM

Facing Problem Integrating Paystack With Nodejs - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Facing Problem Integrating Paystack With Nodejs (2349 Views)

Flutter Cross Platform With Nodejs Developer Needed / Who Is Good With Nodejs Here? / Simple Websocket Example With Nodejs (2) (3) (4)

(1) (Reply) (Go Down)

Facing Problem Integrating Paystack With Nodejs by peterincredible: 10:58am On Feb 18, 2020
hi all i am working on a project and i want to integrate paystack in it using their paystack-api nodejs npm package but seriously am just confuse about it cause i want everything to be handled on the backend pls if you have done something like that pls point me to the right direction i really need help thanks
Re: Facing Problem Integrating Paystack With Nodejs by devdev: 1:38pm On Feb 18, 2020
peterincredible:
hi all i am working on a project and i want to integrate paystack in it using their paystack-api nodejs npm package but seriously am just confuse about it cause i want everything to be handled on the backend pls if you have done something like that pls point me to the right direction i really need help thanks
Paystack api documentation is very clear with most examples in nodejs. If writing bunch of functions is your issue, then go for paystack-node package. It's quite simple to use
Re: Facing Problem Integrating Paystack With Nodejs by peterincredible: 2:55pm On Feb 18, 2020
devdev:

Paystack api documentation is very clear with most examples in nodejs. If writing bunch of functions is your issue, then go for paystack-node package. It's quite simple to use
bros i just want to charge just once someone tries to buy my product i want to do everything from the backend but no concrete example there am just playing with it currently till when i figure it out if you have a simeple example pls share to save time i mean every thing from the backend oo so i will get the bank no and password and everything from the frontend then use the backend for the rest pls help if you have done something like that
Re: Facing Problem Integrating Paystack With Nodejs by devdev: 5:29pm On Feb 18, 2020
peterincredible:
bros i just want to charge just once someone tries to buy my product i want to do everything from the backend but no concrete example there am just playing with it currently till when i figure it out if you have a simeple example pls share to save time i mean every thing from the backend oo so i will get the bank no and password and everything from the frontend then use the backend for the rest pls help if you have done something like that
What are you using for frontend?
Re: Facing Problem Integrating Paystack With Nodejs by makavele: 9:07pm On Feb 18, 2020
Sorry sir but you cannot do everything from the backend. That's not how it works, at least until you are PCI-compliant
You need the frontend or public key to create a transaction.
The backend or private key will be used to verify if the transaction is genuine or falsified, before giving out value to your customer.

Important Note
We strongly discourage passing card information directly to the API as it means your integration is directly handling card information. Even if you do not store any cardholder data, we only help simplify PCI compliance for you if you have integrated with Inline , Standard, Inline Embed or our mobile SDKs.

If you are PCI-DSS certified and would like to be able to send cardholder information directly to our APIs from your servers, reach out to us! and we'll provide our API endpoints and guide on how to go about this

1 Like

Re: Facing Problem Integrating Paystack With Nodejs by peterincredible: 10:18am On Feb 19, 2020
makavele:
Sorry sir but you cannot do everything from the backend. That's not how it works, at least until you are PCI-compliant
You need the frontend or public key to create a transaction.
The backend or private key will be used to verify if the transaction is genuine or falsified, before giving out value to your customer.

this is exactly want i want to do i hope it is safe sha bcause i have not tried it (nepa wahala) here is from example i just got from
paystack-js. npm module and here is the example just what i wanted

import { Transaction , Card } from 'paystack-js' ;
const requestData = {
email : 'customer@email.com' ,
amount : 100 , // amount in kobo
key : 'replace_with_your_public_key' ,
};
// Request a new transaction
const transaction = await Transaction .request (requestData);
// Create a payment method instance that will be used e.g card
const card = new Card({
number : '4084084084084081' ,
Security : '408' ,
month : '12' ,
year : '20' ,
});
// Payment method instances provide validation functions that
// you can use to check for validaty before setting payment method
if (card. isValid ()) {
try {
transaction .setPaymentMethod('card' , card);
} catch (e) {
console. log (e);
}
}
// Charge the payment method
const chargeResponse = await transaction .chargeCard ();
// Handle the charge response
if (chargeResponse . status === 'success' ) {
alert('Payment completed!' );
}
## Transaction
```Pending```
## Payment Methods
```Pending```
## Charge responses
```Pending```
## Analytics
```Pending```

here is the link to the npm module https://www.npmjs.com/package/paystack-js i hope am on the right path
Re: Facing Problem Integrating Paystack With Nodejs by devdev: 10:31am On Feb 19, 2020
peterincredible:

this is exactly want i want to do i hope it is safe sha bcause i have not tried it (nepa wahala) here is from example i just got from
paystack-js. npm module and here is the example just what i wanted

import { Transaction , Card } from 'paystack-js' ;
const requestData = {
email : 'customer@email.com' ,
amount : 100 , // amount in kobo
key : 'replace_with_your_public_key' ,
};
// Request a new transaction
const transaction = await Transaction .request (requestData);
// Create a payment method instance that will be used e.g card
const card = new Card({
number : '4084084084084081' ,
Security : '408' ,
month : '12' ,
year : '20' ,
});
// Payment method instances provide validation functions that
// you can use to check for validaty before setting payment method
if (card. isValid ()) {
try {
transaction .setPaymentMethod('card' , card);
} catch (e) {
console. log (e);
}
}
// Charge the payment method
const chargeResponse = await transaction .chargeCard ();
// Handle the charge response
if (chargeResponse . status === 'success' ) {
alert('Payment completed!' );
}
## Transaction
```Pending```
## Payment Methods
```Pending```
## Charge responses
```Pending```
## Analytics
```Pending```

here is the link to the npm module https://www.npmjs.com/package/paystack-js i hope am on the right path

This looks good. Give it a try
Re: Facing Problem Integrating Paystack With Nodejs by peterincredible: 12:47pm On Feb 19, 2020
devdev:


This looks good. Give it a try
yea i which nigeria dey get light 24/7 hmmm i will try iy out once light comes thank u all for ure response
Re: Facing Problem Integrating Paystack With Nodejs by devdev: 1:12pm On Feb 20, 2020
peterincredible:
yea i which nigeria dey get light 24/7 hmmm i will try iy out once light comes thank u all for ure response
you don't need 24/7 electricity to try this out
Re: Facing Problem Integrating Paystack With Nodejs by peterincredible: 2:32pm On Feb 20, 2020
devdev:

you don't need 24/7 electricity to try this out
yea yesterday was something else nepa no gree bring light till evening then i tried it, it didnt work the paystack-js module is a browser module cant work on backend cause it needs the windows object i even tried to install node-window to imitate the window object it didnt work i just beta save my self the stress by doing everything in the frontend and left it for paystack to handle the rest tym to do other things abeg anyway thanks for your help i really appreciate
Re: Facing Problem Integrating Paystack With Nodejs by devdev: 5:21pm On Feb 20, 2020
peterincredible:
yea yesterday was something else nepa no gree bring light till evening then i tried it, it didnt work the paystack-js module is a browser module cant work on backend cause it needs the windows object i even tried to install node-window to imitate the window object it didnt work i just beta save my self the stress by doing everything in the frontend and left it for paystack to handle the rest tym to do other things abeg anyway thanks for your help i really appreciate
You're welcome, you can actually pass the parameters to paystack from frontend then process the transaction response on the backend
Re: Facing Problem Integrating Paystack With Nodejs by udwise123: 6:21pm On Feb 20, 2020
And u have succeed in dropping ur card details for us grin
Re: Facing Problem Integrating Paystack With Nodejs by peterincredible: 9:29pm On Feb 20, 2020
udwise123:
And u have succeed in dropping ur card details for us grin
nope that is a test card detail from paystack itself sorry bros i no dunse reach dat level

(1) (Reply)

Rate My Portfolio Website On A Scale Of 1-10 / Anyone Currently Focusing On Data Structures And Algorithms? / Microsoft Access Database - Please Help Me

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 28
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.