PHPackages                             mothership-ec/cog-mothership-stripe - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. mothership-ec/cog-mothership-stripe

AbandonedLibrary[Payment Processing](/categories/payments)

mothership-ec/cog-mothership-stripe
===================================

Cog module for the Stripe gateway in Mothership

2.0.1(10y ago)05981[3 issues](https://github.com/mothership-ec/cog-mothership-stripe/issues)GPL-3.0+PHPPHP &gt;=5.4.0

Since May 22Pushed 10y ago4 watchersCompare

[ Source](https://github.com/mothership-ec/cog-mothership-stripe)[ Packagist](https://packagist.org/packages/mothership-ec/cog-mothership-stripe)[ Docs](http://mothership.ec)[ RSS](/packages/mothership-ec-cog-mothership-stripe/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelogDependencies (5)Versions (10)Used By (0)

Mothership Stripe
=================

[](#mothership-stripe)

This module provides an integration with the Stripe payment gateway for Mothership, and provides methods for payments and refunds.

Configuration
-------------

[](#configuration)

Installation creates a `stripe.yml` file in the config file. By default, it will look like this:

```
secret-key: sk_test_BQokikJOvBiI2HlWgH4olfQ2
publishable-key: pk_test_6pRNASCoBOKtIshFeQd4XMUh

```

The default values are those provided by the Stripe documentation to ensure usage in test mode. As a result of this, the `use-test-payments` config setting makes no difference to Stripe's functionality, and it should be automatically set to test mode as soon as it is installed. Any attempts to use real cards while in test mode will result in a validation error, so no orders can be created if it goes live without setting the keys for the live environment.

The `secret-key` is a server-side id key for Stripe, and will never be seen by the customer. The `publishable-key` is a client-side id key for Stripe, which appears in the JavaScript used to connect to Stripe.

To set Stripe as your active gateway, update the service container with:

```
$services['gateway'] = function($c) {
    return $c['gateway.collection']->get('stripe');
};
```

API Process
-----------

[](#api-process)

The Stripe gateway never leaves Mothership, and instead uses JavaScript and PHP classes to connect to the API without a redirect being necessary. The process looks like this:

1. When the customer continues to payment, the `Purchase#purchase` controller stores the necessary data in the session, and redirects to `Purchase#cardDetails`.
2. This controller renders a form in the `resources/view/card_details.html.twig` file. While this form uses Symfony to ensure it has the CSRF protection, it is not used for creating the form elements. The reason for this is that Symfony does not support having nameless form elements, but this is required by Stripe's API to stop sensitive data being posted.
3. When the form is submitted, the form data is validated by the `https://js.stripe.com/v2/` file. Any issues with regards to formatting (for instance if the card number is invalid) will display an error message in the `.payment-errors` span.
4. If the form is valid, it creates a `card` object using this data and the billing address data on the order and sends it to Stripe.
5. Stripe returns a single use token for the card and appends a hidden field to the form with the token as the value, and then submits the form.
6. Once the form is submitted, it redirects to the `Purchase#purchaseAction` controller. This called the `purchase` method on the `Gateway` class, and if it catches a `Stripe_CardError`, it redirects to the failure url.
7. The `Gateway::purchase()` method returns an instance of `Stripe_Charge`, which represents the charge made to the card, and the Stripe-generated ID is set as the payment reference in the database. This can then be used to refund the payment using the `Stripe_Charge::refund()` method.

Notes
-----

[](#notes)

- As noted in the API process above, the checkout form does not use Symfony Form to generate the fields. This is because the card data cannot be posted for security reasons. The form fields also have a `data-stripe` attribute. These are not actually used in our implementation of the gateway, as we want to add address details too, but if we wanted to, they allow for a simpler way to grab the form data.
- Stripe accepts payment amounts in the lowest possible currency unit, so instead of submitting £1, we need to submit 100p. This is a little awkward as some currencies, such as Yen, are zero decimal currency and can't be broken down in the same way. The `Gateway` class has a protected property defining all zero decimal currency codes (according to Stripe's documentation). If a currency is not a zero decimal currency, the payment amount is multiplied by 100 and cast to an integer. As far as I'm aware there aren't any currencies that break down differently.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 98.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~108 days

Recently: every ~121 days

Total

6

Last Release

3808d ago

Major Versions

1.0.3 → 2.0.02015-02-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/9c80abec1ec847de90ada27e2239c31f4374ed1d91912493f5415a688c269a78?d=identicon)[thomasjthomasj](/maintainers/thomasjthomasj)

---

Top Contributors

[![thomasjthomasj](https://avatars.githubusercontent.com/u/4520924?v=4)](https://github.com/thomasjthomasj "thomasjthomasj (71 commits)")[![kuiche](https://avatars.githubusercontent.com/u/5089510?v=4)](https://github.com/kuiche "kuiche (1 commits)")

---

Tags

stripecogmothership

### Embed Badge

![Health badge](/badges/mothership-ec-cog-mothership-stripe/health.svg)

```
[![Health](https://phpackages.com/badges/mothership-ec-cog-mothership-stripe/health.svg)](https://phpackages.com/packages/mothership-ec-cog-mothership-stripe)
```

###  Alternatives

[tightenco/nova-stripe

A tool to create a quick Stripe dashboard in your Laravel Nova admin panels

110308.9k](/packages/tightenco-nova-stripe)[jacobbennett/stripe-test-token

Quickly create Stripe test tokens for successful and exceptional Stripe responses.

14654.8k](/packages/jacobbennett-stripe-test-token)[flux-se/payum-stripe

Payum Stripe gateways

29407.5k4](/packages/flux-se-payum-stripe)[payum/stripe

The Payum extension. It provides Stripe payment integration.

22573.1k3](/packages/payum-stripe)[craftcms/commerce-stripe

Stripe integration for Craft Commerce 5.0+

32157.4k3](/packages/craftcms-commerce-stripe)[chronon/stripe

A CakePHP 2.x Stripe Payment Processing Component.

4246.6k](/packages/chronon-stripe)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
