thelhc / auth-net-client
An Authorize.net API client
Installs: 120
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/thelhc/auth-net-client
Requires
- php: ~5.6|~7.0
- guzzlehttp/guzzle: ^6.2
- illuminate/support: 5.1.* || 5.2.* || 5.3.*
- illuminate/view: 5.1.* || 5.2.* || 5.3.*
Requires (Dev)
- orchestra/testbench: ~3.0
- phpunit/phpunit: ^5.4
- vlucas/phpdotenv: ^2.4
This package is not auto-updated.
Last update: 2025-10-20 21:02:57 UTC
README
An Authorize.net API client
Installation
composer require thelhc/auth-net-client
Basic Usage
New Profile
$profile = new Profile([
    'merchant_customer_id' => rand(1000, 10000),
]);
$profile->create()
New Profile with Payment Profile
$profile = new Profile([
    'merchant_customer_id' => rand(1000, 10000),
]);
$paymentProfile = new PaymentProfile([
    'customerType' => 'business',
    'billTo' => [
        'firstName' => 'Aaron',
        'lastName' => 'Kaczmarek',
        'company' => 'WeaselJobs',
        'address' => '747 Main St',
        'city' => 'Westbrook',
        'state' => 'ME',
        'zip' => '04092',
        'phoneNumber' => '828-301-9460'
    ],
    'payment' => [
        'creditCard' => [
            'cardNumber' => '4007000000027',
            'expirationDate' => '2020-01',
        ]
    ]
]);
$profile->paymentProfiles()->add($paymentProfile);
$profile->create()
Get Profile
$profile = Profile::find("1810689705");
Update Profile
$profile = Profile::find("1810689705");
$attrs = [
    "email" => "aaronkazman@email.com",
    "description" => "aaron test #".rand(1000, 10000)
];
$profile->update($attrs);
Delete Profile
$profile = Profile::find("1810720109");
$profile->delete();
Create Payment Profile
$profile = Profile::find("1810689705");
$paymentProfile = new PaymentProfile([
    'customerType' => 'business',
    'billTo' => [
        'firstName' => 'Aaron',
        'lastName' => 'Kaczmarek',
        'company' => 'WeaselJobs #'.rand(1000, 10000),
        'address' => '747 Main St',
        'city' => 'Westbrook',
        'state' => 'ME',
        'zip' => '04092',
        'phoneNumber' => '828-301-9460'
    ],
    'payment' => [
        'creditCard' => [
            'cardNumber' => '4012888818888',
            'expirationDate' => '202'.rand(1, 9).'0'.rand(1, 9),
        ]
    ]
]);
$profile->paymentProfiles()->save($paymentProfile);
Get Payment Profile
$payment_profile = PaymentProfile::find("1810689705", "1805383335");
or from collection
$profile = Profile::find("1810689705");
$payment_profile = $profile->paymentProfiles()->find("1805383335");
Update Payment Profile
$payment_profile = PaymentProfile::find("1810689705", "1805383335");
$attrs = [
    'billTo' => [
        'company' => 'WeaselJobs update #'.rand(1000, 10000),
    ]
];
$payment_profile->update($attrs);
Delete Payment Profile
$payment_profile = PaymentProfile::find("1810720112", "1805415477");
$payment_profile->delete();
Validate Payment Profile
$payment_profile = PaymentProfile::find("1810689705", "1805383335");
$payment_profile->validate();
Get Payment Profile List
$params = [
    "searchType" => "cardsExpiringInMonth",
    "month" => "2020-01",
    "sorting" => [
        "orderBy" => "id",
        "orderDescending" => "false",
    ],
    "paging" => [
        "limit" => 1000,
        "offset" => 1
    ]
];
$payment_profiles = PaymentProfile::getList($params);
Charge Payment payment_profiles
$payment_profile = PaymentProfile::find("1810689705", "1805383335");
$transaction = $payment_profile->charge("100.00", [
    "order" => [
        "invoiceNumber" => rand(1000, 10000),
        "description" => "Test payment profile charge"
    ]
]);