crs/stripe

用于处理支付并管理通过Stripe客户端支付的包

安装: 1

依赖项: 0

建议者: 0

安全性: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

v1.0 2018-03-25 14:56 UTC

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

快速入门

将配置添加到您的config.yml文件中

#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();
  1. 直接进行支付
 $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);
  1. Stripe费用检索
 $retrive_charge = $stripe->Charge()->get('ch_key');
  1. Stripe费用列表
 $retrive_charge = $stripe->Charge()->All(<perpage list>);
  1. 创建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>);
  1. 检索Stripe客户
 $new_customer = $stripe->Customer()->get('cus_key');
  1. Stripe客户列表
 $new_customer = $stripe->Customer()->All(<perpage list>);
  1. 删除Stripe客户
 $new_customer = $stripe->Customer()->Delete('cus_key');