A type safe paysafecard client for NodeJS written in Typescript
Read the documentation here.
npm install --save @ingameltd/paysafecard
import {
Paysafecard,
Payment
Currency,
} from "@ingameltd/paysafecard";
const paysafecard = new Paysafecard(key);
const result = await psc.initiatePayment({
amount: 0.2,
currency: Currency.EUR,
customer: {
id: "b4e7fa08-1dde-4f45-b3dd-3e5e99a2177d",
},
notification_url: " https://notification.com/payment?payment_id={payment_id}",
redirect: {
success_url: "https://mystore.com/order?orderId={payment_id}",
failure_url: "https://mystore.com/order?orderId={payment_id}&error=true",
},
});
When the notification arrives, merchant should retrive the payment from the Paysafecard.
const result = await paysafecard.retrievePayment(
"id of the paysafecard transaction"
);
After retrive order, if it is in Authorized
state, merchant should capture order with the following API call
to transfer funds from customer to the merchant.
const result = await paysafecard.captureOrder(
"id of the paysafecard transaction"
);
Generated using TypeDoc