Git Product home page Git Product logo

solidus_stripe_sources's Introduction

SolidusStripeSources

solidus_stripe_sources is an extension that adds support for Stripe Sources for Solidus. It supports SEPA Direct Debit, Alipay, Sofort, Giropay, iDEAL, P24.

Supported payment methods

  • Sofort

Supported Soludus Version

  • 2.2.x

other version of Solouds might work as well, but not guarantied.

Note: for now, payments are finished only by webhook, admin can't finish payments from admin interface.

Installation

Add solidus_stripe_sources to your Gemfile:

gem 'solidus_stripe_sources', github: 'denkungsart/solidus_stripe_sources', branch: :master

Bundle your dependencies and run the installation generator:

bundle
bundle exec rails g solidus_stripe_sources:install

Usage

Note:

  • Stripe Sources webhook-based payment methods, it expects to get webhook from Stripe to process payments.
  • Stripe uses secret and publishable_key for differ live from test, no additional test flag is needed.

Setup Payment Method in admin interface: admin_ui

Setup webhooks in Stripe dashboard.

License

The gem is available as open source under the terms of the MIT License.

solidus_stripe_sources's People

Contributors

shiroginne avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

solidus_stripe_sources's Issues

Complete payment only after coming back from sofort

Right now, if a user cancels from sofort, the whole order is canceled. That means the user already received an order confirmation, and will then receive another email with an order cancellation. That's a bad process for the user. Better would be:

  • User goes to sofort, enters his data, and order is confirmed after he is redirected back. (that means emails only go out if user actually sucessfully enters data on sofort)
  • If user cancels he is just redirected back to the confirm page.

We tried to implement this by introducing a before_action in CheckoutController:

## checkout_controller_decorator.rb
Spree::CheckoutController.class_eval do
  before_action :redirect_or_complete_order, only: :update

  def confirm_stripe_order
    params[:state] = "complete"
    update
  end

  private
    def redirect_or_complete_order
      if params[:state] == "confirm"
        if update_order
          if @order.payments.any? { |pt| pt.source&.redirect? }
            redirect_to solidus_stripe_sources.redirect_path(@order.number)
          end
        end
      end
    end
end

## routes.rb
Spree::Core::Engine.routes.draw do
  get '/checkout/confirm_stripe_order', to: 'checkout#confirm_stripe_order', as: :checkout_confirm_stripe_order
end

This is already pretty hacky, and it didn't work because redirect is only possible after payment is authorized, which happens when user confirms the order (in normal solidus flow). That'd mean we'd have to change the process even more, which is why we stopped doing this.

Still, long-term it makes sense to adjust this, but would take a major rewrite.

Add German translation

Add german translation for templates.
Add proper text for _sofort_description template.

Show proper flash message

When user is returned from Stripe, and returns to the order's view, we aren't show no flash messages.
Add proper flash messages depending on current state of payment:

  • pending
  • in progress
  • completed / failed

Add more complex test

For now only unit tests available, add complex tests (features, mock stripe notifications etc.)
TODO:

  • to test webhooks

Limit SOFORT only 5 countries

SOFORT only works in 5 countries, do not show it for users from other countries.
Available countries:

  • Austria
  • Belgium
  • Germany
  • Italy
  • Netherlands
  • Spain

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.