PHP code example of johannez / chargify

1. Go to this page and download the library: Download johannez/chargify library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

johannez / chargify example snippets



// $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);



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



$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);