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

@misterhomer1992/wayforpay-api

v1.2.0

Published

Welcome to the WayFoPay Payment Service repository. This project is dedicated to providing an easy-to-integrate payment solution through our API, making it simpler for merchants to initiate transactions and securely process payments.

Downloads

40

Readme

WayFoPay Payment Service

Welcome to the WayFoPay Payment Service repository. This project is dedicated to providing an easy-to-integrate payment solution through our API, making it simpler for merchants to initiate transactions and securely process payments.

Features

  • Generate Purchase URL: Generate a secure link for processing payments with customizable parameters to fit various transaction requirements.
  • Retrieve Purchase State: Retrieve the state of a purchase using the merchant account and order reference.
  • Refund Purchase: Refund a purchase using the merchant account, order reference, amount, and currency.
  • Generate Regular Purchase URL: Generate a secure link for processing regular payments with customizable parameters.
  • Retrieve Regular Purchase State: Retrieve the state of a regular purchase using the merchant account and order reference.
  • Cancel Regular Purchase: Cancel a regular purchase using the merchant account and order reference.

Installation

npm install @misterhomer1992/wayforpay-api

Usage

Below is a step-by-step guide on how to use the generatePurchaseUrl function:

  1. Usage

    import {
        generatePurchaseUrl,
        retrievePurchaseState,
        refundPurchase,
        generateRegularPurchaseUrl,
        retrieveRegularPurchaseState,
        cancelRegularPurchase,
    } from '@misterhomer1992/wayforpay-api';
  2. Prepare Your Parameters

    You'll need to prepare several parameters to pass to the generatePurchaseUrl function. These parameters include merchant details, order information, product details, and optional configurations.

    const purchaseParams = {
        merchantAccount: 'yourMerchantAccountID',
        merchantSecretKey: 'yourMerchantSecretKey',
        merchantDomainName: 'yourDomain.com',
        orderReference: 'yourUniqueOrderRef',
        orderDate: new Date().getTime(),
        productName: ['Product 1', 'Product 2'],
        productPrice: [100.0, 200.0],
        currency: 'USD', // Optional, defaults to USD
        productCount: [1, 2], // Optional
        amount: 300.0, // Optional total amount
        orderTimeout: 49000, // Optional, in milliseconds
        orderLifeTime: 86400, // Optional, in seconds
        serviceUrl: 'yourServiceUrl', // Optional, for callback
        language: 'EN', // Optional, defaults to EN
    };
  3. Use the Functions

    With your parameters prepared, you can now call the functions and handle the responses.

    generatePurchaseUrl(purchaseParams)
        .then((response) => {
            console.log('Purchase URL:', response.url);
        })
        .catch((error) => {
            console.error('Error generating purchase URL:', error);
        });
    
    retrievePurchaseState({
        merchantAccount: 'yourMerchantAccountID',
        orderReference: 'yourUniqueOrderRef',
        merchantSecretKey: 'yourMerchantSecretKey',
    })
        .then((response) => {
            console.log('Purchase State:', response.data);
        })
        .catch((error) => {
            console.error('Error retrieving purchase state:', error);
        });
    
    refundPurchase({
        merchantAccount: 'yourMerchantAccountID',
        orderReference: 'yourUniqueOrderRef',
        merchantSecretKey: 'yourMerchantSecretKey',
        amount: 300.0,
        currency: 'USD',
    })
        .then((response) => {
            console.log('Refund Response:', response.data);
        })
        .catch((error) => {
            console.error('Error refunding purchase:', error);
        });
    
    generateRegularPurchaseUrl({
        ...purchaseParams,
        regularMode: 'daily',
        regularCount: 5,
    })
        .then((response) => {
            console.log('Regular Purchase URL:', response.url);
        })
        .catch((error) => {
            console.error('Error generating regular purchase URL:', error);
        });
    
    retrieveRegularPurchaseState({
        merchantAccount: 'yourMerchantAccountID',
        orderReference: 'yourUniqueOrderRef',
        merchantPassword: 'yourMerchantPassword',
    })
        .then((response) => {
            console.log('Regular Purchase State:', response.data);
        })
        .catch((error) => {
            console.error('Error retrieving regular purchase state:', error);
        });
    
    cancelRegularPurchase({
        merchantAccount: 'yourMerchantAccountID',
        orderReference: 'yourUniqueOrderRef',
        merchantPassword: 'yourMerchantPassword',
    })
        .then((response) => {
            console.log('Cancel Regular Purchase Response:', response.data);
        })
        .catch((error) => {
            console.error('Error cancelling regular purchase:', error);
        });

Contributing

We appreciate any contributions you make to this project. Please feel free to make pull requests or report issues.

License

This project is licensed under MIT License. Feel free to use, modify, and distribute the code as you see fit.

Contact

For any inquiries or support requests, please contact our team at [email protected].