ADCPD / symfony-stripe-integration

How to accept payments with Stripe in Symfony project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SYMFONY STRIPE INTEGRATION

This repository is a small tutorial which explains how to integrate stripe using Symfony 5 project and how to accept payments with Stripe

CREATE DATABASE IF EXIST
php app/console doctrine:database:create --if-not-exists
php app/console doctrine:schema:update --force
php app/console doctrine:fixtures:load
INSTALL STRIPE composant

STRIPE DASHBOARD DEBUG : https://dashboard.stripe.com/test/logs

composer require stripe/stripe-php

STRIPE DOC : https://stripe.com/docs/payments/accept-a-payment?integration=elements Expose root :

    /**
     * @Route(
     *  "/create-checkout-session", 
     *  name="stripe-create-checkout-session", 
     *  options={"expose"=true},
     *  methods={"GET","POST"} 
     *  )
     */
    public function create(
        StripeService $stripeService
        ): Response
    {
        #your code here
    }

Next you have to generate js Route

bin/console fos:js-routing:dump --format=json --target=public/bundles/js/fos_js_routes.json

MAPPING :

CHECKOUT PROCESS into StripeController and StripeService

CHECKOUT JS PROCESS into checkout.html.twig

About

How to accept payments with Stripe in Symfony project


Languages

Language:PHP 55.4%Language:Twig 18.2%Language:Makefile 17.4%Language:JavaScript 5.7%Language:Shell 3.3%