npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@paytrail/paytrail-js-sdk

v1.0.3

Published

The goal for this project is to develop a Javascript SDK for the Paytrail payment service. The aim is to provide JS developers with an easier and more streamlined way to integrate our API into their applications.

Downloads

1,066

Readme

Paytrail Javascript SDK

The goal for this project is to develop a Javascript SDK for the Paytrail payment service. The aim is to provide JS developers with an easier and more streamlined way to integrate our API into their applications.

The initial version of the JS SDK will be focused on basic payment handling and backend usage, specifically enabling communication with the Paytrail payment API. As such, it will not include any frontend functionalities, similar to the Paytrail PHP-SDK. However, we may provide examples for frontend implementation at a later stage.

Paytrail Payment Service

Paytrail is a payment gateway that offers 20+ payment methods for Finnish customers.

The payment gateway provides all the popular payment methods with one simple integration. The provided payment methods include, but are not limited to, credit cards, online banking and mobile payments.

To use the payment service, you need to sign up for a Paytrail account. Transaction fees will be charged for every transaction. Transaction cost may vary from merchant to merchant, based on what is agreed upon with Paytrail when negotiating your contract. For more information and registration, please visit our website or contact [email protected] directly.

Requirements

General requirements

  • NodeJS v20.0.0 or later

Development requirements

  • Jest - Jest is a delightful JavaScript Testing Framework with a focus on simplicity.

Installation

Install with npm:

npm install @paytrail/paytrail-js-sdk

Install with yarn:

yarn add @paytrail/paytrail-js-sdk

Usage

const { PaytrailClient, PaymentMethodGroup } = require('@paytrail/paytrail-js-sdk')

const client = new PaytrailClient({
  merchantId: 123456,
  secretKey: 'xxx',
  platformName: 'xxx'
})

async function main() {
  // Example
  const res = await client.listGroupedProviders({
    amount: 1,
    groups: [PaymentMethodGroup.Mobile, PaymentMethodGroup.CreditCard]
  })

  console.log(res)
}

main()

Folder contents & descriptions

| Folder/File | Content/Description | | ---------------------- | ------------------------------------------------------------------------ | | src/exceptions | Exception classes and functions | | src/interfaces | Interface classes and functions for all the related classes to implement | | src/models | Model classes and functions | | src/models/request | Request model and functions | | src/models/response | Response model and functions | | src/utils | Utility/trait classes and functions | | src/paytrail.ts | Init paytrail service | | src/paytrail-client.ts | Paytrail client class and functions | | tests | Unit test |

Basic functionalities

The Paytrail JS-SDK supports most of the functionalities of the Paytrail Payment API.

Some of the key features are:

Payments and refunds

Tokenized credit cards and payments

Shop-in-Shop

  • Creating Shop-in-Shop payment request

Settlements

Reports

Methods

List of PaytrailClient::class methods

| Method | Description | | ----------------------------------- | ---------------------------------------------------- | | listGroupedProviders() | Returns an array of grouped payment providers fields | | createPayment() | Create payment | | createShopInShopPayment() | Create SiS payment | | getPaymentStatus() | Request payment status | | createRefund() | Create refund | | emailRefund() | Create email refund | | paymentReportRequest() | Request payment report | | requestSettlements() | Request settlements | | createGetTokenRequest() | Request card token | | createMitPaymentCharge() | Create MiT payment | | createMitPaymentAuthorizationHold() | Create MiT authorization hold | | createCitPaymentCharge() | Create CiT payment | | createCitPaymentAuthorizationHold() | Create CiT authorization hold | | createMitPaymentCommit() | Commit MiT authorization hold | | createCitPaymentCommit() | Commit CiT authorization hold | | revertPaymentAuthorizationHold() | Revert existing Mit or CiT authorization hold | | createAddCardFormRequest() | Create payment and save card details |


Disclaimer: This open source project is made available to assist coders in getting started with our API. However, we do not provide any warranty or guarantee that the code will work as intended and offer limited support for it. Use at your own risk.