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

bogpay

v1.6.1

Published

An NPM package for simplifying and managing payments with the Bank of Georgia API, providing easy-to-use functions for authentication, payment processing, refunds, and more.

Downloads

40

Readme

Bank Of Georgia online payment API

An NPM package to simplify the usage and integration of the Bank of Georgia online payment API.

Documentation

Check Bank of Georgia API docs for further information.

Installation

Install the package with:

npm install bogpay

Usage

To use the library, HTTP Basic Auth is required. You will need to know the unique credentials of your business to enter the system. These credentials consist of two parameters, client_id, and client_secret, used as the username and password for business authentication.

How to obtain the credentials for entering the business system?

Upon registering a company as a business in the banking system and providing all the necessary data, the system provides the credentials client_id and client_secret necessary to enter the system. These credentials are unique identifiers of the business. It is impermissible to disclose or transfer the client_secret parameter to another person. Doing so significantly increases the probability of a security breach. The business cannot change the client_secret parameter.

Authentication

This method allows businesses to undergo the authentication process. Upon calling the API, the online payment server returns the Bearer Token, which is the necessary authentication parameter for calling all further methods.


try
{
    const data = await getAuthToken(clientId, secretKey) // returns Authentication token, it's lifetime and type(Bearer)
}
catch (error)
{
    //...
}

Order request

To place an order request, businesses must send payment details, technical specifications, and the amount to be paid to the online payment server. If the process is successful, the customer should be redirected to the online payment page at the redirect address returned to the _link parameter to complete the payment.

try
{
    // returns order_id and links for payment details and redirects
    const response = await orderRequest(requestCredentials) // requestCredentials is an object and it's strucutre shown below
}
catch (error)
{
    //...
}

A structure of requestCredentials:


{
    "headers": {
        "Authorization": "Bearer some_token", // change "some_token" with your actual token
        "Content-Type": "application/json"
    },
    "body": {
        "callback_url": "https://example.com/callback",
        "external_order_id": "order_12345",
        "purchase_units": {
            "basket": [
                {
                    "product_id": "prod_001",
                    "quantity": 2, 
                    "unit_price": 100 
                },
                {
                    "product_id": "prod_002", 
                    "quantity": 1, 
                    "unit_price": 200 
                }
            ],
            "total_amount": 420 
        },
        "redirect_urls": {
            "success": "https://example.com/success", 
            "fail": "https://example.com/fail"
        }
    }
}

For more options for the request check out Bank of Georgia's official docs

Payment details

This method allows businesses to receive detailed information about an online payment using its identifier.

Note: The in order to run this function, getAuthToken() must be run first


try
{
    const details = await paymentDetails(order_id) // fetches payment details for the given order ID
}
catch (error)
{
    //...
}

Wrap up

If you encounter any trouble using the library, use this template:


async function payment()
{
    try
    {
        
        const {access_token} = await getAuthToken(clientId,secretKey); // authenticate a buisness
    
        const requestCredentials = 
        {
            headers: 
            {
                "Content-Type": "application/json",
                "Authorization": `Bearer ${access_token}`
            },
            body: data
        }
        
        const requestData = await orderRequest(requestCredentials); // make a request with required data
    
    
        const details = await getPaymentDetails(requestData.id); // get details about the payment
        
        console.log(details);
        
        return details;

    }
    catch (error)
    {
        console.error(error);
    }
    
}