{"id":36998172,"url":"https://github.com/yedpay/php-library","last_synced_at":"2026-01-13T23:58:23.853Z","repository":{"id":48858313,"uuid":"132400038","full_name":"yedpay/php-library","owner":"yedpay","description":"Agnostic library to integrate Yedpay Api","archived":false,"fork":false,"pushed_at":"2024-01-18T06:25:29.000Z","size":109,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-28T20:46:58.718Z","etag":null,"topics":["alipay","hongkong","payment-gateway","payment-sdk","php-library","unionpay"],"latest_commit_sha":null,"homepage":"https://www.yedpay.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yedpay.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-05-07T03:04:47.000Z","updated_at":"2025-01-10T07:21:13.000Z","dependencies_parsed_at":"2024-01-18T08:08:10.551Z","dependency_job_id":"4fba78e3-6d8b-4f9d-a15d-a51e46310d02","html_url":"https://github.com/yedpay/php-library","commit_stats":{"total_commits":49,"total_committers":7,"mean_commits":7.0,"dds":0.326530612244898,"last_synced_commit":"16e29d5110f8ef07b7611a0efdbb332e7b395813"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/yedpay/php-library","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yedpay%2Fphp-library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yedpay%2Fphp-library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yedpay%2Fphp-library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yedpay%2Fphp-library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yedpay","download_url":"https://codeload.github.com/yedpay/php-library/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yedpay%2Fphp-library/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28406094,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alipay","hongkong","payment-gateway","payment-sdk","php-library","unionpay"],"created_at":"2026-01-13T23:58:23.170Z","updated_at":"2026-01-13T23:58:23.840Z","avatar_url":"https://github.com/yedpay.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.com/yedpay/php-library.svg?branch=master)](https://travis-ci.com/github/yedpay/php-library)\n[![Coverage Status](https://coveralls.io/repos/github/yedpay/php-library/badge.svg?branch=master)](https://coveralls.io/github/yedpay/php-library?branch=master)\n[![Latest Stable Version](https://poser.pugx.org/yedpay/php-library/v/stable)](https://packagist.org/packages/yedpay/php-library)\n[![composer.lock](https://poser.pugx.org/yedpay/php-library/composerlock)](https://packagist.org/packages/yedpay/php-library)\n\n\n# Yedpay Transaction PHP Library\n\n## Description\n\nA PHP library for Precreate Transactions and Online Payments Using the Yedpay API\n\n## Prerequisites\n* [Composer](https://getcomposer.org/)\n* [Docker](https://www.docker.com/)\n* [Yedpay](https://www.yedpay.com/)\n\nIn order to start using the API, you need to get Your Personal Access Token or API Key.\n\n## Installation\n\n### Installing Dependencies\n    composer require yedpay/php-library\n        \n### Running the test\n    vendor/bin/phpunit\n\n## Integration\n\n### Request Method\n\n* Precreate\n\n| Parameter   | Type    | Description                                       |\n| ----------- | ------- | ------------------------------------------------- |\n| accessToken | String  | AccessToken used to access API                    |\n| environment | String  | Environment ( 'staging' or 'production' )         |\n| storeId     | String  | Store ID in the API                               |\n| amount      | Double  | amount of the transaction                         |\n| currency    | Integer | transaction currency (1: HKD)                     |\n| gateway     | Integer | transaction gateway (1: Alipay, 4: Alipay Online) |\n| wallet      | Integer | Alipay wallet type (1: HK, 2: CN)                 |\n| extraParam  | JSON    | (Optional) Extra information of the transaction   |\n| notify_url  | Url     | (Optional) Notify Url of the transaction          |\n| return_url  | Url     | (Optional) Return Url of the transaction          |\n\n* Online Payment\n\n| Parameter        | Type    | Description                                                                                                        |\n| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------ |\n| apiKey           | String  | Api Key used to access API                                                                                         |\n| environment      | String  | Environment ( 'staging' or 'production' )                                                                          |\n| customId         | String  | Custom ID in the API                                                                                               |\n| amount           | Double  | amount of the transaction                                                                                          |\n| currency         | Integer | transaction currency (1: HKD)                                                                                      |\n| notify_url       | Url     | Notify Url of the transaction                                                                                      |\n| return_url       | Url     | Return Url of the transaction                                                                                      |\n| 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) |\n| wallet           | Integer | (Optional) Alipay wallet type (1: HK, 2: CN)                                                                       |\n| subject          | String  | (Optional) Product Name of the transaction                                                                         |\n| expiryTime       | Integer | (Optional) Expiry Time in Seconds of the transaction (Range: 900 - 10800)                                          |\n| metadata         | Json    | (Optional) metadata for plugin information                                                                         |\n| 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`) |\n| checkoutDomainId | String  | (Optional) Checkout domain Key                                                                                     |\n\n* Refund\n\n| Parameter     | Type   | Description                                               |\n| ------------- | ------ | --------------------------------------------------------- |\n| accessToken   | String | (Required without apiKey) AccessToken used to access API  |\n| apiKey        | String | (Required without accessToken) Api Key used to access API |\n| environment   | String | Environment ( `staging` or `production` )                 |\n| transactionId | String | Transaction ID in the API                                 |\n| reason        | String | (Optional) refund reason of the transaction               |\n\n* Refund by Custom ID\n\n| Parameter   | Type   | Description                                               |\n| ----------- | ------ | --------------------------------------------------------- |\n| apiKey      | String | (Required without accessToken) Api Key used to access API |\n| environment | String | Environment ( 'staging' or 'production' )                 |\n| customId    | String | Custom ID in the API                                      |\n| reason      | String | (Optional) refund reason of the transaction               |\n\n* Query Online Payment\n\n| Parameter   | Type   | Description                                               |\n| ----------- | ------ | --------------------------------------------------------- |\n| apiKey      | String | (Required without accessToken) Api Key used to access API |\n| environment | String | Environment ( 'staging' or 'production' )                 |\n| customId    | String | Custom ID in the API                                      |\n\n### Result\n\n* Success\n\n| Parameter | Type         | Description          |\n| --------- | ------------ | -------------------- |\n| message   | string       | Response message     |\n| data      | string(JSON) | Data of the response |\n\n* Error\n\n| Parameter | Type   | Description                 |\n| --------- | ------ | --------------------------- |\n| message   | string | Response message            |\n| errorCode | int    | HTTP standard response code |\n| error     | string | Detail of the error         |\n\n* Example Precreate Transaction Implementation\n\nInput parameters\n    \n    //mandatory parameters\n    $accessToken = 'J84OFPAN';\n    $storeId = '8X4LZW2XLG9V';\n    $amount = 1.0;\n    //optional parameter: extraParam (JSON)\n    $extraParam = json_encode([\n        'customer_name' =\u003e 'Yed Pay',\n        'phone' =\u003e '12345678',\n    ]);\n    \n\nCreate instance of Client\n\n    $client = new Client(Library::STAGING, $accessToken);\n    \n(Optional) Setting Transaction parameters\n\n    //changing transaction currency (default: HKD)\n    $client-\u003esetCurrency(Client::INDEX_CURRENCY_HKD);\n    //changing alipay wallet type (default: HK)\n    $client-\u003esetWallet(Client::INDEX_WALLET_CN);\n    \nSending Precreate Request\n    \n    // general \n    $client-\u003eprecreate($storeId, $amount);\n    // with extra parameters\n    $result = $client-\u003eprecreate(\n            $storeId, \n            $amount, \n            json_encode($extraParam)\n    )-\u003egetData();\n\n* Example Online Payment Implementation\n\nInput parameters\n    \n    //mandatory parameters\n    $apiKey = 'qPOcLJsNnnI2wzJdIsRULOwC//KZa+KGrarUIs1ZZa8=';\n    $customId = 'test-001';\n    $amount = 1.0;\n    $currency = 1;\n    $notifyUrl = 'https://www.example.com/notify';\n    $returnUrl = 'https://www.example.com/return';\n    \n\nCreate instance of Client\n\n    $client = new Client(Library::STAGING, $apiKey, false);\n    \n(Optional) Setting Transaction parameters\n\n    //changing transaction currency (default: HKD)\n    $client-\u003esetCurrency(Client::INDEX_CURRENCY_HKD);\n\n    //set transaction gateway code\n    $client-\u003esetGatewayCode(Client::INDEX_GATEWAY_CODE_ALIPAY_ONLINE_PC2MOBILE);\n\n    //set transaction gateway wallet type (default: HK)\n    $client-\u003esetWallet(Client::INDEX_WALLET_CN);\n\n    //set production name of transaction\n    $client-\u003esetSubject('Product');\n\n    //set expiry time of transaction\n    $client-\u003esetExpiryTime(900);\n\n    //set metadata of online payment\n    $metadata = json_encode([\n        'woocommerce' =\u003e '1.0',\n        'yedpay_for_woocommerce' =\u003e '1.0',\n        'wordpress' =\u003e '1.0',\n    ]);\n    $client-\u003esetMetadata($metadata);\n\n    //set payment data of online payment\n    $paymentData = json_encode([\n        'first_name' =\u003e 'Yedpay',\n        'last_name' =\u003e 'Yedpay',\n        'email' =\u003e 'info@example.com',\n        'phone' =\u003e '12345678',\n        'billing_country' =\u003e 'HK',\n        'billing_city' =\u003e 'Hong Kong',\n        'billing_address1' =\u003e 'Address1',\n        'billing_address2' =\u003e 'Address2',\n        'billing_post_code' =\u003e '000000',\n    ]);\n    $client-\u003esetPaymentData($paymentData);\n\n    //set checkout domain key of online payment\n    $client-\u003esetCheckoutDomainId('J84OFPAN');\n    \nSending Online Payment Request\n\n    $client-\u003eonlinePayment($customId, $amount)-\u003egetData();\n\n* Example Refund Transaction Implementation\n\nInput parameters\n    \n    //mandatory parameters\n    $transactionId = 'J84OFPAN';\n    //optional parameter: reason (String)\n    $reason = 'testing';\n    \n\nCreate instance of Client\n\n    // with accessToken\n    $client = new Client(Library::STAGING, $accessToken);\n    // with apiKey\n    $client = new Client(Library::STAGING, $apiKey, false);\n    \nSending Refund Request\n    \n    // general \n    $client-\u003erefund($transactionId)-\u003egetData();\n    // with reason\n    $client-\u003erefund($transactionId, $reason)-\u003egetData();\n    // with amount\n    $client-\u003erefund($transactionId, $reason, $amount)-\u003egetData();\n\n* Example Refund by Custom ID Implementation\n\nInput parameters\n    \n    //mandatory parameters\n    $customId = 'J84OFPAN';\n    //optional parameter: reason (String)\n    $reason = 'testing';\n    \n\nCreate instance of Client\n\n    // with apiKey\n    $client = new Client(Library::STAGING, $apiKey, false);\n    \nSending Refund by Custom ID Request\n    \n    // general \n    $client-\u003erefundByCustomId($customId)-\u003egetData();\n    // with reason\n    $client-\u003erefundByCustomId($customId, $reason)-\u003egetData();\n    // with amount\n    $client-\u003erefundByCustomId($customId, $reason, $amount)-\u003egetData();\n\nFor the complete Code Check the examples folder\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyedpay%2Fphp-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyedpay%2Fphp-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyedpay%2Fphp-library/lists"}