PHP code example of upgradelabs / ifthenpay

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

    

upgradelabs / ifthenpay example snippets


use Ifthenpay;

// Create Multibanco Reference
$response = Ifthenpay::createMultibancoReference([
    'orderId' => 'order-1234',
    'amount' => '123.45',
    'description' => 'Order description',
    'url' => 'https://example.com',
    'expiryDays' => 3,
]);

// Initiate MB WAY payment
$response = Ifthenpay::createMbwayPayment([
    'orderId' => 'order-1234',
    'amount' => '123.45',
    'mobileNumber' => '912345678',
]);

// Check MB WAY payment status
$status = Ifthenpay::getMbwayStatus($response['RequestId']);

// Initialize Credit Card payment
$response = Ifthenpay::initCreditCardPayment([
    'orderId'    => 'order-1234',
    'amount'     => '123.45',
    'successUrl' => 'https://example.com/success',
    'errorUrl'   => 'https://example.com/error',
    'cancelUrl'  => 'https://example.com/cancel',
    'language'   => 'en',
]);

// Create Google Pay payment
$response = Ifthenpay::createGooglePayPayment([
    'id'          => 'order-1234',
    'amount'      => '123.45',
    'description' => 'Order description',
    'lang'        => 'en',
    'expiredate'  => '20250101',
    'btnCloseUrl'    => 'https://example.com/close',
    'btnCloseLabel'  => 'Close',
    'success_url'    => 'https://example.com/success',
    'error_url'      => 'https://example.com/error',
    'cancel_url'     => 'https://example.com/cancel',
]);

// Create Apple Pay payment
$response = Ifthenpay::createApplePayPayment([
    'id'     => 'order-1234',
    'amount' => '123.45',
]);

// Issue a refund
$response = Ifthenpay::refund('request-id-123', '50.00');
bash
php artisan vendor:publish --provider="Upgradelabs\Ifthenpay\IfthenpayServiceProvider" --tag="config"