PHP code example of imusicjj / quickpay-php-client

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

    

imusicjj / quickpay-php-client example snippets

5

use QuickPay\QuickPay;

try {
    $client = new QuickPay();
} catch (Exception $e) {
    //...
}
5

use QuickPay\QuickPay;

try {
    $api_key = 'xxx';
    $client = new QuickPay(":{$api_key}");
} catch (Exception $e) {
    //...
}
5

use QuickPay\QuickPay;

try {
    $qp_username = 'xxx';
    $qp_password = 'xxx';
    $client = new QuickPay("{$qp_username}:{$qp_password}");
} catch (Exception $e) {
    //...
}
5
// Get all payments
$payments = $client->request->get('/payments');

// Get specific payment
$payments = $client->request->get('/payments/{id}');

// Create payment
$form = array(
    'order_id' => $order_id,
    'currency' => $currency,
    ...
);
$payments = $client->request->post('/payments', $form);
$status = $payments->httpStatus();
if ($status == 201) {
    // Successful created
}

5
$response = $client->request->get('/payments');
$status = $response->httpStatus();

if ($status == 200) {
    // Successful request
}
5
// Get the HTTP status code, headers and raw response body.
list($status_code, $headers, $response_body) = $client->request->get('/payments')->asRaw();

// Get the response body as an object
$response_body = $client->request->get('/payments')->asObject();

// Get the response body as an array
$response_body = $client->request->get('/payments')->asArray();

// Example usage
$payments = $client->request->get('/payments')->asArray();

foreach($payments as $payment) {
    //...
}


{
    "  "quickpay/quickpay-php-client": "1.0.*"
    }
}