PHPackages                             funnylookinhat/affirm-php - 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. [API Development](/categories/api)
4. /
5. funnylookinhat/affirm-php

ActiveLibrary[API Development](/categories/api)

funnylookinhat/affirm-php
=========================

Affirm PHP Library

2.0.1(11y ago)11.4kMITPHP

Since Mar 19Pushed 11y ago1 watchersCompare

[ Source](https://github.com/funnylookinhat/affirm-php)[ Packagist](https://packagist.org/packages/funnylookinhat/affirm-php)[ Docs](http://github.com/funnylookinhat/affirm-php)[ RSS](/packages/funnylookinhat-affirm-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (7)Used By (0)

affirm-php
==========

[](#affirm-php)

Affirm PHP Library.

Current Version: 2.0.0

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

[](#installation)

You can install affirm-php through composer. Note that the version you request is directly tied to the version of the API it expects ( i.e. 2.x.x is for v2 of the API ). Extremely bleeding edge development is tagged at a prepended 0. - so the bleeding edge for v2 is 0.2.x.x.

```
{
  "require": {
    "funnylookinhat/affirm-php": "0.2.*"
  }
}

```

Usage
-----

[](#usage)

Right now there's only one API-endpoint for Affirm's service offering - charges. Coincidentally, there is only one major interaction class for this library.

Before anything, you have to initialize the library.

```
Affirm\Resource::Init(
	'public-key',
	'private-key',
	'product-key',
	'https://sandbox.affirm.com/api/v2'
);

```

Passing the URL is optional - as the library will default to the live API if nothing else is provided.

### Charge

[](#charge)

All end-points mirror the documented API: ([http://docs.affirm.com/v2/api/charges/)\[http://docs.affirm.com/v2/api/charges/\]](http://docs.affirm.com/v2/api/charges/)%5Bhttp://docs.affirm.com/v2/api/charges/%5D)They return the decoded object that is documented there - in most cases that is a Charge ( or an Event that is appended to the Charge ).

**Get**

```
$affirm_charge = Affirm\Resource::Get(array(
	'id' => "ASDF-HJKL",
));

```

**Create**

```
$affirm_charge = Affirm\Resource::Create(array(
	'checkout_token' => "jibberjabber",
));

```

**Capture**

```
$affirm_charge = Affirm\Resource::Capture(array(
	'id' => "ASDF-HJKL",
	'order_id' => "ASDF-HJKL",
	'shipping_carrier' => "UPS",
	'shipping_confirmation' => "1Z9999999999999999",
));

```

**Void**

```
$affirm_event = Affirm\Resource::Void(array(
	'id' => "ASDF-HJKL",
));

```

**Refund**

```
$affirm_event = Affirm\Resource::Refund(array(
	'id' => "ASDF-HJKL",
	'amount' => 12345,
));

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~9 days

Total

6

Last Release

4031d ago

Major Versions

0.2.0.6 → 2.0.02015-03-20

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/397918?v=4)[David Overcash](/maintainers/funnylookinhat)[@funnylookinhat](https://github.com/funnylookinhat)

---

Top Contributors

[![funnylookinhat](https://avatars.githubusercontent.com/u/397918?v=4)](https://github.com/funnylookinhat "funnylookinhat (10 commits)")

---

Tags

apilibraryaffirm

### Embed Badge

![Health badge](/badges/funnylookinhat-affirm-php/health.svg)

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

###  Alternatives

[gorkalaucirica/hipchat-v2-api-client

Hipchat v2 API client

80223.4k6](/packages/gorkalaucirica-hipchat-v2-api-client)

PHPackages © 2026

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