apiKey() public method

Current API key
public apiKey ( ) : string
return string API key
 /**
  * Add new payment into database
  * 
  * @author coeus solutions
  * @param array $data the data from REST Client
  * @return \Zend\View\Model\JsonModel 
  */
 public function create($data = array())
 {
     try {
         $exist = $this->getService()->checkAlreadySubscribed($data['customer_id']);
         if (!$exist) {
             \Recurly_Client::$subdomain = 'incoverage123';
             \Recurly_Client::$apiKey = '1087e99b0df34eb4835412e55217dc6f';
             $account_code = uniqid();
             // Subscription
             $subscription = new \Recurly_Subscription();
             $subscription->plan_code = 'basic';
             $subscription->currency = 'USD';
             $account = new \Recurly_Account();
             //$subscription->account->account_code = 'john_rambo';
             $account->account_code = $account_code;
             $account->first_name = $data['first_name'];
             $account->last_name = $data['last_name'];
             $account->email = '*****@*****.**';
             $account->address->city = $data['city'];
             $account->address->state = $data['state'];
             $account->address->country = $data['country'];
             $account->address->zip = $data['postal_code'];
             $account->address->address1 = $data['address1'];
             $account->create();
             // Billing Infos
             $billing_info = new \Recurly_BillingInfo();
             $billing_info->account_code = $account_code;
             //$billing_info->first_name = $data['first_name'];
             //$billing_info->last_name = $data['last_name'];
             //$billing_info->number = $data['number'];
             //$billing_info->verification_value = '123';
             //$billing_info->month = $data['month'];
             //$billing_info->year = $data['year'];
             $billing_info->token_id = $data['token'];
             $account->billing_info = $billing_info;
             $subscription->account = $account;
             $subscription->create();
             $info = array('customerId' => $data['customer_id'], 'accountCode' => $account_code, 'planCode' => 'basic');
             $this->getService()->addPayment($info);
             /*// Adjustments
               $charge = new \Recurly_Adjustment();
               $charge->account_code = $account_code;
               $charge->description = 'Charge for extra bandwidth';
               $charge->unit_amount_in_cents = 5000; // $50.00
               $charge->currency = 'USD';
               $charge->quantity = 1;
               $charge->accounting_code = 'bandwidth';
               $charge->tax_exempt = false;
               $charge->create();*/
             //$billing_info->create();
         } else {
             $error = 'Already subscribed.';
         }
     } catch (\Recurly_NotFoundError $e) {
         $error = $e->getMessage();
     } catch (\Recurly_ValidationError $e) {
         // If there are multiple errors, they are comma delimited:
         //$messages = explode(',', $e->getMessage());
         //print 'Validation problems: ' . implode("\n", $messages);
         $error = $e->getMessage();
     } catch (\Recurly_ServerError $e) {
         $error = $e->getMessage();
     } catch (Exception $e) {
         // Assign the error message and use it to handle any customer
         // messages or logging
         $error = $e->getMessage();
     }
     if (isset($error)) {
         $result['data']['status'] = false;
         $result['data']['error'] = $error;
     } else {
         $result['data']['status'] = true;
     }
     return new JsonModel($result);
 }
Exemplo n.º 2
0
 * billing cycle set "include_monthly" to false.
 *
 * this system does require that you define database configuration here
 *
 * This runs outside of CI and Wordpress to mitigate conflicts with the cron on Rackspace Cloud
 * this utility is meant to be run from the OS php cron not from an HTTP cron.
 *
 * @magicandmight
 */
if (!defined('__DIR__')) {
    define('__DIR__', dirname(__FILE__));
}
include_once __DIR__ . '/_siteconfig.php';
include_once __DIR__ . '/lib/recurly.php';
Recurly_Client::$subdomain = RECURLY_SUBDOMAIN;
Recurly_Client::$apiKey = RECURLY_API_PASSWORD;
// database configuration
$con = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if (!$con) {
    die('Could not connect: ' . mysql_error());
}
mysql_select_db(DB_NAME, $con);
// invoicing configuration
$include_monthly = TRUE;
$no_charges = "";
$charges = "";
$msg = "";
// begin routine
error_log("Starting Daily Invoice Routine", 0);
$sql = "select * from subscription_sync;";
$results = mysql_query($sql);
Exemplo n.º 3
0
Arquivo: aaa.php Projeto: ram-1501/rs
<?php

// echo phpversion();
// echo "<br>";
// header('Content-Type: text/plain');
// require_once('settings.inc');
require_once 'modules/api_handler.inc';
require_once 'modules/GoogleAPI.php';
require_once 'twitteroauth/twitteroauth.php';
require_once 'twitteroauth/config.php';
require_once dirname(__DIR__) . '/vendor/recurly_lib/recurly.php';
require_once 'modules/simple_html_dom.php';
Recurly_Client::$subdomain = RECURLY_SUB_DOMAIN;
Recurly_Client::$apiKey = RECURLY_API_KEY;
$api = new ApiHandler();
// Try to setup our session
// Utilities::eClincherSetupUserSession();
// For analytics/backtracing
$bt = debug_backtrace();
$log_response_to_ec_error_handler = false;
array_shift($bt);
$ajax_time_started = microtime(TRUE);
$ajax_label = 'Unknown';
if ($log_response_to_ec_error_handler) {
    ob_start();
}
// Detect and respond to our users that we're in maintenance mode > 1
if (ECConfig::get('MAINTENANCE_MODE') > 1) {
    // echo "Reload page";
    echo file_get_contents(ROOT_PATH . '/web/maintenance.html');
    exit;
<?php

Autoloader::map(array('Recurly' => __DIR__ . '/lib/recurly.php'));
// include
require_once __DIR__ . '/lib/recurly.php';
// load config
$config = Config::get('recurly');
Recurly_Client::$apiKey = $config['api_key'];
if (isset($config['private_key'])) {
    Recurly_js::$privateKey = $config['private_key'];
}