Skip to content

Latest commit

 

History

History
56 lines (44 loc) · 1.05 KB

Readme.md

File metadata and controls

56 lines (44 loc) · 1.05 KB

@xmoney/api-sdk

Instalaltion

npm install @xmoney/api-sdk

Usage

Get needed params for checkout initialization:

import InlineCheckoutApiSdk from "@xmoney/api-sdk";

const inlineCheckout = new InlineCheckoutApiSdk({
  secretKey: "mySecretKey",
});

const order = inlineCheckout.initializeCheckout({
  siteId: 1,
  customer: {
    identifier: "customerIdentifier",
    firstName: "John",
    lastName: "Doe",
    country: "RO",
    city: "Bucharest",
    email: "[email protected]",
  },
  order: {
    orderId: "myUniqueOrderId",
    description: "Order Description",
    type: "purchase",
    amount: 100,
    currency: "EUR",
  },
  cardTransactionMode: "authAndCapture",
  backUrl: "https://127.0.0.1:8080",
});

How to decrypt order webhook payload:

import InlineCheckoutApiSdk from "@xmoney/api-sdk";

const inlineCheckout = new InlineCheckoutApiSdk({
  secretKey: "mySecretKey",
});

const webhookPayload = 'ecryptedPayload'; 

console.log(
    inlineCheckout.decryptOrderResponse(webhookPayload)
);