relaypay-official / merchant-php-client
1.0.3
2023-12-11 10:58 UTC
Requires
- php: >=5.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ~1.12
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ~2.6
README
Relay Pay API documentation. Use api.sandbox.relaypay.io
for Sandbox environment and api.relaypay.io
for production. Some useful links: - Official docs
This PHP package is automatically generated by the Swagger Codegen project:
- API version: 0.0.2
- Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen
Requirements
PHP 5.5 and later
Installation & Usage
Composer
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/relaypay-public/merchant-php-client.git"
}
],
"require": {
"relaypay-public/merchant-php-client": "*@dev"
}
}
Then run composer install
Manual Installation
Download the files and include autoload.php
:
require_once('/path/to/./vendor/autoload.php');
Tests
To run the unit tests:
composer install
./vendor/bin/phpunit
Getting Started
Please follow the installation procedure and then run the following:
<?php require_once(__DIR__ . '/vendor/autoload.php'); // 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 $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; } ?>
Documentation for API Endpoints
All URIs are relative to https://{environment}.relaypay.io
Class | Method | HTTP request | Description |
---|---|---|---|
ECommerceApi | getMerchantTransaction | GET /api/v1/merchant/transaction | Get merchant transaction for a given merchantId by a specified orderId |
ECommerceApi | getMerchantTxs | GET /api/v1/merchant/transaction/history | Get all bill payment transactions for the merchant |
ECommerceApi | setEcommerceRequest | POST /api/v1/ecommerce/request | Ecommerce provider pushes a transaction request. The service returns a unique url to be used for redirection. |
ECommerceApi | setEcommerceSalesforce | POST /api/v1/ecommerce/salesforce | Ecommerce provider pushes a Salesforce specific data for authorisation. |
MerchantSignatureTestingApi | generateSign | POST /api/v1/merchants/generate-sign/{privateKey} | Testing header signature generation. Not to be used in the actual merchant implementation. This method is a convenience for a developer to verify that his sign function generates the same header as we do. |
Documentation For Models
- EcommerceIncomingRequest
- EcommerceMerchantTransaction
- EcommerceResponse
- MerchantSalesforcePlugin
- PageEcommerceMerchantTransaction
- Pageable
- Sort
Documentation For Authorization
authorization
- Type: API key
- API key parameter name: Authorization
- Location: HTTP header
sign
- Type: API key
- API key parameter name: Sign
- Location: HTTP header