PHP code example of avify / avify-php-client

1. Go to this page and download the library: Download avify/avify-php-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

avify / avify-php-client example snippets

 

use App\Avify;

$avify = new Avify(
    'sandbox',
    'v1',
    ' ** your api key here ** '
);

$paymentData = [
    "amount" => 500.00, // It must be a float value with a maximum of 2 decimal.
    "currency" => "USD",
    "description" => "Description",
    "orderReference" => "ref-123",
    "card" => [
        "cardHolder" => "John Doe",
        "cardNumber" => "4242424242424242",
        "cvc" => 123,
        "expMonth" => 12,
        "expYear" => 2028
    ],
    "customerId" => "123456789",
    "customer" => [
        "firstName" => "John",
        "lastName" => "Doe",
        "email" => "[email protected]",
        "company" => "Best Company",
        "shippingAddress" => [
            "addressLine1" => "My address line 1",
            "addressLine2" => "My address line 2",
            "country" => "A valid country",
            "state" => "A valid state",
            "district" => "A valid district",
            "city" => "A valid city",
            "postCode" => "10512",
            "geoLat" => 19.087,
            "geoLon" => 10.246,
            "label" => "Work"
        ],
        "billingAddress" => [
            "addressLine1" => "My address line 1",
            "addressLine2" => "My address line 2",
            "country" => "A valid country",
            "state" => "A valid state",
            "district" => "A valid district",
            "city" => "A valid city",
            "postCode" => "10512",
            "geoLat" => 19.087,
            "geoLon" => 10.246,
            "label" => "Work"
        ],
    ],
    "meta" => ["orderId" => "ord-1234"]
];
$storeId = 25;
$checkout = $avify->process_payment($paymentData, $storeId);

// Language and country
$avify->set_locale('es_CR');

// Or you can directly specify the language
$avify->set_locale('es');

 bash
$ composer