nickcheek/privacy-wrapper

PHP Api wrapper for Privacy API

v1.0.1 2020-07-17 19:10 UTC

This package is auto-updated.

Last update: 2024-11-18 04:35:19 UTC


README

Latest Version on Packagist Total Downloads

Just a small PHP API wrapper for privacy.com

Installation

You can install the package via composer:

composer require nickcheek/privacy-wrapper

Usage

// Include the library and then call it

$privacy = new PrivacyWrapper('your-api-code-from-privacy');

var_dump($privacy->User()->enroll($first_name, $last_name, $dob, $street1, $street2 = null, $zipcode, $ssn_last_four, $phone_number = null, $email = null));

//Note: dob should be as an ISO 8601 date, phone should be in E.164 format


//Funding Methods
var_dump($privacy->Funding()->addBank($routingNumber, $accountNumber, $accountName));
var_dump($privacy->Funding()->listFundingSources());
var_dump($privacy->Funding()->listFundingBanks());
var_dump($privacy->Funding()->listFundingCards());

//Card Methods

var_dump($privacy->Card()->createCard($token = '', $type = 'SINGLE_USE',  $spend_limit = 10000, $limit_duration = 'FOREVER', $state = 'OPEN'));
var_dump($privacy->Card()->updateCard($card_token, $memo = null, $state = 'OPEN', $funding_token = '',  $spend_limit = 10000, $spend_limit_duration = 'FOREVER'));
var_dump($privacy->Card()->listCards());

// Note:
// Available Types: SINGLE_USE, MERCHANT_LOCKED, UNLOCKED
// Available Spend Limit Duration: TRANSACTION, MONTHLY, ANNUALLY, FOREVER
// Available State: OPEN, PAUSED

//Simulate Methods (requires sandbox API)
// to use sandbox, pass it through the Service Call, if left blank, it will use the live url.

var_dump($privacy->Simulate('sandbox')->authorize(string $descriptor, int $pan, int $amount));
var_dump($privacy->Simulate('sandbox')->void(string $token, int $amount));
var_dump($privacy->Simulate('sandbox')->clearing(string $token, int $amount));

//return is equivelant of refund
var_dump($privacy->Simulate('sandbox')->return(string $descriptor, int $pan, int $amount));

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email nick@nicholascheek.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.