Coder Social home page Coder Social logo

bradroberts / chargify-sdk-php Goto Github PK

View Code? Open in Web Editor NEW

This project forked from crucialwebstudio/chargify-sdk-php

0.0 2.0 0.0 137 KB

Chargify SDK for PHP

Home Page: http://www.chargely.com

License: Apache License 2.0

Makefile 0.42% PHP 99.58%

chargify-sdk-php's Introduction

Chargify SDK for PHP

Total Downloads Build Status Latest Stable Version Apache 2 License Documentation Status

This library helps you interact with the Chargify API using PHP. It has been used in production for many years by our flagship product, Chargley, a billing portal for Chargify.

  • Abstracts away underlying HTTP requests to the Chargify API
  • Supports Chargify API v1 and Chargify Direct (v2)
  • Well documented
  • Unit tested

Installation

Using Composer is the recommended way to install the Chargify SDK for PHP. Composer is a dependency management tool for PHP that allows you to declare the dependencies your project needs and installs them into your project. In order to use the SDK with Composer, you must do the following:

  1. Install Composer, if you don't already have it:

    curl -sS https://getcomposer.org/installer | php
  2. Run the Composer command to install the latest stable version of the SDK:

    php composer.phar require chargely/chargify-sdk-php
  3. Require Composer's autoloader:

    <?php
    require '/path/to/vendor/autoload.php';

Quick Example

Create a new customer.

<?php
require 'vendor/autoload.php';

use Crucial\Service\Chargify;

$chargify = new Chargify([
    'hostname'   => 'yoursubdomain.chargify.com',
    'api_key'    => '{{API_KEY}}',
    'shared_key' => '{{SHARED_KEY}}'
]);

// Crucial\Service\Chargify\Customer
$customer = $chargify->customer()
    // set customer properties
    ->setFirstName('Dan')
    ->setLastName('Bowen')
    ->setEmail('[email protected]')
    // send the create request
    ->create();

// check for errors
if ($customer->isError()) {
    // array of errors loaded during the transfer
    $errors = $customer->getErrors();
 } else {
    // the transfer was successful
    $customerId = $customer['id']; // Chargify customer ID
    $firstName  = $customer['first_name'];
    $lastName   = $customer['last_name'];
    $email      = $customer['email'];
 }

Help and Documentation

Contributing

Please see CONTRIBUTING.md for more information.

chargify-sdk-php's People

Watchers

 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.