承接 citizennet/chargify-php-client 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

citizennet/chargify-php-client

Composer 安装命令:

composer require citizennet/chargify-php-client

包简介

Chargify PHP Client

关键字:

README 文档

README

Chargify PHP Client library
Jason Forrest, 2010 (jason.forrest@rigbooks.com)

This is a PHP client for the Chargify API. It allows JSON, XML or internal classes to be used.
All calls will raise an exception on error, so make sure to wrap calls in a try...catch block.
Also, be sure to check out the Wiki for more tips: http://wiki.github.com/jforrest/Chargify-PHP-Client/

Abraham Williams has created a great Getting Started guide for this library, I recommend you check it out
for example usage: http://github.com/abraham/chargify

Example XML usage:

//assumes $subscription_xml contains xml data. This can be from your app, or
//populated from any Chargify Data object (inherits ChargifyBase) by calling the getXML() method. 
//    ex. $subscription_xml = $chargify_subscription->getXML();
$request_format = 'XML';
$api_key = 'YOUR_API_KEY';

$connector = new ChargifyConnector($api_key);

try {
	$new_subscription_xml = $connector->requestCreateSubscription($subscription_xml,$request_format);
} catch (ChargifyValidationException $cve) {
	//process error handling code here.
	echo $cve->getMessage();
}

NOTE: all functions in ChargifyConnector whose names begin with 'retrieve' or 'request' return either 
pure XML or pure JSON, depending on the format of the request.

Example JSON usage:

//assumes $subscription_json contains json data. This can be from your app, or
//populated from any Chargify Data object (inherits ChargifyBase) by calling the getJSON() method.
//    ex. $subscription_json = $chargify_subscription->getJSON();
$request_format = 'JSON';
$api_key = 'YOUR_API_KEY';

$connector = new ChargifyConnector($api_key);

try {
	$new_subscription_json = $connector->requestCreateSubscription($subscription_json,$request_format);
} catch (ChargifyValidationException $cve) {
        //process error handling code here.
        echo $cve->getMessage();
}


Example internal class usage:

// setup connector
$api_key = 'YOUR_API_KEY';
$connector = new ChargifyConnector($api_key);

//Customer creation
$xml_import = null; //this is useful for populating from API response.
$chargify_customer = new ChargifyCustomer($connector, $xml_import);
$chargify_customer->email = "a@b.com";
$chargify_customer->first_name = "Charles";
$chargify_customer->last_name = "Jones";
$chargify_customer->reference = "123b1j23kjb";

try {
	$new_customer = $chargify_customer->create();
} catch (ChargifyValidationException $cve) {
        //process error handling code here.
        echo $cve->getMessage();
}



//Subscription creation
//create customer and credit card first
$chargify_customer = new ChargifyCustomer($connector); //defaults to same as above
$chargify_customer->email = "a@b.com";
$chargify_customer->first_name = "Charles";
$chargify_customer->last_name = "Jones";
$chargify_customer->reference = "123b1j23kjb";

$chargify_card = new ChargifyCreditCard();
$chargify_card->first_name = "Charles";
$chargify_card->last_name = "Jones";
$chargify_card->full_number = '4111111111111111';
$chargify_card->cvv = '123';
$chargify_card->expiration_month = "02";
$chargify_card->expiration_year = "2011";
$chargify_card->billing_address = "123 any st";
$chargify_card->billing_city = "Anytown";
$chargify_card->billing_state = "CA";
$chargify_card->billing_zip = "55555";
$chargify_card->billing_country = 'US';

$chargify_subscription = new ChargifySubscription($connector);
//$chargify_subscription->customer_attributes is required 
//(don't confuse with $chargify_subscription->customer.)
$chargify_subscription->customer_attributes = $chargify_customer;
$chargify_subscription->credit_card_attributes = $chargify_card; //required (See above)
$chargify_subscription->product_handle = "your product handle"; //required or product_id.
$chargify_subscription->coupon_code = "coupon_code"; //optional

try {
	$new_subscription = $chargify_subscription->create();
 } catch (ChargifyValidationException $cve) {
        //process error handling code here.
        echo $cve->getMessage();
}

citizennet/chargify-php-client 适用场景与选型建议

citizennet/chargify-php-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.06k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2013 年 04 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 citizennet/chargify-php-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 citizennet/chargify-php-client 我们能提供哪些服务?
定制开发 / 二次开发

基于 citizennet/chargify-php-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 3.06k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 7
  • Forks: 16
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-04-17