1. Go to this page and download the library: Download avro/stripe-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Avro\StripeBundle\AvroStripeBundle(),
);
}
php
namespace Application\UserBundle\Document;
use FOS\UserBundle\Document\User as BaseUser;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
/**
* @ODM\Document
*/
class User extends BaseUser
{
/**
* @ODM\Id(strategy="auto")
*/
protected $id;
/**
* @ODM\String
*/
protected $stripeCustomerId;
/**
* @ODM\Boolean
*/
protected $isStripeCustomerActive;
/**
* @ODM\String
*/
protected $stripeAccessToken;
/**
* @ODM\String
*/
protected $stripePublishableKey;
/**
* @ODM\ReferenceOne(targetDocument="Avro\StripeBundle\Document\Plan")
*/
protected $plan;
public function __construct()
{
parent::__construct();
// your own logic
}
public function getStripeAccessToken()
{
return $this->stripeAccessToken;
}
public function setStripeAccessToken($stripeAccessToken)
{
$this->stripeAccessToken = $stripeAccessToken;
return $this;
}
public function getStripePublishableKey()
{
return $this->stripePublishableKey;
}
public function setStripePublishableKey($stripePublishableKey)
{
$this->stripePublishableKey = $stripePublishableKey;
return $this;
}
public function getStripePublishableKey()
{
return $this->stripePublishableKey;
}
public function setStripePublishableKey($stripePublishableKey)
{
$this->stripePublishableKey = $stripePublishableKey;
return $this;
}
public function getStripeCustomerId()
{
return $this->stripeCustomerId;
}
public function setStripeCustomerId($stripeCustomerId)
{
$this->stripeCustomerId = $stripeCustomerId;
return $this;
}
public function getIsStripeCustomerActive()
{
return $this->isStripeCustomerActive;
}
public function setIsStripeCustomerActive($isStripeCustomerActive)
{
$this->isStripeCustomerActive = $isStripeCustomerActive;
return $this;
}
public function getPlan()
{
return $this->plan;
}
public function setPlan(\Avro\StripeBundle\Document\Plan $plan)
{
$this->plan = $plan;
return $this;
}
/**
* Get user information to prefill stripe signup form
*/
public function getStripeConnectionParameters()
{
return array(
'stripe_user[email]' => $user->getEmail() ?: '',
//'stripe_user[url]' => $user->getWebsite() ?: '',
//'stripe_user[phone_number]' => $user->getPhone() ?: '',
//'stripe_user[business_name]' => $user->getCompany() ?: '',
//'stripe_user[first_name]' => $user->getFirstName() ?: '',
//'stripe_user[last_name]' => $user->getLastName() ?: '',
//'stripe_user[street_address]' => $user->getAddress() ?: '',
//'stripe_user[city]' => $user->getCity() ? $user->getCity()->getName() : '',
//'stripe_user[state]' => $user->getProvince() ? $user->getProvince()->getName() : '',
//'stripe_user[country]' => $user->getCountry() ? $user->getCountry()->getName() : '',
//'stripe_user[zip]' => $user->getPostalCode() ?: '',
);
}
}
php
namespace Application\StripeBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class ApplicationStripeBundle extends Bundle
{
public function getParent()
{
return 'AvroStripeBundle';
}
}
php
//Application/StripeBundle/Document/Plan
namespace Application\StripeBundle\Document;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
use Symfony\Component\Validator\Constraints as Assert;
use Avro\StripeBundle\Document\Plan as BasePlan;
/**
* @ODM\Document
*/
class Plan extends BasePlan
{
/**
* @ODM\Id(strategy="none")
*/
public $id;
// customize to your needs, not
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.