Xsolla Node Client
A Node.js client for the Xsolla API. Written in TypeScript to provide you with all the type checking and auto-completion convenience supported by most modern JS IDEs. 👌
Installation
Pull in the package with npm:
npm install xsolla
Usage
Initialize Xsolla:
const Xsolla = default; const client = merchantId: 123456 apiKey: 'abc123'
Projects
The Xsolla client exposes a projects
property that can be used to create, update and read projects attached to your
merchant account.
Create a project
clientprojects;
Returns a promise for a Project
model.
Get a project:
const project = await clientprojects
Returns a promise for a Project
model.
Fetch all projects
const projects = clientprojectsall;
Returns a promise for an array of Project
models.
The Project Model
The Project model is an instance of a project that you've either created or fetched
Create a payment token
You can create payment tokens directly from a Project model.
(Obtained by either Xsolla.projects.get()
or Xsolla.projects.create()
)
const token = await project;
Create a payment link
const url = await project;
Update a project
const updatedProject = await project;
Returns a promise for an updated Project
model.
Validate an incoming webhook
app;
Project's validateWebhookRequest()
method throws an
XsollaException
for unauthorized requests.
License
This repository is licensed under the ISC license.
Copyright (c) 2019, Jørgen Vatle.