Skip to content

Latest commit

 

History

History

raw-example

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Abstract

The gateway available in this repository is meant to provide you an integration with stripe Checkout Server.

In order to achieve this, you will have to follow those steps:

Installation

Composer

composer require combodo/stripe-v3

Note: for now I do not plan to follow BC rules, use semantic versioning or other, so please check if the code is working after each upgrade.

Register the gateway

See the service tagged payum.gateway_factory_builder in the example of conf.

You may also be interested with Payum's doc, or even sylius' doc about payment gateway configuration.

Customization

This gateway handle communication with stripe and changes the payment state.

As every Payum gateways, it can not know the workflow of your store, so it does require you to perform an integration between your store and this gateway:

This may be a little cumbersome, you'll find here how I did integrate this gateway with my Symfony project.

‼️ beware: I tested it on my own highly customized symfony 3.4!

Fulfill Stripe Checkout server requirements

Alas conventional data provided to Payum stripe checkout server require extra data: line_items. You'll have to give them to payum.

Prepare the payment

With stripeV3 you are supposed to have defined items to sell, this is why stripe has introduced a new step where you provide your items to sell.

Theses steps cannot be fully generic because we all have different maners to handle our items (if we even have items).

This is why a mandatory extension is needed where you will prepare your item(s) : The StripeV3PreparePaymentExtension.

Listen to Payum changes of the payment state and trigger your own logic

Once the payment is confirmed, you probably want to trigger a workflow.

💡 When you use Payum, you have to complete the payment detail with hard coded values, my solution was to add an extension (do not forget to tag the service).

Implementation details

This gateway provide one method to retrieve payments

  • a check when the user is redirected after payment

Every implementations should execute a request handleCheckoutCompletedEvent handled by CheckoutCompletedEventAction.

📢 This is very important because as you can see in the extension StripeV3ProcessPaymentExtension, you are supposed to plug your code onto this CheckoutCompletedEventAction.

Redirect after payment

😱 Attention: while being the simpler to implement (and the only one available without extra work), this solution alone is really not sufficient. You must at least complete it with the cron.