PHP

Our simple, straightforward API gets you up and running quickly.

To use the PHP SDK in your application, download the SDK and access the source from the lib directory. For example:

require_once 'Simplify.php'

Dependencies

The PHP SDK requires >= 5.3

Set your API Key

After logging into your account, your API keys can be located at: Settings -> API Keys

To set your API key do the following set the API_KEY static property on the PaymentsApi class, like so:

Simplify::$publicKey = 'YOUR_PUBLIC_API_KEY';
Simplify::$privateKey = 'YOUR_PRIVATE_API_KEY';

Another option is to pass the api keys as arguments to each API invocation.

Examples

Charging a card

You can charge a card in 2 ways. Once you have generated a card token using simplify.js, you can charge the card using the token. Alternatively, you can also charge a card by passing the card details.

For more information on the simplify.js go to Payments Form

<?php
    require_once("./lib/Simplify.php");

    Simplify::$publicKey = 'YOUR_PUBLIC_API_KEY';
    Simplify::$privateKey = 'YOUR_PRIVATE_API_KEY';

    $token = $_POST['simplifyToken'];

    $payment = Simplify_Payment::createPayment(array(
            'amount' => '1000',
            'token' => $token,
            'description' => 'prod description',
            'currency' => 'USD'
    ));

    if ($payment->paymentStatus == 'APPROVED') {
        echo "Payment approved\n";
    }
?>
<?php
    require_once("./lib/Simplify.php");

    Simplify::$publicKey = 'YOUR_PUBLIC_API_KEY';
    Simplify::$privateKey = 'YOUR_PRIVATE_API_KEY';

    $payment = Simplify_Payment::createPayment(array(
            "card" => array(
                "number" => "5555555555554444",
                "expMonth" => 11,
                "expYear" => 99,
                "cvc" => "123"
            ),
            'amount' => '1000',
            'description' => 'prod description',
            'currency' => 'USD'
    ));

    if ($payment->paymentStatus == 'APPROVED') {
        echo "Payment approved\n";
    }
?>

For more examples see the api documentation or our tutorial