polidog/payjp-bundle

1.0.3 2022-03-07 04:08 UTC

This package is auto-updated.

Last update: 2024-09-07 09:24:23 UTC


README

SymfonyBundle 是用于 PHP 的 PAY.JP 扩展。

要求

PHP7.1+

安装

composer req polidog/payjp-bundle

配置

// AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new Polidog\PayjpBundle\PolidogPayjpBundle(),
        // ...
    );
}
// app/config/polidog_payjp.yaml

polidog_payjp:
    public_key: <your public key>
    secret_key: <your secret_key>

使用

<?php

namespace App\Command;


use Polidog\PayjpBundle\Payjp;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class CustomerShowCommand extends Command
{
    /**
     * @var Payjp
     */
    private $payjp;

    public function __construct(Payjp $payjp)
    {
        $this->payjp = $payjp;
        parent::__construct(null);
    }

    protected function configure()
    {
        $this->setName('app:customer:retrieve');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $result = $this->payjp->customer->retrieve('cus_141a8ff031230845375b8181293f');
        var_dump($result);
    }


}