GithubHelp home page GithubHelp logo

chargify's Introduction

Chargify API

This library is a fork from the original source johannez/chargify made by @johannez, thanks a lot :D; this provides you with functionality to interact with the Chargify payment platform. It's built according to the Chargify API version 1.

Supported Resources

  • Products
  • Customers
  • Subscriptions
  • Coupons
  • Components
  • Transactions

Roadmap

  • Implement PHPUnit tests for the supported resources.
  • Add more resources from the Chargify API.

Installation

Easiest way would be using Composer and adding this to the composer.json requirement section.

{
  "require": {
    "johannez/chargify": "dev-master"
  }
}

It's PSR-0 compliant, so you can also use your own custom autoloader.

Usage

In general, every resource has a controller and a resource class. The controller is used to send requests to Chargify and the resource classes map the response data.

Only thing you really need is a controller for the resource you want to work with:

<?php
// $type Singular lower-case name of a suported resource
// $domain Unique sub-domain name (https://DOMAIN.chargify.com)
// $api_key API key that you get through your Chargify environment.
$controller = new \Chargify\Controller\Factory::build($type, $domain, $api_key);

For example to get a listing of all products in the system:

<?php

$pc = new \Chargify\Controller\Factory::build('product', YOUR_DOMAIN, YOUR_API_KEY);
$products = $pc->getAll();

Sending data to Chargify is easy as well.

<?php

$data = array(
  'customer' => array(
    'first_name' => 'Joe',
    'last_name' => 'Smith',
    'email' => '[email protected]',
    'organization' => 'Example Corp.',
    'reference' => 'js21',
  )
);

$cc = new \Chargify\Controller\Factory::build('customer', YOUR_DOMAIN, YOUR_API_KEY);
$new_customer = $cc->create($data);

chargify's People

Contributors

johannez avatar frangeris avatar

Watchers

Max Castro avatar Rogelio Morey avatar James Cloos avatar  avatar  avatar

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.