The Efty Pay PHP SDK for Efty Pay; Efty's online transaction service designed to ensure secure and transparent buying and selling of domain names. It acts as a trusted intermediary to safeguard both the buyer and seller's interests during the transaction process.
The Efty Pay production URLs:
- SDK use (over gRPC): api.eftypay.com:443
- API use (over REST): https://api.eftypay.com
- PHP 7.0 or higher
- PECL
- Composer
- Efty Pay API access credentials; please contact ask@efty.com to obtain early access.
Under the hood the Efty Pay PHP SDK uses gRPC & Protobuf. If not enabled yet, you'll need to install & enable these extensions on your server.
sudo pecl install grpc
After you install the gRPC extension, make sure to to enable the extension in your php.ini
file:
extension=grpc.so
For detailed instructions, visit the official gRPC PHP readme.
You can include the SDK from our public GitHub repository by adding it to your composer.json
.
Open your composer.json
file in your preferred text editor and add in the below:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/eftybv/efty-pay-php-sdk"
}
],
"require": {
"eftybv/efty-pay-php-sdk": "v1.0.0"
}
}
Once you’ve added the SDK, run the following command to install it and update your dependencies:
composer update
Composer automatically handles autoloading for you. Make sure to include the Composer autoloader in your PHP script:
require 'vendor/autoload.php';
The methods in the SDK require you to pass an auth token in that contains a JWT. Our Efty Pay PHP Quickstart repository contains sample code for howto generate the token and pass it into the request. In summary the following is required (this uses an external library for JWT generation):
Token generation:
use Firebase\JWT\JWT;
use Firebase\JWT\Key;
function generateToken()
{
$apiKey = "YOUR_API_KEY";
$apiSecret = "YOUR_API_SECRET";
$integratorId = "YOUR_INTEGRATOR_ID";
$payload = [
"iat" => time(),
"sub" => $apiKey,
"exp" => time() + 600,
"type" => 2,
"iid" => $integratorId
];
$token = JWT::encode($payload, $apiSecret, 'HS256');
return $token;
}
Injecting the token in the function context:
$opts = [
"credentials" => \Grpc\ChannelCredentials::createSsl(),
"update_metadata" => function($metaData){
$token = generateToken();
$metaData['authorization'] = [$token];
return $metaData;
},
];
// Define the client for the transactions API, and pass in the options with auth token.
$client = new \Eftypay\Transactions\TransactionsClient("api.eftypay.com:443", $opts);
You can now use the SDK in your project. For our quickstart and examples, please visit our Efty Pay PHP Quickstart repository.
- If you encounter any issues, ensure that the package name is correctly specified.
- You can also specify a version constraint (e.g., "^1.0" or "dev-main") if you need a specific version of the SDK. It's strongly recommended to always use the latest version.
- If you run into any other issues, contact us at ask@efty.com.
The Efty Pay API resource documentation can be found at https://docs.eftypay.com
This project is licensed under the MIT License. See the LICENSE file for details.