GithubHelp home page GithubHelp logo

montonio-client's Introduction

Unofficial Montonio API Client

CI/CD npm version GitHub release

This is an unofficial client for the Montonio API. It provides a convenient way to interact with the Montonio API from your JavaScript or TypeScript code.

Montonio API Docs

Installation

To install the client, you can use npm:

npm install --save @almightytech/montonio-client

Usage

First, import the client:

import { MontonioClient, MontonioClientOptions } from '@almightytech/montonio-client';

Then, create a new client instance:

const options: MontonioClientOptions = {
    // Your access key (required)
    accessKey: 'your-access-key',

    // Your secret key (required)
    secretKey: 'your-secret-key',

    // Use the sandbox environment (optional, defaults to true)
    sandbox: true,

    // Overrides the base URL for all requests (optional)
    // If not provided, the URL will be determined by the `sandbox` option
    url: 'https://your-custom-url.com',

    // Overrides some default endpoints (optional)
    // Each key should be the name of an endpoint, and the value should be the new endpoint
    endpoints: {
        getPaymentMethods: '/your-custom-endpoint',
        // ...other endpoints...
    },

    // The UUID of the store for which to retrieve payout statistics (optional)
    storeUuid: 'your-store-uuid',
};

const client = new MontonioClient(options);

Now you can use the client to interact with the Montonio API:

// Get available payment methods
const paymentMethods = await client.getPaymentMethods();

// Create an order
const orderData = {
// ...your order data...
};
const paymentUrl = await client.createOrder(orderData);

// ...and more!

API

The client provides the following methods:

  • getPaymentMethods(): Get available payment methods.
  • createOrder(orderData): Create an order in Montonio.
  • getOrder(orderUuid): Get an order's details.
  • isOrderPaid(orderToken): Check if an order is paid.
  • createRefund(orderUuid, amount): Create a refund for an order.
  • listPayments(input): List payments.
  • exportPayments(payoutUuid, payoutType): Export payments.
  • getStoreBalances(): Get store balances.

Each method returns a Promise that resolves with the response data from the Montonio API.

Error Handling

The client includes built-in error handling. If an API request fails, the client will throw an error that you can catch and handle in your code.

Contributing

Contributions are welcome! Please submit a pull request or create an issue to get started.

License

MIT License

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.