Download the PHP package yedpay/php-library without Composer

On this page you can find all versions of the php package yedpay/php-library. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-library

Build Status Coverage Status Latest Stable Version composer.lock

Yedpay Transaction PHP Library

Description

A PHP library for Precreate Transactions and Online Payments Using the Yedpay API

Prerequisites

In order to start using the API, you need to get Your Personal Access Token or API Key.

Installation

Installing Dependencies

composer require yedpay/php-library

Running the test

vendor/bin/phpunit

Integration

Request Method

Parameter Type Description
accessToken String AccessToken used to access API
environment String Environment ( 'staging' or 'production' )
storeId String Store ID in the API
amount Double amount of the transaction
currency Integer transaction currency (1: HKD)
gateway Integer transaction gateway (1: Alipay, 4: Alipay Online)
wallet Integer Alipay wallet type (1: HK, 2: CN)
extraParam JSON (Optional) Extra information of the transaction
notify_url Url (Optional) Notify Url of the transaction
return_url Url (Optional) Return Url of the transaction
Parameter Type Description
apiKey String Api Key used to access API
environment String Environment ( 'staging' or 'production' )
customId String Custom ID in the API
amount Double amount of the transaction
currency Integer transaction currency (1: HKD)
notify_url Url Notify Url of the transaction
return_url Url Return Url of the transaction
gatewayCode String (Optional) transaction gateway code (4_1: Alipay Online WAP, 4_2: Alipay Online PC2Mobile, 8_2: WeChat Pay Online, 9_1: UnionPay ExpressPay, 9_5: UnionPay UPOP, 12_1: Credit Card Online)
wallet Integer (Optional) Alipay wallet type (1: HK, 2: CN)
subject String (Optional) Product Name of the transaction
expiryTime Integer (Optional) Expiry Time in Seconds of the transaction (Range: 900 - 10800)
metadata Json (Optional) metadata for plugin information
paymentData Json (Optional) Payment Data that will include in the payment page (Card payment only, support first_name, last_name, email, phone, billing_country, billing_city, billing_address1, billing_address2, billing_post_code, billing_state)
checkoutDomainId String (Optional) Checkout domain Key
Parameter Type Description
accessToken String (Required without apiKey) AccessToken used to access API
apiKey String (Required without accessToken) Api Key used to access API
environment String Environment ( staging or production )
transactionId String Transaction ID in the API
reason String (Optional) refund reason of the transaction
Parameter Type Description
apiKey String (Required without accessToken) Api Key used to access API
environment String Environment ( 'staging' or 'production' )
customId String Custom ID in the API
reason String (Optional) refund reason of the transaction
Parameter Type Description
apiKey String (Required without accessToken) Api Key used to access API
environment String Environment ( 'staging' or 'production' )
customId String Custom ID in the API

Result

Parameter Type Description
message string Response message
data string(JSON) Data of the response
Parameter Type Description
message string Response message
errorCode int HTTP standard response code
error string Detail of the error

Input parameters

//mandatory parameters
$accessToken = 'J84OFPAN';
$storeId = '8X4LZW2XLG9V';
$amount = 1.0;
//optional parameter: extraParam (JSON)
$extraParam = json_encode([
    'customer_name' => 'Yed Pay',
    'phone' => '12345678',
]);

Create instance of Client

$client = new Client(Library::STAGING, $accessToken);

(Optional) Setting Transaction parameters

//changing transaction currency (default: HKD)
$client->setCurrency(Client::INDEX_CURRENCY_HKD);
//changing alipay wallet type (default: HK)
$client->setWallet(Client::INDEX_WALLET_CN);

Sending Precreate Request

// general 
$client->precreate($storeId, $amount);
// with extra parameters
$result = $client->precreate(
        $storeId, 
        $amount, 
        json_encode($extraParam)
)->getData();

Input parameters

//mandatory parameters
$apiKey = 'qPOcLJsNnnI2wzJdIsRULOwC//KZa+KGrarUIs1ZZa8=';
$customId = 'test-001';
$amount = 1.0;
$currency = 1;
$notifyUrl = 'https://www.example.com/notify';
$returnUrl = 'https://www.example.com/return';

Create instance of Client

$client = new Client(Library::STAGING, $apiKey, false);

(Optional) Setting Transaction parameters

//changing transaction currency (default: HKD)
$client->setCurrency(Client::INDEX_CURRENCY_HKD);

//set transaction gateway code
$client->setGatewayCode(Client::INDEX_GATEWAY_CODE_ALIPAY_ONLINE_PC2MOBILE);

//set transaction gateway wallet type (default: HK)
$client->setWallet(Client::INDEX_WALLET_CN);

//set production name of transaction
$client->setSubject('Product');

//set expiry time of transaction
$client->setExpiryTime(900);

//set metadata of online payment
$metadata = json_encode([
    'woocommerce' => '1.0',
    'yedpay_for_woocommerce' => '1.0',
    'wordpress' => '1.0',
]);
$client->setMetadata($metadata);

//set payment data of online payment
$paymentData = json_encode([
    'first_name' => 'Yedpay',
    'last_name' => 'Yedpay',
    'email' => '[email protected]',
    'phone' => '12345678',
    'billing_country' => 'HK',
    'billing_city' => 'Hong Kong',
    'billing_address1' => 'Address1',
    'billing_address2' => 'Address2',
    'billing_post_code' => '000000',
]);
$client->setPaymentData($paymentData);

//set checkout domain key of online payment
$client->setCheckoutDomainId('J84OFPAN');

Sending Online Payment Request

$client->onlinePayment($customId, $amount)->getData();

Input parameters

//mandatory parameters
$transactionId = 'J84OFPAN';
//optional parameter: reason (String)
$reason = 'testing';

Create instance of Client

// with accessToken
$client = new Client(Library::STAGING, $accessToken);
// with apiKey
$client = new Client(Library::STAGING, $apiKey, false);

Sending Refund Request

// general 
$client->refund($transactionId)->getData();
// with reason
$client->refund($transactionId, $reason)->getData();
// with amount
$client->refund($transactionId, $reason, $amount)->getData();

Input parameters

//mandatory parameters
$customId = 'J84OFPAN';
//optional parameter: reason (String)
$reason = 'testing';

Create instance of Client

// with apiKey
$client = new Client(Library::STAGING, $apiKey, false);

Sending Refund by Custom ID Request

// general 
$client->refundByCustomId($customId)->getData();
// with reason
$client->refundByCustomId($customId, $reason)->getData();
// with amount
$client->refundByCustomId($customId, $reason, $amount)->getData();

For the complete Code Check the examples folder


All versions of php-library with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package yedpay/php-library contains the following files

Loading the files please wait ....