Download the PHP package c975l/payment-bundle without Composer
On this page you can find all versions of the php package c975l/payment-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package payment-bundle
PaymentBundle
PaymentBundle does the following:
- Defines form to request payment,
- Stores the transaction in a database table with a unique order id,
- Allows the possibility to add buttons/links for pre-defined payment,
- Allows to define a free amount form for payment (Donation, Consultation, etc.),
- Sends an email, to the user, of the transaction via c975LEmailBundle as
c975LEmailBundle
provides the possibility to save emails in a database, there is an option to NOT do so via this Bundle, - Sends an email, to the site, containing same information as above + fee and estimated income,
- Creates flash to inform user,
- Display information about payment after transaction.
This Bundle relies on the use of Stripe and its PHP Library. So you MUST have a Stripe account. It is also recomended to use this with a SSL certificat to reassure the user.
PaymentBundle dedicated web page.
PaymentBundle API documentation.
Bundle installation
Step 1: Download the Bundle
v3.x works with Symfony 4.x. Use v2.x for Symfony 3.x Use Composer to install the library
Step 2: Configure the Bundle
Check dependencies for their configuration:
c975LPaymentBundle uses c975L/ConfigBundle to manage configuration parameters. Use the Route "/payment/config" with the proper user role to modify them.
Step 3: Enable the Routes
Then, enable the routes by adding them to the /config/routes.yaml
file of your project:
Step 4: Create MySql table
You can use php bin/console make:migration
to create the migration file as documented in Symfony's Doctrine docs OR use /Resources/sql/payment.sql
to create the tables stripe_payment
. The DROP TABLE
is commented to avoid dropping by mistake.
Step 5: copy images to web folder
Install images by running
It will copy content of folder Resources/public/images/
to your web folder. They are used to be displayed on the payment form.
You can also have a look at official badges from Stripe.
How to use
The process is the following:
- User selects a product,
- User clicks to pay,
- Payment is created in DB,
- User is redirected to Payment form,
- User pays,
- User is redirected to returnRoute,
- Actions are executed to deliver product (if payment successful or sends an error),
- User is redirected to final confirmation or delivery product page.
To achieve this, you have to define 2 Controller Routes and 2 Services methods (+ Interface) (while you can do all of this in Controller, Best Practices recommend to keep Controller methods skinny).
Here are the examples for those files:
Use the testing cards to test before going to production.
Merchant's data
You need to override the template fragments/merchantData.html.twig
in your /templates/bundles/c975LPaymentBundle/fragments/merchantData.html.twig
and indicate there all your official data, such as address, VAT number, etc.
This template will be included in the email sent to the user after its payment.
Mention payment system
You can mention the payment system used (i.e. in the footer) by simply include an html fragment with the following code {% include '@c975LPayment/fragments/paymentSystem.html.twig' %}
. This will include Stripe logo and accepted cards.
Use payment buttons/links
You can add any payment button/link, wherever you want, by using the Twig extensions with the following code:
AMOUNT
is the real amount (i.e. 12.92), NOT the amount in cents.
Or you can use it empty, this will lead user fo fill a form to proceed to payment
If this project help you to reduce time to develop, you can sponsor me via the "Sponsor" button at the top :)
All versions of payment-bundle with dependencies
c975l/config-bundle Version *
c975l/email-bundle Version *
c975l/services-bundle Version *
c975l/toolbar-bundle Version *
doctrine/doctrine-bundle Version *
doctrine/orm Version *
stripe/stripe-php Version *
symfony/form Version *
symfony/security-bundle Version *
symfony/translation Version *
twig/intl-extra Version *