0.0.6 • Published 3 years ago

@miccoh/payfast-server v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Payfast Server Side Validation

Usage

import { validatePayment } from '@miccoh/payfast-server';

app.post('/ipn', async (req, res) => {
  const valid = await validatePayment({
    xForwardedForHeader: req.headers['x-forwarded-for'] || req.socket.remoteAddress,
    payload: req.body,
    signature: req.body.signature
  }, {
    yourAmount: 100,
    sandbox: true, //toggle sandbox mode
  });
  if (valid) {
    res.status(200).send('success');
    return;
  }
  res.status(400).send({ message: 'failed' });
});
0.0.6

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago