Hello Guys, I need to integrate NetSuite to USAePa...
# integrations
a
Hello Guys, I need to integrate NetSuite to USAePay using SuiteScript 2.1 but am unable to authenticate. Can someone please help?? Here is the API link, https://help.usaepay.info/api/rest/#authentication Thanks!
b
what have you tried
a
Hello @battk, I have tried below code, var seed = "40biz08xzegcawke"; var apipin = "221007"; var apikey = "_1Ark9epv1c1Kwer34dfraa1264sKiNB"; var prehash = apikey + seed + apipin; console.log('Prehash: ' + prehash); var apihash = "s2/" + seed + "/" + "8fa4df8e8637c82e3d26afb5b444c832eb6a9e28dd60551c30ed80e3f771bc6c"; var authKey = new Buffer(apikey + ":" + apihash).toString('base64'); console.log('Auth: ' + authKey); But getting error "Uncaught TypeError: Buffer is not a constructor"
b
thats code for Node
suitescript does not have Buffer
a
@battk so how can we do this in Suitescript?
b
you will have to implement it yourself in suitescript
as a minor warning their authentication documentation is not really well defined
they dont really document what is a valid seed
so you are left to assume alphabet (or maybe alphanumeric)
other than that, you can probably implement it using crypto.Hash for your hashing and encode.convert for your encoding
security wise, I really hope their api pin is more complicated than a 6 digit number
that api pin is basically the only thing that isnt equivalent to plaintext
a
@battk Okay... thank you.... Let me check on this.
b
you should probably check with in with the SDN team and ask about SuitePayments if you are trying to do a payment gateway integration
d
@battk ^^^ this is great advice ... don't mess with NetSuite when it comes to payments @AB