saatchiart / affirm-php-sdk
Unofficial Affirm php sdk
Installs: 11 877
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 12
Forks: 3
Open Issues: 2
Requires
- guzzlehttp/guzzle: ^6.3
- leocavalcante/shape: dev-master
Requires (Dev)
- phing/phing: ^2.16
- phpmd/phpmd: ^2.6
- phpstan/phpstan: ^0.9.1
- phpunit/phpunit: ^6.5.2
- squizlabs/php_codesniffer: ^3.1
This package is auto-updated.
Last update: 2024-11-16 11:06:12 UTC
README
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);