Home

Awesome

Omnipay: Affirm

Affirm gateway for the Omnipay PHP payment processing library

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements Affirm support for Omnipay.

Install

For Omnipay v3:

Instal the gateway using require. Require the league/omnipay base package and this gateway.

$ composer require league/omnipay eduardlleshi/omnipay-affirm
For Omnipay v2:

Instal the gateway using require. Require the league/omnipay base package and this gateway.

$ composer require league/omnipay:^2.0 eduardlleshi/omnipay-affirm:^2.0

Usage

The following gateways are provided by this package:

For general usage instructions, please see the main Omnipay repository.

Affirm.js

The Affirm integration is fairly straight forward. Essentially you just pass a checkout_token field through to Affirm instead of the regular payment data.

Start by following the guide here: Affirm Direct API

After that you will have a checkout_token field which will be submitted to your server. Simply pass this through to the gateway as transaction_id, instead of the usual options array:

        $transaction_id = $_POST['checkout_token'];

        $response = $gateway->authorize(
            'transaction_id' => $transaction_id,
        ])->send();
        
        $transaction_reference = $response->getTransactionReference();
        
        // you may use $transaction_reference in the upcoming calls.

Support

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.

If you want to keep up to date with release announcements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.

TODO