PHP code example of relaypay-official / merchant-php-client

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

    

relaypay-official / merchant-php-client example snippets


    


onfigure API key authorization: authorization
$config = RelayPay\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = RelayPay\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new RelayPay\Api\ECommerceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$merchant_id = "merchant_id_example"; // string | merchantID obtained from Relaypay
$order_id = "order_id_example"; // string | Your unique reference for this payment. i.e. id of the current shopping cart

try {
    $result = $apiInstance->getMerchantTransaction($merchant_id, $order_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ECommerceApi->getMerchantTransaction: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: authorization
$config = RelayPay\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = RelayPay\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new RelayPay\Api\ECommerceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$merchant_id = "merchant_id_example"; // string | merchantID obtained from Relaypay
$page = 56; // int | Starts from 0
$size = 56; // int | how many records to be returned

try {
    $result = $apiInstance->getMerchantTxs($merchant_id, $page, $size);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ECommerceApi->getMerchantTxs: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: sign
$config = RelayPay\Configuration::getDefaultConfiguration()->setApiKey('Sign', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = RelayPay\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Sign', 'Bearer');

$apiInstance = new RelayPay\Api\ECommerceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$body = new \RelayPay\Model\EcommerceIncomingRequest(); // \RelayPay\Model\EcommerceIncomingRequest | 

try {
    $result = $apiInstance->setEcommerceRequest($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ECommerceApi->setEcommerceRequest: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: sign
$config = RelayPay\Configuration::getDefaultConfiguration()->setApiKey('Sign', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = RelayPay\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Sign', 'Bearer');

$apiInstance = new RelayPay\Api\ECommerceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$body = new \RelayPay\Model\MerchantSalesforcePlugin(); // \RelayPay\Model\MerchantSalesforcePlugin | 

try {
    $apiInstance->setEcommerceSalesforce($body);
} catch (Exception $e) {
    echo 'Exception when calling ECommerceApi->setEcommerceSalesforce: ', $e->getMessage(), PHP_EOL;
}

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/relaypay-public/merchant-php-client.git"
    }
  ],
  "