Skip to content

Migrating from solidus_gateway

Alberto Vena edited this page Jul 17, 2019 · 1 revision

Migrating from solidus_gateway

If you were previously using solidus_gateway gem you might need some manual steps to get this new gem working.

It's important to know that both gems can live together and there is no need to remove solidus_gateway when installing this gem.

Migration steps are:

  • Install solidus_stripe as described in the README.

  • Run migrations: this one is reponsible for updating all existing payment methods to use the new Stripe payment method type and stop referencing the spree_gateway one. Also, it updates the preferences for Stripe to point to the new method if they were set via legacy database configuration storage.

  • Change static model preferences to use Spree::Gateway::StripeGateway payment method: this is needed only if you use static model preferences. You should have this code somewhere in your app (usually) into an initializer:

    Spree::Config.configure do |config|
      config.static_model_preferences.add(
        Spree::Gateway::StripeGateway,
        'stripe_credentials',
        secret_key: secret_key,
        publishable_key: publishable_key
      )
    end

    This needs to be changed to:

    Spree::Config.configure do |config|
      config.static_model_preferences.add(
        Spree::PaymentMethod::StripeCreditCard,
        'stripe_credentials',
        secret_key: secret_key,
        publishable_key: publishable_key
      )
    end

    Once changes are deployed, check the admin payment method page to be sure it's using the right static configuration.

Clone this wiki locally