kehers / paystack Goto Github PK
View Code? Open in Web Editor NEWNodejs API wrapper for Paystack
Nodejs API wrapper for Paystack
Npm library has a version of 1.4.1
while the master branch on github has one of 2.0.1
Hi
I get this error when i try to charge with card Required Parameters Ommited - authorization_code
But according to paystack doc for charge, its not a required param when charging with card - https://developers.paystack.co/reference#charge
I'm i doing this wrong? Please help out.
Line 27 in e74305a
Am just curious, is this an attempt to create a singleton? I tried finding the purpose of returning an instance of probably already created object but could not justify it
Is it ok to do a pull since the build is failing?
Hi, i've been using your api and i noticed the functions are asynchronous and cannot return a value. They can only be displayed in the console log. e.g
paystack.transaction.initialize({
reference: "123445566" ,
amount: 10000,
email: "[email protected]"
} , function(error,body){
if(!error){
console.log(body)
}else{
console.log(error)
}
})
the body cannot be returned so as to extract the redirect URL.
Please, in what situation does the api return open_url
status message when charging with card?
I keep getting the response:
{ status: false, message: 'Transaction reference not found' }
whenever i try to use the transaction.verify method.
Please can you look into it.
Hi, Thanks for the amazing lib.
How do I pass a callback_url manually? For example, a company that owns two financial products (a loan and a savings app), they use two different domain names. Passing the callback url in the paystack dashboard isn't really enough. Please help
Open discussion and contributions
Version 2.0.0 Features Proposal
//API Example Usage
paystack.customer.update({
id: 900,
data: {
firstname: 'Subomi',
lastname: 'Oluwalana',
email: '[email protected]',
phone: 2348077886076
}
}).then(JSON.parse)
.then(callback);
The reference code is not being recognized on the verify method
/*
Verify transaction
*/
verify: {
method: 'get',
endpoint: [root, '/verify/{reference}'].join(''),
args: ['reference']
},
Please check this method .
The API returns StatusCodeError when making a charge request.
Fix:
The charge object in charge resource should have a POST method instead of a GET.
Hello. I am trying to pass a callback or handle some sort of function when there is a successful or failed payment. Here is my code:
paystack.transaction.initialize({ email:
${req.query.email}, amount: req.query.amount * 100, interval:
${req.query.interval}`,
currency: 'NGN',
plan: response.data.plan_code,
callback: function(response) {
var reference = response.reference;
console.log('Payment complete! Reference: ' + reference);
},
})
.then(response => {
if (response.status) {
res.send({ success:true, url: response.data.authorization_url })
}else{
res.send({ success:false, url: null })
}
}).catch(err => {
console.log(err)
res.send({ success:false,url:null })
})`
The callback isn't working unfortunately. I have no idea why. I need to navigate to another screen after a cancelled or successful payment.
The last commit to this library been months ago, there are no stable releases. I want to contribute to this module, But i want to know whats up first?
The last commit to this library been months ago, there are no stable releases. I want to contribute to this module, But i want to know whats up first?
Please, I need help setting everything up i was following a tripe tutorial and getting confused because it is a bit different.
pls contact me via email or WhatsApp
[email protected]
09038010114
Hello. I am just using this api for the first time and I can't seem to create any plan for amount below 10000. I do not know why.
My code is the same thing as the documentation only that the amount is different
paystack.plan.create({ name: 'API', amount: 1000, interval: 'weekly' })
This does not create the plan. How come am the first one to notice this issue all this while??
Executed charge_token method with params token and email and got this error.
Error => status=false, message=charge_token has been discontinued. Please use our SDKs' chargeCard function instead. Thank you for chosing Paystack!
There is not any method named "chargeCard" mentioned in the API documentation.
TypeScript is unable to resolve the package from node_modules.
This is my code
import * as paystack from "paystack";
I get the following error
Could not find a declaration file for module 'paystack'. 'c:/Users/timolin/.../node_modules/paystack/index.js' implicitly has an 'any' type.
I can get around this by creating a paystack.d.ts
inside my secondary @types
directory, but I don't get auto-completion.
Please is there any plans to add TypeScript support?
I don't seem to understand how i can verify a transaction initiated on the front end of my site using this api how to i pass the reference generated by paystack to paystack.transaction.verify
I am seeing multiple PRs and Issues. I will be starting to use this library for a client.
@kehers, if you need any help in maintaining this, I'll be happy to maintain this for you.
If you are not interested in maintaining this anymore, or you don't have time enough. I'll fork this.
Let me know your thoughts. Feel free to reach out.
Twitter: @Rohithzr
Mail: [email protected]
I think the library should provide an easy way for handling Paystack events. I'd propose something like an express middleware that allows the user to define handlers for the different events, the middleware should also verify the signature before calling the event handler.
Here's an example of what it could look like in practice:
const paystack = require('paystack')('secret_key');
const events = paystack.events();
// register handler for different events
events.setHandler('charge.success', (req, res) => {
const event = req.body;
// handle event
res.send(200);
});
// register as express middleware
app.use('/my/webhook/url', events);
That's just a suggestion to illustrate the general idea, it doesn't have to be exactly as that. For instance the handler could just receive the event body and a callback or return a promise.
What to get a subaccount using the subaccount code. This, paystack.subaccount.get({id_or_slug}) is the code I use and didn't work. I keep getting the error with this expression - type error, ```
if(!body){
...
}
from paystack/index. What is the way to do this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.