A lightweight, fully-featured, modular, typescript-compatible javascript library for Paymongo.

Overview

paymongo.js

CI CJS ESM License Version

A lightweight, fully-featured, modular, typescript-compatible javascript library for PayMongo.

Installation

NPM

npm install paymongo.js # or yarn add paymongo.js

Usage

import PaymongoClient from "paymongo.js";
export const client = PaymongoClient("sk_key");

Payment Method

See PaymentMethod Resource reference.

  • Create a Method

    const createResponse = await client.method.create({
      details: {
        cardNumber: "4343434343434345",
        expMonth: 3,
        expYear: 2023,
        cvc: "321",
      },
      type: "card", // card | paymaya
    });
  • Retrieve a Method

    const retrieveResponse = await client.method.retrieve("some_method_id");

Payment Intent

See PaymentIntent Resource reference.

  • Create a Intent

    const createResponse = await client.intent.create({
      amount: 10000,
      metadata: {
        order_id: "some_order_id",
      },
    });
  • Retrieve a PaymentIntent

    const retrieveResponse = await client.intent.retrieve({
      intentId: "some_intent_id",
    });
  • Attach to PaymentIntent

    const attachResponse = await client.intent.attach({
      intentId: "some_intent_id",
      methodId: "some_method_id",
    });

Sources

See Source Resource reference.

  • Create a Source

    const createResponse = await client.source.create({
      type: "gcash", // gcash | grab_pay
      currency: "PHP",
      amount: 10000,
      redirect: {
        success: "https://example.com/payments/success",
        failed: "https://example.com/payments/error",
      },
    });
  • Retrieve a Source

    const retrieveResponse = await client.source.retrieve("some_source_id");

Payments

See Payment Resource reference.

  • Create a Payment

    const p = await client.payment.create({
      amount: 10000,
      source: {
        id: "some_source_id"
        type: "source",
      },
    });
  • List all Payments

    const p = await client.payment.list();
  • Retrieve a Payment

    const p = await client.payment.retrieve("some_payment_id");

Webhooks

See Webhook Resource reference.

  • Create a Webhook

    const webhook = await client.webhook.create({
      events: ["payment.failed", "payment.paid", "source.chargeable"],
      url: "https://example.com/webhook",
    });
  • Update a Webhook

    const webhook = await client.webhook.update({
      webhookId: "some_webhook_id",
      events: ["payment.failed"],
    });
  • List all Webhooks

    const webhooks = await client.webhook.list();
  • Retrieve a Webhook

    const webhook = await client.webhook.retrieve("some_webhook_id");
  • Enable a Webhook

    const webhook = await client.webhook.enable("some_webhook_id");
  • Disable a Webhook

    const webhook = await client.webhook.disable("some_webhook_id");

Contributing

See CONTRIBUTING.md

Like the project? would appreciate a coffee

Buy Me A Coffee

Contributor list

Contributors


Running your own instance

Clone the repository:

git clone https://github.com/princejoogie/paymongo.js.git
cd paymongo.js
npm start # or yarn start

This builds to /dist and runs the project in watch mode so any edits you save inside src causes a rebuild to /dist.

To do a one-off build, use npm run build or yarn build.

To run tests, use npm test or yarn test.

Configuration

Code quality is set up for you with prettier, husky, and lint-staged. Adjust the respective fields in package.json accordingly.

Jest

Jest tests are set up to run with npm test or yarn test.

Bundle Analysis

size-limit is set up to calculate the real cost of your library with npm run size and visualize the bundle with npm run analyze.

Rollup

This library uses Rollup as a bundler and generates multiple rollup configs for various module formats and build settings. See Optimizations for details.

TypeScript

tsconfig.json is set up to interpret dom and esnext types, as well as react for jsx. Adjust according to your needs.

Continuous Integration

GitHub Actions

Two actions are added by default:

  • main which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
  • size which comments cost comparison of your library on every pull request using size-limit

Optimizations

Please see the main tsdx optimizations docs. In particular, know that you can take advantage of development-only optimizations:

// ./types/index.d.ts
declare var __DEV__: boolean;

// inside your code...
if (__DEV__) {
  console.log("foo");
}

You can also choose to install and use invariant and warning functions.

Module Formats

CJS, ESModules, and UMD module formats are supported.

The appropriate paths are configured in package.json and dist/index.js accordingly. Please report if any issues are found.

Publishing to NPM

We recommend using np.


Made by Prince Carlo Juguilon together with these awesome Contributors.

You might also like...

A fully type-safe and lightweight way of using exceptions instead of throwing errors

🛡️ exceptionally A fully type-safe and lightweight way of using exceptions instead of throwing errors 🦺 fully typesafe 🐤 lightweight (209 bytes) 🏃

Jan 4, 2023

A simple Todo app to add list of books a user has read using HTML, CSS, Webpack, JavaScript and modular architecture

A simple Todo app to add list of books a user has read using HTML, CSS, Webpack, JavaScript and modular architecture

Minimalist A simple Todo app to add list of books a user has read. It is implemented using HTML, CSS, Webpack, JavaScript and modular architecture. A

May 9, 2022

JavaScript image gallery for mobile and desktop, modular, framework independent

PhotoSwipe v5 — JavaScript image gallery and lightbox Demo | Documentation Repo structure dist/ - main JS and CSS src/ - source JS and CSS. src/js/pho

Dec 29, 2022

A simple javascript library for pagination, compatible with Bootstrap.

A simple javascript library for pagination, compatible with Bootstrap.

Easy Pagination JS A simple library for pagination, compatible with Bootstrap. Check my website here. Demo Check this Demo here. Example Import the fi

Aug 5, 2022

Zepto.js is a minimalist JavaScript library for modern browsers, with a jQuery-compatible API

Zepto.js – a minimalist JavaScript library Zepto is a minimalist JavaScript library for modern browsers with a largely jQuery-compatible API. If you u

Dec 31, 2022

Typescript package compatible with python's pickle loads/dumps

picklefriend Typescript package compatible with python's pickle loads/dumps Installation npm i picklefriend Usage import { pickle } from 'picklefriend

Oct 27, 2022

EggyJS is a Javascript micro Library for simple, lightweight toast popups focused on being dependency-less, lightweight, quick and efficient.

EggyJS EggyJS is a Javascript micro Library for simple, lightweight toast popups. The goal of this library was to create something that meets the foll

Jan 8, 2023

An interactive app that allows adding, editing and removing tasks of a to-do list. Drag-and-drop featured added. Webpack was used to bundle all the Js modules in to one main Js file.

An interactive app that allows adding, editing and removing tasks of a to-do list. Drag-and-drop featured added. Webpack was used to bundle all the Js modules in to one main Js file.

To-do List A to-do list app This app let you to set your own to-do list. Built With HTML CSS JavaScript WebPack Jest Live Page Page Link Getting Start

May 5, 2022
Releases(v1.2.1-0)
  • v1.2.1-0(Jan 13, 2022)

  • v1.2.0-0(Jan 13, 2022)

    (Pre-release) Links

    For usage, check (BETA Links)

    npm install paymongo.js@next # or yarn add paymongo.js@next
    
    • Create a Link

      const link = await client.link.create({
        amount: 10000,
        description: "Test payment link",
      });
      
    • **Retrieve a Link

      const link = await client.link.retrieve("some_link_id");
      
    • Retrieve from Reference number

      const link = await client.link.retrieveFromRef("some_ref_id");
      
    • Archive a Link

      const link = await client.link.archive("some_link_id");
      
    • Unarchive a Link

      const link = await client.link.unarchive("some_link_id");
      

    Changelog

    https://github.com/princejoogie/paymongo.js/compare/v1.1.2...v1.2.0-0

    Source code(tar.gz)
    Source code(zip)
  • v1.1.2(Jan 12, 2022)

    • bugfix: no error thrown 1300c9f
    • chore: docs update 8d6ee75
    • feat: add source unit test c8811bf

    https://github.com/princejoogie/paymongo.js/compare/v1.1.1...v1.1.2

    Source code(tar.gz)
    Source code(zip)
  • v1.1.1(Jan 12, 2022)

  • v1.1.0(Jan 11, 2022)

    Fixes

    • Retrieve method & docs update 99597a3
    • Add contributor list in docs beb6315

    https://github.com/princejoogie/paymongo.js/compare/v1.0.1...v1.1.0

    Source code(tar.gz)
    Source code(zip)
  • v1.0.1(Jan 10, 2022)

  • v1.0.0(Jan 10, 2022)

    All methods mentioned in API Reference of Paymongo are supported and fully-typed.

    Features

    • Payment Intents
      • create
      • retrieve
      • attach
    • Payment Methods
      • create
      • retrieve
    • Payment Source
      • create
      • retrieve
    • Payment Web hook
      • create
      • retrieve
      • list
      • enable
      • disable
      • update
    • Payment
      • create
      • retrieve
      • list
    Source code(tar.gz)
    Source code(zip)
  • v0.1.2-0(Jan 10, 2022)

    v0.1.2-0 pre-release

    Working features:

    • Payment Intents
      • create
      • retrieve
      • attach
    • Payment Methods
      • create
      • retrieve
    • Payment Source
      • create
      • retrieve
    • Payment Web hook
      • create
      • retrieve
      • list
      • enable
      • disable
      • update

    Todo:

    • Payment
      • create
      • retrieve
      • list
    Source code(tar.gz)
    Source code(zip)
Owner
Prince Carlo Juguilon
Software Consultant | React | Typescript | Postgres
Prince Carlo Juguilon
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Fully featured clean-css plugin for Visual Studio Code

vscode-clean-css Fully featured clean-css plugin for Visual Studio Code. Install Execute Extensions: Install Extensions command from Command Palette (

Shogo Sensui 2 Nov 9, 2021
Zero Two Bot,A fully Modular Whatsapp Bot to do everything possible in WhatsApp by Team Zero Two

?? ???????? ?????? ???? ?? A Moduler WhatsApp Bot designed for both PM and Groups - To take your boring WhatsApp usage into a whole different level. T

Sam Pandey 69 Dec 25, 2022
A fully type-safe and lightweight internationalization library for all your TypeScript and JavaScript projects.

?? typesafe-i18n A fully type-safe and lightweight internationalization library for all your TypeScript and JavaScript projects. Advantages ?? lightwe

Hofer Ivan 1.3k Jan 4, 2023
A full-featured Solana Metaplex Candymachine client-side library in Typescript

Candymachine Client SDK A full-featured Solana Metaplex Candymachine client-side library in Typescript Disclaimer: The SDK is currently a pre-alpha ve

Boxfish Studio 36 Nov 10, 2022
This is my to-do list website built with html, css and JavaScript. In this project I used Webpack to bundle JavaScript and ES6 modules to write modular JavaScript.

To-Do-List App This is my to-do list website built with html, css and JavaScript. In this project I used Webpack to bundle JavaScript and ES6 modules

Samuel Mwape 18 Sep 20, 2022
Jspreadsheet is a lightweight vanilla javascript plugin to create amazing web-based interactive tables and spreadsheets compatible with other spreadsheet software.

Jspreadsheet CE v4: The JavaScript spreadsheet Jexcel CE has been renamed to Jspreadsheet CE News Important: Please import jspreadsheet.css (jexcel.cs

null 6.2k Dec 19, 2022
Full featured JavaScript image & video gallery. No dependencies

lightgallery.js Full featured JavaScript lightbox gallery. No dependencies. Important notice lightgallery.js has been merged with lightGallery. That m

Sachin Neravath 5.2k Dec 30, 2022
A modular authentication library for Deno.

Bedrock A fully modular authentication library for Deno that intends to be the Bedrock of your application's authentication/session control. Bedrock p

OSLabs Beta 107 Dec 10, 2022