0.0.5 • Published 6 years ago

magpie-node v0.0.5

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

Magpie for Node.js

Node.js client for Magpie API.

npm bundle size

Contents

Installation

$ npm install magpie
$ yarn add magpie

Usage

import Magpie from 'magpie-node';

// Retrieve the secret key from your magpie 
// dashboard under developers tab.
const magpie = new Magpie(process.env.SECRET_KEY);

Charges

Create a Charge

magpie.charges.create(payload)

To charge a credit card, you create a charge object. If your API key is in test mode, the supplied card won’t actually be charged, though everything else will occur as if in live mode.

Payload

Refer to Magpie documentation for request body guidelines.

Sample

const payload = {
  amount: 50000,
  currency: 'php',
  source: 'tok_MTQ1ODAyOczNDJkj',
  description: 'Pet food and other supplies',
  statement_descriptor: 'Pet Shop Inc',
  capture: true
}
const charge = await magpie.charges.create(payload);

Success Response

201

Made with :heart: by Jofferson Ramirez Tiquez