chistel/bluesnap_php

A PHP Library for the Bluesnap api

1.0.0 2020-09-08 23:00 UTC

This package is auto-updated.

Last update: 2025-01-09 19:09:32 UTC


README

This library is a fork from the original author tdanielcox

At the moment, library currently supports:

  • CardTransactions
  • VaultedShoppers
  • Vendors
  • Subscriptions
  • Plans (Subscriptions)
  • Refunds
  • Reports

Installation

Install this package with composer

composer require chistel/bluesnap_php

Usage

Initialize the library in your class constructor

public function __construct()
{
    $environment = 'sandbox'; // or 'production'
    \Chistel\Bluesnap\Bluesnap::init($environment, 'YOUR_API_KEY', 'YOUR_API_PASSWORD');
}

Create a New Transaction

public function createTransaction()
{
    $response = \Chistel\Bluesnap\CardTransaction::create([
        'creditCard' => [
            'cardNumber' => '4263982640269299',
            'expirationMonth' => '02',
            'expirationYear' => '2018',
            'securityCode' => '837'
        ],
        'amount' => 10.00,
        'currency' => 'USD',
        'recurringTransaction' => 'ECOMMERCE',
        'cardTransactionType' => 'AUTH_CAPTURE',
    ]);

    if ($response->failed())
    {
        $error = $response->data;
        
        // handle error
    }

    return $response->data;
}

See examples for further details on using the library

License

This package is licensed under the MIT License