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

pcp-server-nodejs-sdk

v1.0.0

Published

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=PAYONE-GmbH_PCP-server-nodeJS-SDK&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=PAYONE-GmbH_PCP-server-nodeJS-SDK) [![Coverage](https://sonarcloud.io/api/pr

Downloads

85

Readme

PAYONE Commerce Platform Node SDK

Quality Gate Status Coverage npm npm downloads

Welcome to the Node SDK for the PAYONE Commerce Platform! This repository contains a powerful, easy-to-use software development kit (SDK) designed to simplify the integration of online payment processing into your applications.

Table of Contents

Features

  • Easy Integration: Seamlessly integrate online payment processing into your application.
  • Secure Transactions: Built with security best practices to ensure safe transactions.
  • Extensive Documentation: Detailed documentation to help you get started quickly.
  • Open Source: Fully open source and community-driven.

Installation

# npm
npm i pcp-server-nodejs-sdk
# yarn
yarn add pcp-server-nodejs-sdk

back to top

Usage

General

To use this SDK you need to construct a CommunicatorConfiguration which encapsulate everything needed to connect to the PAYONE Commerce Platform.

const apiKey = process.env.API_KEY;
const apiSecret = process.env.API_SECRET;

const config = new CommunicatorConfiguration(apiKey, apiSecret, 'api.preprod.commerce.payone.com');

With the configuration you can create an API client for each reource you want to interact with. For example to create a commerce case you can use the CommerceCaseApiClient.

const commerceCaseClient = new CommerceCaseApiClient(config);

All payloads and reponses are availabe as ts interfaces exported from this library. For example, to create an empty commerce case you can pass an object with the CreateCommerceCaseRequest interface:

const createCommerceCaseRequest: CreateCommerceCaseRequest = {};

const createCommerceCaseResponse: CreateCommerceCaseResponse = commerceCaseClient.createCommerceCaseRequest(
  'merchant_id',
  createCommerceCaseRequest,
);

The models directly map to the API as described in PAYONE Commerce Platform API Reference.

Error Handling

When making a request any client may throw a ApiException. There two subtypes of this exception:

  • ApiErrorReponseException: This exception is thrown when the API returns an well-formed error response. The given errors are deserialized into APIError objects which are availble via the getErrors() method on the exception. They usually contain useful information about what is wrong in your request or the state of the resource.
  • ApiResponseRetrievalException: This exception is a catch-all exception for any error that cannot be turned into a helpful error response. This includes malformed responses or unknown responses.

Client Side

For most payment methods some information from the client is needed, e.g. payment information given by Apple when a payment via ApplePay suceeds. PAYONE provides client side SDKs which helps you interact the third party payment providers. You can find the SDKs under the PAYONE GitHub organization. Either way ensure to never store or even send credit card information to your server. The PAYONE Commerce Platform never needs access to the credit card information. The client side is responsible for safely retrieving a credit card token. This token must be used with this SDK.

Apple Pay

When a client is successfully made a payment via ApplePay it receives a ApplePayPayment. This structure is accessible as the ApplePayPayment class. You can use the ApplePayTransformer to map an ApplePayPayment to a MobilePaymentMethodSpecificInput which can be used for payment executions or order requests. The transformer has a static method transformApplePayPaymentToMobilePaymentMethodSpecificInput() which takes an ApplePayPayment and returns a MobilePaymentMethodSpecificInput. The transformer does not check if the response is complete, if anything is missing the field will be set to undefined.

back to top

Demo App

cd example-app
npm i
API_KEY=api_key API_SECRET=api_secret MERCHANT_ID=123 COMMERCE_CASE_ID=234 CHECKOUT_ID=345 npm run dev

back to top

Contributing

See Contributing

back to top

Releasing the library

Preparing the Release

  • Checkout develop branch
  • Create release branch (release/0.1.0)
git checkout -b release/0.1.0
  • Apply versioning
npm version major|minor|patch

Changelog Generation with Conventional Changelog

The changelog gets generated automatically when the npm version gets bumped via npm version major|minor|patch within the version.sh script.

  1. Conventional Commit Messages:

    • Ensure all commit messages follow the conventional commit format, which helps in automatic changelog generation.
    • Commit messages should be in the format: type(scope): subject.
  2. Enforcing Commit Messages:

    • We enforce conventional commit messages using Lefthook with commitlint.
    • This setup ensures that all commit messages are validated before they are committed.

Merging the Release Branch

  • Create PR on develop branch
  • Merge develop in main branch

GitHub Action for Release

After successfully merging all changes to the main branch, an admin can trigger a GitHub Action to finalize and publish the release. This action ensures that the release process is automated, consistent, and deploys the new release from the main branch.

Triggering the GitHub Action:

  • Only admins can trigger the release action.
  • Ensure that all changes are committed to the main branch.
  • Navigate to the Actions tab on your GitHub repository and manually trigger the release action for the main branch.

Optional: Creating a GitHub Release

Once the release has been published to npm, developers can start using the latest version of the SDK. However, if you want to make the release more visible and include detailed release notes, you can optionally create a GitHub release.

  1. Navigate to the Releases Page: Go to the "Releases" section of your repository on GitHub.
  2. Draft a New Release: Click "Draft a new release".
  3. Tag the Release: Select the version tag that corresponds to the version you just published on npm (e.g., v0.1.0).
  4. Release Title: Add a descriptive title for the release (e.g., v0.1.0 - Initial Release).
  5. Auto-Generated Release Notes: GitHub can automatically generate release notes based on merged pull requests and commit history. You can review these notes, adjust the content, and highlight important changes.
  6. Publish the Release: Once you're satisfied with the release notes, click "Publish release".

Creating a GitHub release is optional, but it can provide additional context and visibility for your users. For detailed guidance, refer to the GitHub documentation on managing releases.

back to top

License

This project is licensed under the MIT License - see the LICENSE file for details.

back to top


Thank you for using our SDK for Online Payments! If you have any questions or need further assistance, feel free to open an issue or contact us.