PHP code example of aef / payfort

1. Go to this page and download the library: Download aef/payfort 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/ */

    

aef / payfort example snippets


return Payfort::purchase([
            'merchant_reference' => 'XYZ9239',
            'order_description' => 'order',
            'token_name' => "88cd5220-9584-460d-bb2d-0806f93066c1",
            'amount' => 450,
            'customer_email' => '[email protected]',
]);

return Payfort::authorize([
            'merchant_reference' => 'XYZ9239',
            'order_description' => 'order',
            'token_name' => "88cd5220-9584-460d-bb2d-0806f93066c1",
            'amount' => 450,
            'customer_email' => '[email protected]',
]); 

return Payfort::payment([
            'merchant_reference' => 'XYZ9239',
            'order_description' => 'order',
            'token_name' => "88cd5220-9584-460d-bb2d-0806f93066c1",
            'amount' => 450,
            'customer_email' => '[email protected]',
            'recurring_mode' => 'VARIABLE',
            'recurring_transactions_count' => 10,
]); 

return Payfort::tokenization([
            'merchant_reference' => 'XYZ9239',
            'order_description' => 'order',
            'token_name' => '88cd5220-9584-460d-bb2d-0806f93066c1',
            'customer_email' => '[email protected]',
            'card_number' => 4005550000000001,
            'expiry_date' => 2105,
            'card_security_code' => 123,
            'card_holder_name' => 'testcard',
]); 

return Payfort::applePay([
            'merchant_reference' => 'XYZ9239',
            'order_description' => 'order',
            'token_name' => '88cd5220-9584-460d-bb2d-0806f93066c1',
            'amount' => 450,
            'customer_email' => '[email protected]',
            'apple_data' => 'paymentData.data',
            'apple_signature' => 'paymentData.signature',
            'customer_ip' => '192.168.1.1',
            'phone_number' => '0123456789',
            'apple_header' => [
                  'apple_transactionId' => 'paymentData.header.transactionId',
                  'apple_ephemeralPublicKey' =>'paymentData.header.ephemeralPublicKey',
                  'apple_publicKeyHash' =>'paymentData.header.publicKeyHash'
                ],
            'apple_paymentMethod' => [
                  'apple_displayName' => 'paymentMethod.displayName',
                  'apple_network' => 'paymentMethod.network',
                  'apple_type' => 'paymentMethod.type'
                ]
]); 
bash
    php artisan vendor:publish --provider "Payfort\Providers\PayfortServiceProvider"