PHP

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

Για να χρησιμοποιήσετε το PHP SDK στην εφαρμογή σας, κατεβάστε το SDK και μεταβείτε στην πηγή από τον κατάλογο lib. Για παράδειγμα:

require_once 'Simplify.php'

Εξαρτήσεις

Το PHP SDK απαιτεί γλώσσα PHP >= 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.

Παραδείγματα

Χρέωση κάρτας

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