regiosoft/stripe-bundle

一个简单的用于 Stripe API 的 Symfony 扩展包。

安装: 144

依赖者: 0

建议者: 0

安全性: 0

星星: 0

关注者: 1

分支: 2

类型:symfony-bundle

1.3.6 2022-07-29 16:32 UTC

README

一个简单的用于 Stripe Api 的 Symfony 扩展包。

仅支持 SMS/WhatsApp!

设置

步骤 1: 使用 composer 下载 RegiosoftStripeBundle

在 composer.json 中添加 Stripe 扩展包

{
    "require": {
        "regiosoft/stripe-bundle": "^1.0"
    }
}

现在运行以下命令让 composer 下载扩展包

$ php composer.phar update "regiosoft/stripe-bundle"

步骤 2: 启用扩展包

在 kernel 中启用扩展包

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Regiosoft\StripeBundle\RegiosoftStripeBundle()
    );
}

步骤 3: 添加配置

# app/config/config.yml
regiosoft:
        stripe:
            stripe_private_key:    %stripe_private_key%

用法

使用服务

<?php
        $stripeClient = $this->get('stripe_client');
?>

##示例

###创建客户 & 订阅

<?php 
    $customer = $stripeClient->createCustomer($token, $email, $name, $phone);

    // Store customer information

    $subsciption = $stripeClient->createSubscription($customerId, $planId);

    // Store subscription information

?>