Options
All
  • Public
  • Public/Protected
  • All
Menu

@ingameltd/paysafecard

Paysafecard client for NodeJS

A type safe paysafecard client for NodeJS written in Typescript

Read the documentation here.

Installation

npm install --save @ingameltd/paysafecard

Usage

Importing

import {
  Paysafecard,
  Payment
  Currency,
} from "@ingameltd/paysafecard";

Initialization

  • key : Key from the Paysafecard merchant panel (PSC_XXX_XXXXXXXXXXXXXXXXXXXXXX)
const paysafecard = new Paysafecard(key);

Create an order

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",
  },
});

Retrive order

When the notification arrives, merchant should retrive the payment from the Paysafecard.

const result = await paysafecard.retrievePayment(
  "id of the paysafecard transaction"
);

Capture order

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