crs / stripe
用于处理支付并管理通过Stripe客户端支付的包
v1.0
2018-03-25 14:56 UTC
Requires
- php: >=5.5.9
- stripe/stripe-php: ^5.8
Requires (Dev)
- symfony/phpunit-bridge: ^3.0
This package is not auto-updated.
Last update: 2024-09-24 16:56:59 UTC
README
该包用于通过Stripe支付网关进行支付和管理客户
目录
安装
安装包
将CRS/SendGridBundle添加到您的composer.json
文件中。
{ "require": { "crs/stripe": "~1.0" } }
在bundle变量中添加路径到appKernel.php中。
$bundles = [
....
....
....
new CRS\StripeBundle\CRSStripeBundle(),
];
替代方法:从命令行安装包
composer require crs/stripe
快速入门
#Stripe API Access
crs_stripe:
publishable_key: "pk_test_key" #add your publishable key here
secret_key: "sk_test_key" #add your secret key here
currency: "USD" #add your currency key here
注意:金额应以分表示,即$1 = 100分。因此,使用100代替$1,使用200代替$2,表示金额 = 金额 * 100
如何使用
创建对象
$stripe = new crs_stripe();
- 直接进行支付
$stripe->setCardNumber(<Your card Number>);
$stripe->setName('<Card holder name>);
$stripe->setExpMonth(<Expiration month>);
$stripe->setExpYear('Expiration Year');
$stripe->setCVC(<CVV number of your card>);
$new_customer = $stripe->Charge()->Pay(<amount> * 100);
- Stripe费用检索
$retrive_charge = $stripe->Charge()->get('ch_key');
- Stripe费用列表
$retrive_charge = $stripe->Charge()->All(<perpage list>);
- 创建Stripe客户
$stripe->setCardNumber(<Your card Number>);
$stripe->setName('<Card holder name>);
$stripe->setExpMonth(<Expiration month>);
$stripe->setExpYear('Expiration Year');
$stripe->setCVC(<CVV number of your card>);
$new_customer = $stripe->Customer()->Create(<Customer email-Id>);
- 检索Stripe客户
$new_customer = $stripe->Customer()->get('cus_key');
- Stripe客户列表
$new_customer = $stripe->Customer()->All(<perpage list>);
- 删除Stripe客户
$new_customer = $stripe->Customer()->Delete('cus_key');