After some headache and attempts, I found a fairly simple way to solve swish payments through cloud functions:
request-js , request.post( ) :
const swishOptions = {
url: 'LINK TO SWISH SERVER',
json: true,
pfx: fs.readFileSync('cert.p12'),
passphrase: 'swish',
body: swishRequestBody
}
cert.p12 , index.js, .
rq.post(swishOptions, (err, res) => {
if (err){
console.log('payment creation error: ' + JSON.stringify(err))
reject(err)
}
if (res){
console.log('Payment-token: ' + res.headers.paymentrequesttoken)
}
});
- , Swish API, console.log() Swish-.