PHPackages                             webdna/commerce-affirm - 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. webdna/commerce-affirm

ActiveCraft-plugin[Payment Processing](/categories/payments)

webdna/commerce-affirm
======================

Affirm integration for Craft Commerce 4+

1.0.5(1y ago)01.4k1proprietaryPHP

Since Nov 2Pushed 1y ago2 watchersCompare

[ Source](https://github.com/webdna/commerce-affirm)[ Packagist](https://packagist.org/packages/webdna/commerce-affirm)[ RSS](/packages/webdna-commerce-affirm/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (11)Used By (0)

[![icon](./src/icon.svg)](./src/icon.svg)

Affirm for Craft Commerce
=========================

[](#affirm-for-craft-commerce)

Requirements
------------

[](#requirements)

This plugin requests Craft 4.x and Craft Commerce 4.x

Installation
------------

[](#installation)

You can install this plugin from the Plugin Store or with Composer.

#### From the Plugin Store

[](#from-the-plugin-store)

Go to the Plugin Store in your project’s Control Panel and search for “Affirm”. Then click on the “Install” button in its modal window.

#### With Composer

[](#with-composer)

Open your terminal and run the following commands:

```
# go to the project directory
cd /path/to/my-project

# tell Composer to load the plugin
composer require webdna/commerce-affirm

# tell Craft to install the plugin
./craft install/plugin commerce-affirm
```

Setup
-----

[](#setup)

To add an Affirm payment gateway, go to Commerce → Settings → Gateways, create a new gateway.

Enter the Public &amp; Private API keys (environmental variable are recommended) and a product key if you have one.

Usage
-----

[](#usage)

On the payment page, use the getPaymentFormHtml method passing in a few parameters.

```
{% set params = {
  cancelUrl: siteUrl('/shop/checkout/payment'),
  confirmationUrl: siteUrl('/shop/checkout/order', {number: cart.number, success:'true'}),
  mode: 'modal',
} %}
{% namespace cart.gateway.handle|commercePaymentFormNamespace %}
	{{ cart.gateway.getPaymentFormHtml(params)|raw }}
{% endnamespace %}
```

### Parameters

[](#parameters)

`automatic` : automatically launches the payment modal otherwise show a button to launch it. (default: 'true')

`cancelUrl` : the url to return to if the process is cancelled. (only used in 'redirect' mode)

`confirmationUrl` : the url to return to on a successful application. (only used in 'redirect' mode)

`mode` : 'modal' or 'redirect' (default: 'modal')

`showStatus` : show the status updates, processing etc. (default: false)

#### Modal callbacks:

[](#modal-callbacks)

`onFail`, `onSuccess`, `onOpen`, `onValidationError`

if you pass in the `onSuccess` callback, you will need to handle setting the token input with the received `e.checkout_token` and submitting the form.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% 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 ~62 days

Recently: every ~92 days

Total

10

Last Release

728d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/af76e3e79806ca4a242a00774c92bc950a956c4ac8d3fa5d545e758e4617599b?d=identicon)[webdna](/maintainers/webdna)

---

Top Contributors

[![samuelbirch](https://avatars.githubusercontent.com/u/13586?v=4)](https://github.com/samuelbirch "samuelbirch (15 commits)")[![dgonzalez360](https://avatars.githubusercontent.com/u/4933377?v=4)](https://github.com/dgonzalez360 "dgonzalez360 (5 commits)")

---

Tags

cmsCraftcraftcmscraft-pluginaffirmcommerce

### Embed Badge

![Health badge](/badges/webdna-commerce-affirm/health.svg)

```
[![Health](https://phpackages.com/badges/webdna-commerce-affirm/health.svg)](https://phpackages.com/packages/webdna-commerce-affirm)
```

PHPackages © 2026

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