2017 © Pedro Peláez
 

library affirm-php-sdk

Unofficial Affirm php sdk

image

saatchiart/affirm-php-sdk

Unofficial Affirm php sdk

  • Monday, December 4, 2017
  • by mikedfunk
  • Repository
  • 8 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Unofficial Affirm PHP SDK

Affirm API Docs, (*1)

Install:

composer require saatchiart/affirm-php-sdk

Usage:

// get an affirm php sdk instance
$config = [
    'public_api_key' => 'MY_AFFIRM_PUBLIC_API_KEY',
    'private_api_key' => 'MY_AFFIRM_PRIVATE_API_KEY',
    'is_sandbox' => true,
];
$affirm = new \SaatchiArt\Affirm\Api\Client($config);

// authorize an affirm payment by checkout token
/** @var \stdClass $response decoded json from response */
$optionalData = ['order_id' => 'OPTIONAL_ORDER_ID'];
$response = $affirm->authorize('MY_CHECKOUT_TOKEN', $optionalData);

// capture an authorized affirm payment by charge id
$optionalData = [
    'order_id' => 'abc123',
    'shipping_carrier' => 'my carrier',
    'shipping_confirmation' => 'abc123',
];
$response = $affirm->capture('MY_CHARGE_ID', $optionalData);

// read an authorized charge by charge id
$optionalData = [
    'limit' => 123,
    'before' => 'beforeString',
    'after' => 'afterString',
];
$response = $affirm->read('MY_CHARGE_ID', $optionalData);

The Versions