IPStripeBundle
This is a symfony bundle that implements payment with Stripe library., (*1)
Requirements
The version 0.1.0
requires that you'll have already installed AsseticBundle., (*2)
Why to use it?
The most important thing you need to know when you choose to use this bundle is that your customer card information are safe.
This means that the sensible information about the client credit card will never touch your servers., (*3)
Installation
Require the bundle
$ composer require iulyanp/IPStripeBundle
Update AppKernel.php
$bundles = [
new IP\StripeBundle\IPStripeBundle(),
];
Add bundle routes to app/config/routing.yml file
ip_stripe:
resource: "@IPStripeBundle/Resources/config/routing.yml"
prefix: /stripe
# parameters.yml
stripe_public_key: 'your_public_stripe_key'
stripe_private_key: 'your_private_stripe_key'
amount: 1000
currency: usd
# config.yml
ip_stripe:
public_key: "%stripe_public_key%"
private_key: "%stripe_private_key%"
amount: "%amount%"
currency: "%currency%"
view_template: "%view_template%"
By default after success the bundle will redirect you to ip_stripe_success
route.
If you want to change this you just need to override the route_success
parameter and set the correct route for you., (*4)
# parameters.yml
route_success: 'ip_stripe_success'
# config.yml
ip_stripe:
route_success: "%route_success%"
By default the success template is set to 'IPStripeBundle:Stripe:success.html.twig'
twig template.
To override it you just need to add success_template
in your parameters.yml
file., (*5)
# parameters.yml
success_template: 'IPStripeBundle:Stripe:success.html.twig'
# config.yml
ip_stripe:
success_template: "%success_template%"
By default the stripe payment form template is set to 'IPStripeBundle:Stripe:charge.html.twig'
twig template.
To override it you just need to add view_template
in your parameters.yml
file., (*6)
# parameters.yml
view_template: 'IPStripeBundle:Stripe:charge.html.twig'
# config.yml
ip_stripe:
view_template: "%view_template%"
Example: Overriding The Default layout.html.twig¶
It is highly recommended that you override the Resources/views/layout.html.twig template so that the pages provided by the IPStripeBundle have a similar look and feel to the rest of your application.
The following Twig template file is an example of a layout file that might be used to override the one provided by the bundle., (*7)
{% extends 'layout.html.twig' %}
{% block title %}My Demo Application{% endblock %}
{% block ip_stripe_content %}
{% include 'your_brand_new_form.html.twig' %}
{% endblock %}