├── CHANGELOG.md ├── README.md ├── composer.json ├── example ├── Invoice │ ├── B2B │ │ ├── Allowance.php │ │ ├── AllowanceConfirm.php │ │ ├── CancelAllowance.php │ │ ├── CancelAllowanceConfirm.php │ │ ├── GetAllowance.php │ │ ├── GetAllowanceConfirm.php │ │ ├── GetAllowanceInvalid.php │ │ ├── GetAllowanceInvalidConfirm.php │ │ ├── GetInvalid.php │ │ ├── GetInvalidConfirm.php │ │ ├── GetInvoiceWordSetting.php │ │ ├── GetIssue.php │ │ ├── GetIssueConfirm.php │ │ ├── GetReject.php │ │ ├── GetRejectConfirm.php │ │ ├── Invalid.php │ │ ├── InvalidConfirm.php │ │ ├── Issue.php │ │ ├── IssueConfirm.php │ │ ├── MaintainMerchantCustomerData.php │ │ ├── Notify.php │ │ ├── Reject.php │ │ └── RejectConfirm.php │ └── B2C │ │ ├── Allowance.php │ │ ├── AllowanceByCollegiate.php │ │ ├── AllowanceInvalid.php │ │ ├── CancelDelayIssue.php │ │ ├── CheckBarcode.php │ │ ├── CheckLoveCode.php │ │ ├── DelayIssue.php │ │ ├── GetAllowance.php │ │ ├── GetAllowanceByCollegiateResponse.php │ │ ├── GetAllowanceInvalid.php │ │ ├── GetInvalid.php │ │ ├── GetInvoiceWordSetting.php │ │ ├── GetInvoicedResponse.php │ │ ├── GetIssue.php │ │ ├── Invalid.php │ │ ├── InvoiceNotify.php │ │ ├── Issue.php │ │ ├── TriggerIssue.php │ │ └── VoidWithReIssue.php ├── Logistics │ ├── AllInOne │ │ ├── B2C │ │ │ ├── CreateTestData.php │ │ │ ├── ReturnFamiCVS.php │ │ │ ├── ReturnHilifeCvs.php │ │ │ ├── ReturnUnimartCvs.php │ │ │ └── UpdateShipmentInfo.php │ │ ├── C2C │ │ │ ├── CancelC2cOrder.php │ │ │ └── UpdateStoreInfo.php │ │ ├── CreateByTempTrade.php │ │ ├── Home │ │ │ └── ReturnHome.php │ │ ├── LogisticsStatusNotify.php │ │ ├── PrintTradeDocument.php │ │ ├── QueryLogisticsTradeInfo.php │ │ ├── RedirectToLogisticsSelection.php │ │ ├── RedirectWithUnimartFreeze.php │ │ ├── TempTradeEstablishedResponse.php │ │ └── UpdateTempTrade.php │ ├── CrossBorder │ │ ├── CreateTestData.php │ │ ├── CreateUnimartCvsOrder.php │ │ ├── CreateUnimartHomeOrder.php │ │ ├── GetMapResponse.php │ │ ├── GetStatusChangedResponse.php │ │ ├── Map.php │ │ ├── Print.php │ │ └── QueryLogisticsTradeInfo.php │ ├── Domestic │ │ ├── CancelC2cOrder.php │ │ ├── CreateCvs.php │ │ ├── CreateCvsForm.php │ │ ├── CreateHome.php │ │ ├── CreateHomeForm.php │ │ ├── CreateTestData.php │ │ ├── CreateUnimartFreeze.php │ │ ├── GetCreateTestDataResponse.php │ │ ├── GetLogisticStatueResponse.php │ │ ├── GetMapResponse.php │ │ ├── GetReturnResponse.php │ │ ├── GetStoreList.php │ │ ├── Map.php │ │ ├── PrintFamic2cOrderInfo.php │ │ ├── PrintHilifec2cOrderInfo.php │ │ ├── PrintOkmartc2cOrderInfo.php │ │ ├── PrintTradeDocument.php │ │ ├── PrintUniMartc2cOrderInfo.php │ │ ├── QueryLogisticsTradeInfo.php │ │ ├── ReturnFamiCvs.php │ │ ├── ReturnHome.php │ │ ├── ReturnUniMartCvs.php │ │ ├── UpdateShipmentInfo.php │ │ └── UpdateStoreInfo.php │ ├── crossborder_logistics_status.xlsx │ ├── logistics_history.xlsx │ └── logistics_status.xlsx └── Payment │ ├── Aio │ ├── Capture.php │ ├── CreateAtmOrder.php │ ├── CreateBarcodeOrder.php │ ├── CreateBnplOrder.php │ ├── CreateCreditOrder.php │ ├── CreateCvsOrder.php │ ├── CreateInstallmentOrder.php │ ├── CreateOrder.php │ ├── CreatePeriodicOrder.php │ ├── CreateTwqrOrder.php │ ├── CreateWebAtmOrder.php │ ├── DownloadCreditReconcileCsv.php │ ├── DownloadReconcileCsv.php │ ├── GetCheckoutResponse.php │ ├── QueryCreditTrade.php │ ├── QueryPaymentInfo.php │ ├── QueryPeridicTrade.php │ └── QueryTrade.php │ └── Ecpg │ ├── Capture.php │ ├── CreateAllOrder │ ├── GetToken.php │ └── WebJS.html │ ├── CreateApplePayOrder │ ├── GetToken.php │ └── WebJS.html │ ├── CreateAtmOrder │ ├── GetToken.php │ └── WebJS.html │ ├── CreateBarcodeOrder │ ├── GetToken.php │ └── WebJS.html │ ├── CreateBindCard.php │ ├── CreateBindCardOrder │ └── WebJS.html │ ├── CreateCreditOrder │ ├── GetToken.php │ └── WebJS.html │ ├── CreateCvsOrder │ ├── GetToken.php │ └── WebJS.html │ ├── CreateInstallmentOrder │ ├── GetToken.php │ └── WebJS.html │ ├── CreateOrder.php │ ├── CreatePaymentWithCardID.php │ ├── CreateUnionPayOrder │ ├── GetToken.php │ └── WebJS.html │ ├── CreditPeriodAction.php │ ├── DeleteCredit.php │ ├── DeleteMemberBindCard.php │ ├── GetCreateBindCardResponse.php │ ├── GetMemberBindCard.php │ ├── GetResponse.php │ ├── GetTokenbyBindingCard.php │ ├── QueryCreditTrade.php │ ├── QueryPaymentInfo.php │ ├── QueryPeridicTrade.php │ ├── QueryTrade.php │ └── QueryTradeMedia.php └── src ├── Abstracts ├── AbstractAesResponse.php ├── AbstractDecryptedResponse.php ├── AbstractFactory.php ├── AbstractResponse.php └── AbstractVerifiedResponse.php ├── Config └── RtnException.php ├── Exceptions ├── RtnException.php └── TransException.php ├── Factories └── Factory.php ├── Interfaces ├── Request │ └── RequestInterface.php ├── Response │ └── ResponseInterface.php └── Services │ ├── HtmlInterface.php │ ├── HttpClientInterface.php │ └── Test │ └── TestInterface.php ├── Request ├── AesRequest.php ├── CheckMacValueRequest.php └── Request.php ├── Response ├── AesJsonResponse.php ├── AesStrResponse.php ├── ArrayResponse.php ├── EncodedStrResponse.php ├── JsonResponse.php ├── StrResponse.php ├── VerifiedArrayResponse.php └── VerifiedEncodedStrResponse.php ├── Services ├── AesService.php ├── ArrayService.php ├── AutoSubmitFormService.php ├── CheckMacValueService.php ├── CurlService.php ├── Helper.php ├── HtmlService.php ├── ManualFormService.php ├── PostService.php └── UrlService.php ├── TestCase ├── MultipleServiceTestCase.php └── SingleServiceTestCase.php └── Traits ├── HashInfo.php └── StageInfo.php /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | CHANGELOG 2 | ========= 3 | ## 1.3.2411270 - 2024-11-27 4 | ----- 5 | ### Added 6 | - Add Logistic Status Code Files. 7 | ### Changed 8 | - Change AIO test integration account. 9 | ### Deprecated 10 | - Remove Sample Code CreateOrderIssueInvoice.php 11 | 12 | ## 1.3.2411050 - 2024-11-05 13 | ----- 14 | ### Added 15 | - Add the domestic logistic `GetStoreList API` example. 16 | 17 | ## 1.3.2408190 - 2024-08-19 18 | ----- 19 | ### Added 20 | - Add `ManualFormService` for generating HTML forms is not auto-submit. 21 | 22 | ### Changed 23 | - Updated jQuery from version 3.5.1 to 3.7.1. 24 | - Enabled the `curl` option `CURLOPT_FOLLOWLOCATION` in the `run` function of the `CurlService`. 25 | 26 | ## 1.2.2403070 - 2024-03-07 27 | ----- 28 | ### Added 29 | - Add Ecpg binding card examples. 30 | ## 1.2.2301023 - 2023-10-23 31 | ----- 32 | ### Added 33 | - Add BNPL payment example 34 | - Add TWQR payment example 35 | ## 1.2.2308100 - 2023-08-21 36 | ----- 37 | ### Added 38 | - Add Ecpg payment example 39 | ## 1.2.2308010 - 2023-08-01 40 | ----- 41 | ### Added 42 | - Add an annotation for $_POST parameter in GetCheckoutResponse.php 43 | ## 1.2.2210310 - 2022-10-31 44 | ----- 45 | 46 | ### Fixed 47 | - Fix CheckMacValue verify failed when ItemName contains plus(+) sign. 48 | 49 | ## 1.2.0 - 2022-01-26 50 | ----- 51 | 52 | ### Fixed 53 | - Fix PHP 5.6 compibility. 54 | - Fix exmaple/Logistics/CrossBorder/Map.php using wrong service class. 55 | 56 | ### Added 57 | - Add support for Ecpay `All in one logistics` API. 58 | - Add TransCode validation(TransException). 59 | - Add Unimart and Hilife freeze delivery return examples. 60 | 61 | ## 1.1.0 - 2021-07-26 62 | ----- 63 | 64 | ### Fixed 65 | - Added AES decrypt and JSON decode result checking 66 | 67 | ### Added 68 | - Added support for Ecpay `B2C invoice` API 69 | - Added support for Ecpay `C2C invoice` API 70 | - Follow the [Semantic Versioning](https://semver.org) 71 | 72 | ## 1.0.2106040 - 2021-07-19 73 | ----- 74 | 75 | ### Fixed 76 | - Added JSON responses format checking 77 | 78 | ### Deprecated 79 | - Marked `Ecpay\Sdk\Factories\Factory::createWithHash` as deprecated (it's still there, just not the 80 | recommended way) and remove from examples. 81 | 82 | ### Added 83 | - Added support for Ecpay `domestic logistics` API 84 | - Added `MD5` CheckMacValue 85 | - Added `curl POST with CheckMacValue and parse string reponse without CheckMacValue` 86 | 87 | 88 | ## 1.0.2011250 - 2020-12-24 89 | ----- 90 | 91 | ### Added 92 | - Added support for Ecpay `payment` API 93 | - Added support for Ecpay `cross-border logistics` API -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 綠界科技 SDK 2 | 提供您整合綠界科技相關服務,支援服務如下。 3 | * [全方位金流](https://www.ecpay.com.tw/Business/payment_standard) 4 | * [物流服務-全方位物流](https://www.ecpay.com.tw/IntroTransport) 5 | * [物流服務-國內物流](https://www.ecpay.com.tw/IntroTransport) 6 | * [物流服務-跨境物流](https://www.ecpay.com.tw/IntroTransportCB) 7 | * [電子發票](https://www.ecpay.com.tw/Business/invoice) 8 | 9 | 10 | # 目錄 11 | * [環境需求](#環境需求) 12 | * [安裝](#安裝) 13 | * [使用](#使用) 14 | * [協助](#協助) 15 | 16 | # 環境需求 17 | - [PHP](https://www.php.net/): ^5.6.20 || ^7.0 || ^8.0 18 | 19 | # 安裝 20 | 建議使用 [Composer](https://getcomposer.org/) 安裝 21 | ```bash 22 | composer require ecpay/sdk 23 | ``` 24 | # 使用 25 | 請參考 [範例](example) 與 [串接文件](https://www.ecpay.com.tw/Service/API_Dwnld)。 26 | 27 | # 協助 28 | - [綠界技術服務工程師信箱](mailto:techsupport@ecpay.com.tw) 29 | - [舊版](https://github.com/ECPay/ECPayAIO_PHP) (停止維護) -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ecpay/sdk", 3 | "description": "ECPay SDK", 4 | "type": "library", 5 | "require": { 6 | "php": "^5.6.20 || ^7.0 || ^8.0" 7 | }, 8 | "license": "MIT", 9 | "require-dev": { 10 | "phpunit/phpunit": "^5.0 || ^6.0 || ^7.0 || ^8.0", 11 | "fzaninotto/faker": "1.9.x-dev" 12 | }, 13 | "autoload": { 14 | "psr-4": { 15 | "Ecpay\\Sdk\\": "src/" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /example/Invoice/B2B/Allowance.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $itemCount = 1; 14 | $itemPrice = 10; 15 | $itemAmount = ($itemPrice * $itemCount); 16 | $totalAmount = $itemAmount; 17 | $taxAmount = round($totalAmount * 0.05, 0); 18 | $data = [ 19 | 'MerchantID' => '2000132', 20 | 'TaxAmount' => $taxAmount, 21 | 'TotalAmount' => $totalAmount, 22 | 'Details' => [ 23 | [ 24 | 'OriginalInvoiceNumber' => 'MJ20001246', 25 | 'OriginalInvoiceDate' => '2021-07-30', 26 | 'ItemName' => '測試商品01', 27 | 'OriginalSequenceNumber' => 1, 28 | 'ItemName' => '測試商品01', 29 | 'ItemCount' => $itemCount, 30 | 'ItemPrice' => $itemPrice, 31 | 'ItemAmount' => $itemAmount, 32 | ], 33 | ], 34 | ]; 35 | $input = [ 36 | 'MerchantID' => '2000132', 37 | 'RqHeader' => [ 38 | 'Timestamp' => time(), 39 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 40 | 'Revision' => '1.0.0', 41 | ], 42 | 'Data' => $data, 43 | ]; 44 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/Allowance'; 45 | 46 | $response = $postService->post($input, $url); 47 | var_dump($response); 48 | -------------------------------------------------------------------------------- /example/Invoice/B2B/AllowanceConfirm.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'AllowanceNo' => '2107301425196279', 16 | ]; 17 | $input = [ 18 | 'MerchantID' => '2000132', 19 | 'RqHeader' => [ 20 | 'Timestamp' => time(), 21 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 22 | 'Revision' => '1.0.0', 23 | ], 24 | 'Data' => $data, 25 | ]; 26 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/AllowanceConfirm'; 27 | 28 | $response = $postService->post($input, $url); 29 | var_dump($response); 30 | -------------------------------------------------------------------------------- /example/Invoice/B2B/CancelAllowance.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'AllowanceNo' => '2107301425196279', 16 | 'Reason' => 'Testing reason', 17 | ]; 18 | $input = [ 19 | 'MerchantID' => '2000132', 20 | 'RqHeader' => [ 21 | 'Timestamp' => time(), 22 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 23 | 'Revision' => '1.0.0', 24 | ], 25 | 'Data' => $data, 26 | ]; 27 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/CancelAllowance'; 28 | 29 | $response = $postService->post($input, $url); 30 | var_dump($response); 31 | -------------------------------------------------------------------------------- /example/Invoice/B2B/CancelAllowanceConfirm.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'AllowanceNo' => '2107301425196279', 16 | ]; 17 | $input = [ 18 | 'MerchantID' => '2000132', 19 | 'RqHeader' => [ 20 | 'Timestamp' => time(), 21 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 22 | 'Revision' => '1.0.0', 23 | ], 24 | 'Data' => $data, 25 | ]; 26 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/CancelAllowanceConfirm'; 27 | 28 | $response = $postService->post($input, $url); 29 | var_dump($response); 30 | -------------------------------------------------------------------------------- /example/Invoice/B2B/GetAllowance.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'AllowanceNo' => '2107301546105790', 16 | ]; 17 | $input = [ 18 | 'MerchantID' => '2000132', 19 | 'RqHeader' => [ 20 | 'Timestamp' => time(), 21 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 22 | 'Revision' => '1.0.0', 23 | ], 24 | 'Data' => $data, 25 | ]; 26 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/GetAllowance'; 27 | 28 | $response = $postService->post($input, $url); 29 | var_dump($response); 30 | -------------------------------------------------------------------------------- /example/Invoice/B2B/GetAllowanceConfirm.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'AllowanceNo' => '2107301546105790', 16 | ]; 17 | $input = [ 18 | 'MerchantID' => '2000132', 19 | 'RqHeader' => [ 20 | 'Timestamp' => time(), 21 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 22 | 'Revision' => '1.0.0', 23 | ], 24 | 'Data' => $data, 25 | ]; 26 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/GetAllowanceConfirm'; 27 | 28 | $response = $postService->post($input, $url); 29 | var_dump($response); 30 | -------------------------------------------------------------------------------- /example/Invoice/B2B/GetAllowanceInvalid.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'AllowanceNo' => '2107301546105790', 16 | ]; 17 | $input = [ 18 | 'MerchantID' => '2000132', 19 | 'RqHeader' => [ 20 | 'Timestamp' => time(), 21 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 22 | 'Revision' => '1.0.0', 23 | ], 24 | 'Data' => $data, 25 | ]; 26 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/GetAllowanceInvalid'; 27 | 28 | $response = $postService->post($input, $url); 29 | var_dump($response); 30 | -------------------------------------------------------------------------------- /example/Invoice/B2B/GetAllowanceInvalidConfirm.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'AllowanceNo' => '2107301546105790', 16 | ]; 17 | $input = [ 18 | 'MerchantID' => '2000132', 19 | 'RqHeader' => [ 20 | 'Timestamp' => time(), 21 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 22 | 'Revision' => '1.0.0', 23 | ], 24 | 'Data' => $data, 25 | ]; 26 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/GetAllowanceInvalidConfirm'; 27 | 28 | $response = $postService->post($input, $url); 29 | var_dump($response); 30 | -------------------------------------------------------------------------------- /example/Invoice/B2B/GetInvalid.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'InvoiceCategory' => 0, 16 | 'InvoiceNumber' => 'MJ20001241', 17 | 'InvoiceDate' => '2021-07-29', 18 | ]; 19 | $input = [ 20 | 'MerchantID' => '2000132', 21 | 'RqHeader' => [ 22 | 'Timestamp' => time(), 23 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 24 | 'Revision' => '1.0.0', 25 | ], 26 | 'Data' => $data, 27 | ]; 28 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/GetInvalid'; 29 | 30 | $response = $postService->post($input, $url); 31 | var_dump($response); 32 | -------------------------------------------------------------------------------- /example/Invoice/B2B/GetInvalidConfirm.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'InvoiceCategory' => 0, 16 | 'InvoiceNumber' => 'MJ20001241', 17 | 'InvoiceDate' => '2021-07-29', 18 | ]; 19 | $input = [ 20 | 'MerchantID' => '2000132', 21 | 'RqHeader' => [ 22 | 'Timestamp' => time(), 23 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 24 | 'Revision' => '1.0.0', 25 | ], 26 | 'Data' => $data, 27 | ]; 28 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/GetInvalidConfirm'; 29 | 30 | $response = $postService->post($input, $url); 31 | var_dump($response); 32 | -------------------------------------------------------------------------------- /example/Invoice/B2B/GetInvoiceWordSetting.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'InvoiceYear' => '109', 16 | 'InvoiceTerm' => 0, 17 | 'UseStatus' => 0, 18 | 'InvoiceCategory' => 2, 19 | ]; 20 | $input = [ 21 | 'MerchantID' => '2000132', 22 | 'RqHeader' => [ 23 | 'Timestamp' => time(), 24 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 25 | 'Revision' => '1.0.0', 26 | ], 27 | 'Data' => $data, 28 | ]; 29 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/GetInvoiceWordSetting'; 30 | 31 | $response = $postService->post($input, $url); 32 | var_dump($response); 33 | -------------------------------------------------------------------------------- /example/Invoice/B2B/GetIssue.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'InvoiceCategory' => 0, 16 | 'InvoiceNumber' => 'MJ20001294', 17 | 'InvoiceDate' => '2021-07-30', 18 | ]; 19 | $input = [ 20 | 'MerchantID' => '2000132', 21 | 'RqHeader' => [ 22 | 'Timestamp' => time(), 23 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 24 | 'Revision' => '1.0.0', 25 | ], 26 | 'Data' => $data, 27 | ]; 28 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/GetIssue'; 29 | 30 | $response = $postService->post($input, $url); 31 | var_dump($response); 32 | -------------------------------------------------------------------------------- /example/Invoice/B2B/GetIssueConfirm.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'InvoiceCategory' => 0, 16 | 'InvoiceNumber' => 'MJ20001294', 17 | 'InvoiceDate' => '2021-07-30', 18 | ]; 19 | $input = [ 20 | 'MerchantID' => '2000132', 21 | 'RqHeader' => [ 22 | 'Timestamp' => time(), 23 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 24 | 'Revision' => '1.0.0', 25 | ], 26 | 'Data' => $data, 27 | ]; 28 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/GetIssueConfirm'; 29 | 30 | $response = $postService->post($input, $url); 31 | var_dump($response); 32 | -------------------------------------------------------------------------------- /example/Invoice/B2B/GetReject.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'InvoiceNumber' => 'MJ20001336', 16 | 'InvoiceDate' => '2021-07-30', 17 | 'Reason' => 'Testing reason', 18 | ]; 19 | $input = [ 20 | 'MerchantID' => '2000132', 21 | 'RqHeader' => [ 22 | 'Timestamp' => time(), 23 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 24 | 'Revision' => '1.0.0', 25 | ], 26 | 'Data' => $data, 27 | ]; 28 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/GetReject'; 29 | 30 | $response = $postService->post($input, $url); 31 | var_dump($response); 32 | -------------------------------------------------------------------------------- /example/Invoice/B2B/GetRejectConfirm.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'InvoiceCategory' => 0, 16 | 'InvoiceNumber' => 'MJ20001336', 17 | 'InvoiceDate' => '2021-07-30', 18 | ]; 19 | $input = [ 20 | 'MerchantID' => '2000132', 21 | 'RqHeader' => [ 22 | 'Timestamp' => time(), 23 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 24 | 'Revision' => '1.0.0', 25 | ], 26 | 'Data' => $data, 27 | ]; 28 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/GetRejectConfirm'; 29 | 30 | $response = $postService->post($input, $url); 31 | var_dump($response); 32 | -------------------------------------------------------------------------------- /example/Invoice/B2B/Invalid.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'InvoiceNumber' => 'MJ20001241', 16 | 'InvoiceDate' => '2021-07-29', 17 | 'Reason' => 'Testing reason', 18 | ]; 19 | $input = [ 20 | 'MerchantID' => '2000132', 21 | 'RqHeader' => [ 22 | 'Timestamp' => time(), 23 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 24 | 'Revision' => '1.0.0', 25 | ], 26 | 'Data' => $data, 27 | ]; 28 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/Invalid'; 29 | 30 | $response = $postService->post($input, $url); 31 | var_dump($response); 32 | -------------------------------------------------------------------------------- /example/Invoice/B2B/InvalidConfirm.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'InvoiceNumber' => 'MJ20001242', 16 | 'InvoiceDate' => '2021-07-29', 17 | ]; 18 | $input = [ 19 | 'MerchantID' => '2000132', 20 | 'RqHeader' => [ 21 | 'Timestamp' => time(), 22 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 23 | 'Revision' => '1.0.0', 24 | ], 25 | 'Data' => $data, 26 | ]; 27 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/InvalidConfirm'; 28 | 29 | $response = $postService->post($input, $url); 30 | var_dump($response); 31 | -------------------------------------------------------------------------------- /example/Invoice/B2B/Issue.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $itemCount = 3; 14 | $itemPrice = 10; 15 | $itemAmount = ($itemPrice * $itemCount); 16 | $saleAmount = $itemAmount; 17 | $taxAmount = round(($saleAmount * 0.05), 0); 18 | $data = [ 19 | 'MerchantID' => '2000132', 20 | 'RelateNumber' => 'test' . time(), 21 | 'CustomerIdentifier' => '23165448', 22 | 'CustomerEmail' => 'test-buyer@ecpay.com.tw', 23 | 'InvType' => '07', 24 | 'TaxType' => '1', 25 | 'Items' => [ 26 | [ 27 | 'ItemSeq' => 1, 28 | 'ItemName' => '測試商品01', 29 | 'ItemCount' => $itemCount, 30 | 'ItemPrice' => $itemPrice, 31 | 'ItemTaxType' => '1', 32 | 'ItemAmount' => $itemAmount, 33 | ], 34 | ], 35 | 'SalesAmount' => $saleAmount, 36 | 'TaxAmount' => $taxAmount, 37 | 'TotalAmount' => ($saleAmount + $taxAmount), 38 | ]; 39 | $input = [ 40 | 'MerchantID' => '2000132', 41 | 'RqHeader' => [ 42 | 'Timestamp' => time(), 43 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 44 | 'Revision' => '1.0.0', 45 | ], 46 | 'Data' => $data, 47 | ]; 48 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/Issue'; 49 | 50 | $response = $postService->post($input, $url); 51 | var_dump($response); 52 | -------------------------------------------------------------------------------- /example/Invoice/B2B/IssueConfirm.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'InvoiceNumber' => 'MJ20001240', 16 | 'InvoiceDate' => '2021-07-29', 17 | ]; 18 | $input = [ 19 | 'MerchantID' => '2000132', 20 | 'RqHeader' => [ 21 | 'Timestamp' => time(), 22 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 23 | 'Revision' => '1.0.0', 24 | ], 25 | 'Data' => $data, 26 | ]; 27 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/IssueConfirm'; 28 | 29 | $response = $postService->post($input, $url); 30 | var_dump($response); 31 | -------------------------------------------------------------------------------- /example/Invoice/B2B/MaintainMerchantCustomerData.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'Action' => 'Add', 16 | 'Identifier' => '53538851', 17 | 'type' => '2', 18 | 'CompanyName' => '綠界科技', 19 | 'TradingSlang' => 'Testing Slang', 20 | 'ExchangeMode' => '0', 21 | 'EmailAddress' => 'test-company@ecpay.com.tw', 22 | ]; 23 | $input = [ 24 | 'MerchantID' => '2000132', 25 | 'RqHeader' => [ 26 | 'Timestamp' => time(), 27 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 28 | 'Revision' => '1.0.0', 29 | ], 30 | 'Data' => $data, 31 | ]; 32 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/MaintainMerchantCustomerData'; 33 | 34 | $response = $postService->post($input, $url); 35 | var_dump($response); 36 | -------------------------------------------------------------------------------- /example/Invoice/B2B/Notify.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'InvoiceDate' => '2021-07-29', 16 | 'InvoiceNumber' => 'MJ20001240', 17 | 'NotifyMail' => 'test-buyer@ecpay.com.tw', 18 | 'InvoiceTag' => '1', 19 | 'Notified' => 'C', 20 | ]; 21 | $input = [ 22 | 'MerchantID' => '2000132', 23 | 'RqHeader' => [ 24 | 'Timestamp' => time(), 25 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 26 | 'Revision' => '1.0.0', 27 | ], 28 | 'Data' => $data, 29 | ]; 30 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/Notify'; 31 | 32 | $response = $postService->post($input, $url); 33 | var_dump($response); 34 | -------------------------------------------------------------------------------- /example/Invoice/B2B/Reject.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'InvoiceNumber' => 'MJ20001243', 16 | 'InvoiceDate' => '2021-07-29', 17 | 'Reason' => 'Testing reason', 18 | ]; 19 | $input = [ 20 | 'MerchantID' => '2000132', 21 | 'RqHeader' => [ 22 | 'Timestamp' => time(), 23 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 24 | 'Revision' => '1.0.0', 25 | ], 26 | 'Data' => $data, 27 | ]; 28 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/Reject'; 29 | 30 | $response = $postService->post($input, $url); 31 | var_dump($response); 32 | -------------------------------------------------------------------------------- /example/Invoice/B2B/RejectConfirm.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'InvoiceNumber' => 'MJ20001243', 16 | 'InvoiceDate' => '2021-07-29', 17 | ]; 18 | $input = [ 19 | 'MerchantID' => '2000132', 20 | 'RqHeader' => [ 21 | 'Timestamp' => time(), 22 | 'RqID' => '701b3264-a538-437e-ad45-2505eb7dde39', 23 | 'Revision' => '1.0.0', 24 | ], 25 | 'Data' => $data, 26 | ]; 27 | $url = 'https://einvoice-stage.ecpay.com.tw/B2BInvoice/RejectConfirm'; 28 | 29 | $response = $postService->post($input, $url); 30 | var_dump($response); 31 | -------------------------------------------------------------------------------- /example/Invoice/B2C/Allowance.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $itemCount = 1; 14 | $itemPrice = 10.5; 15 | $itemAmount = $itemPrice * $itemCount; 16 | $allowanceAmount = round(($itemAmount), 0); 17 | $data = [ 18 | 'MerchantID' => '2000132', 19 | 'InvoiceNo' => 'MJ80008939', 20 | 'InvoiceDate' => '2021-07-28', 21 | 'AllowanceNotify' => 'E', 22 | 'NotifyMail' => 'test-allowance@ecpay.com.tw', 23 | 'AllowanceAmount' => $allowanceAmount, 24 | 25 | 'Items' => [ 26 | [ 27 | 'ItemSeq' => 1, 28 | 'ItemName' => '測試商品01', 29 | 'ItemCount' => $itemCount, 30 | 'ItemWord' => '個', 31 | 'ItemPrice' => $itemPrice, 32 | 'ItemAmount' => $itemAmount, 33 | ], 34 | ], 35 | ]; 36 | $input = [ 37 | 'MerchantID' => '2000132', 38 | 'RqHeader' => [ 39 | 'Timestamp' => time(), 40 | 'Revision' => '3.0.0', 41 | ], 42 | 'Data' => $data, 43 | ]; 44 | $url = 'https://einvoice-stage.ecpay.com.tw/B2CInvoice/Allowance'; 45 | 46 | $response = $postService->post($input, $url); 47 | var_dump($response); 48 | -------------------------------------------------------------------------------- /example/Invoice/B2C/AllowanceByCollegiate.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $itemCount = 1; 14 | $itemPrice = 10.5; 15 | $itemAmount = $itemPrice * $itemCount; 16 | $allowanceAmount = round(($itemAmount), 0); 17 | $data = [ 18 | 'MerchantID' => '2000132', 19 | 'InvoiceNo' => 'MJ80009035', 20 | 'InvoiceDate' => '2021-07-28', 21 | 'AllowanceNotify' => 'E', 22 | 'NotifyMail' => 'test-allowance@ecpay.com.tw', 23 | 'AllowanceAmount' => $allowanceAmount, 24 | 'Items' => [ 25 | [ 26 | 'ItemSeq' => 1, 27 | 'ItemName' => '測試商品01', 28 | 'ItemCount' => $itemCount, 29 | 'ItemWord' => '個', 30 | 'ItemPrice' => $itemPrice, 31 | 'ItemAmount' => $itemAmount, 32 | ], 33 | ], 34 | 35 | // 請參考 example/Invoice/B2C/GetAllowanceByCollegiateResponse.php 範例開發 36 | 'ReturnURL' => 'https://www.ecpay.com.tw/example/return-url', 37 | ]; 38 | $input = [ 39 | 'MerchantID' => '2000132', 40 | 'RqHeader' => [ 41 | 'Timestamp' => time(), 42 | 'Revision' => '3.0.0', 43 | ], 44 | 'Data' => $data, 45 | ]; 46 | $url = 'https://einvoice-stage.ecpay.com.tw/B2CInvoice/AllowanceByCollegiate'; 47 | 48 | $response = $postService->post($input, $url); 49 | var_dump($response); 50 | -------------------------------------------------------------------------------- /example/Invoice/B2C/AllowanceInvalid.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'InvoiceNo' => 'MJ80009358', 16 | 'AllowanceNo' => '2021072813260868', 17 | 'Reason' => 'Testing reason', 18 | ]; 19 | $input = [ 20 | 'MerchantID' => '2000132', 21 | 'RqHeader' => [ 22 | 'Timestamp' => time(), 23 | 'Revision' => '3.0.0', 24 | ], 25 | 'Data' => $data, 26 | ]; 27 | $url = 'https://einvoice-stage.ecpay.com.tw/B2CInvoice/AllowanceInvalid'; 28 | 29 | $response = $postService->post($input, $url); 30 | var_dump($response); 31 | -------------------------------------------------------------------------------- /example/Invoice/B2C/CancelDelayIssue.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | $data = [ 13 | 'MerchantID' => '2000132', 14 | 'Tsr' => 'tsr1627439050', 15 | ]; 16 | $input = [ 17 | 'MerchantID' => '2000132', 18 | 'RqHeader' => [ 19 | 'Timestamp' => time(), 20 | 'Revision' => '3.0.0', 21 | ], 22 | 'Data' => $data, 23 | ]; 24 | $url = 'https://einvoice-stage.ecpay.com.tw/B2CInvoice/CancelDelayIssue'; 25 | 26 | $response = $postService->post($input, $url); 27 | var_dump($response); 28 | -------------------------------------------------------------------------------- /example/Invoice/B2C/CheckBarcode.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'BarCode' => '/1234567', 16 | ]; 17 | $input = [ 18 | 'MerchantID' => '2000132', 19 | 'RqHeader' => [ 20 | 'Timestamp' => time(), 21 | 'Revision' => '3.0.0', 22 | ], 23 | 'Data' => $data, 24 | ]; 25 | $url = 'https://einvoice-stage.ecpay.com.tw/B2CInvoice/CheckBarcode'; 26 | 27 | $response = $postService->post($input, $url); 28 | var_dump($response); 29 | -------------------------------------------------------------------------------- /example/Invoice/B2C/CheckLoveCode.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'LoveCode' => '168001', 16 | ]; 17 | $input = [ 18 | 'MerchantID' => '2000132', 19 | 'RqHeader' => [ 20 | 'Timestamp' => time(), 21 | 'Revision' => '3.0.0', 22 | ], 23 | 'Data' => $data, 24 | ]; 25 | $url = 'https://einvoice-stage.ecpay.com.tw/B2CInvoice/CheckLoveCode'; 26 | 27 | $response = $postService->post($input, $url); 28 | var_dump($response); 29 | -------------------------------------------------------------------------------- /example/Invoice/B2C/DelayIssue.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $itemCount01 = 3; 14 | $itemPrice01 = 10.5; 15 | $itemAmount01 = round(($itemPrice01 * $itemCount01), 0); 16 | 17 | $itemCount02 = 1; 18 | $itemPrice02 = 150.0; 19 | $itemAmount02 = round(($itemPrice02 * $itemCount02), 0); 20 | 21 | $data = [ 22 | 'MerchantID' => '2000132', 23 | 'RelateNumber' => 'Test' . time(), 24 | 'CustomerName' => '測試消費者', 25 | 'CustomerAddr' => '台北市南港區三重路19-2號6樓', 26 | 'CustomerEmail' => 'test-customer@ecpay.com.tw', 27 | 'Print' => '1', 28 | 'Donation' => '0', 29 | 'TaxType' => '1', 30 | 'SalesAmount' => ($itemAmount01 + $itemAmount02), 31 | 'Items' => [ 32 | [ 33 | 'ItemName' => '測試商品01', 34 | 'ItemCount' => $itemCount01, 35 | 'ItemWord' => '個', 36 | 'ItemPrice' => $itemPrice01, 37 | 'ItemTaxType' => '3', 38 | 'ItemAmount' => $itemAmount01, 39 | ], 40 | [ 41 | 'ItemName' => '測試商品02', 42 | 'ItemCount' => $itemCount02, 43 | 'ItemWord' => '雙', 44 | 'ItemPrice' => $itemPrice02, 45 | 'ItemTaxType' => '3', 46 | 'ItemAmount' => $itemAmount02, 47 | ], 48 | ], 49 | 'InvType' => '07', 50 | 'DelayFlag' => '1', 51 | 'DelayDay' => 15, 52 | 'Tsr' => 'tsr' . time(), 53 | 'PayType' => '2', 54 | 'PayAct' => 'ECPAY', 55 | 56 | // 請參考 example/Invoice/B2C/GetInvoicedResponse.php 範例開發 57 | 'NotifyURL' => 'https://www.ecpay.com.tw/example/notify-url', 58 | ]; 59 | $input = [ 60 | 'MerchantID' => '2000132', 61 | 'RqHeader' => [ 62 | 'Timestamp' => time(), 63 | 'Revision' => '3.0.0', 64 | ], 65 | 'Data' => $data, 66 | ]; 67 | $url = 'https://einvoice-stage.ecpay.com.tw/B2CInvoice/DelayIssue'; 68 | 69 | $response = $postService->post($input, $url); 70 | var_dump($response); 71 | -------------------------------------------------------------------------------- /example/Invoice/B2C/GetAllowance.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'InvoiceNo' => 'MJ80009376', 16 | 'AllowanceNo' => '2021072814112628', 17 | ]; 18 | $input = [ 19 | 'MerchantID' => '2000132', 20 | 'RqHeader' => [ 21 | 'Timestamp' => time(), 22 | 'Revision' => '3.0.0', 23 | ], 24 | 'Data' => $data, 25 | ]; 26 | $url = 'https://einvoice-stage.ecpay.com.tw/B2CInvoice/GetAllowance'; 27 | 28 | $response = $postService->post($input, $url); 29 | var_dump($response); 30 | -------------------------------------------------------------------------------- /example/Invoice/B2C/GetAllowanceByCollegiateResponse.php: -------------------------------------------------------------------------------- 1 | create(ArrayResponse::class); 10 | 11 | var_dump($arrayResponse->get($_POST)); 12 | -------------------------------------------------------------------------------- /example/Invoice/B2C/GetAllowanceInvalid.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'InvoiceNo' => 'MJ80009399', 16 | 'AllowanceNo' => '2021072814346308', 17 | ]; 18 | $input = [ 19 | 'MerchantID' => '2000132', 20 | 'RqHeader' => [ 21 | 'Timestamp' => time(), 22 | 'Revision' => '3.0.0', 23 | ], 24 | 'Data' => $data, 25 | ]; 26 | $url = 'https://einvoice-stage.ecpay.com.tw/B2CInvoice/GetAllowanceInvalid'; 27 | 28 | $response = $postService->post($input, $url); 29 | var_dump($response); 30 | -------------------------------------------------------------------------------- /example/Invoice/B2C/GetInvalid.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'RelateNumber' => 'Test1627453097', 16 | 'InvoiceNo' => 'MJ80009387', 17 | 'InvoiceDate' => '2021-07-28 ', 18 | ]; 19 | $input = [ 20 | 'MerchantID' => '2000132', 21 | 'RqHeader' => [ 22 | 'Timestamp' => time(), 23 | 'Revision' => '3.0.0', 24 | ], 25 | 'Data' => $data, 26 | ]; 27 | $url = 'https://einvoice-stage.ecpay.com.tw/B2CInvoice/GetInvalid'; 28 | 29 | $response = $postService->post($input, $url); 30 | var_dump($response); 31 | -------------------------------------------------------------------------------- /example/Invoice/B2C/GetInvoiceWordSetting.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'InvoiceYear' => '109', 16 | 'InvoiceTerm' => 0, 17 | 'UseStatus' => 0, 18 | 'InvoiceCategory' => 1, 19 | ]; 20 | $input = [ 21 | 'MerchantID' => '2000132', 22 | 'RqHeader' => [ 23 | 'Timestamp' => time(), 24 | 'Revision' => '3.0.0', 25 | ], 26 | 'Data' => $data, 27 | ]; 28 | $url = 'https://einvoice-stage.ecpay.com.tw/B2CInvoice/GetInvoiceWordSetting'; 29 | 30 | $response = $postService->post($input, $url); 31 | var_dump($response); 32 | -------------------------------------------------------------------------------- /example/Invoice/B2C/GetInvoicedResponse.php: -------------------------------------------------------------------------------- 1 | create(ArrayResponse::class); 10 | 11 | var_dump($arrayResponse->get($_POST)); 12 | -------------------------------------------------------------------------------- /example/Invoice/B2C/GetIssue.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'InvoiceNo' => 'MJ80009376', 16 | 'InvoiceDate' => '2021-07-28', 17 | ]; 18 | $input = [ 19 | 'MerchantID' => '2000132', 20 | 'RqHeader' => [ 21 | 'Timestamp' => time(), 22 | 'Revision' => '3.0.0', 23 | ], 24 | 'Data' => $data, 25 | ]; 26 | $url = 'https://einvoice-stage.ecpay.com.tw/B2CInvoice/GetIssue'; 27 | 28 | $response = $postService->post($input, $url); 29 | var_dump($response); 30 | -------------------------------------------------------------------------------- /example/Invoice/B2C/Invalid.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'InvoiceNo' => 'MJ80009300', 16 | 'InvoiceDate' => '2021-07-28', 17 | 'Reason' => 'Testing reason', 18 | ]; 19 | $input = [ 20 | 'MerchantID' => '2000132', 21 | 'RqHeader' => [ 22 | 'Timestamp' => time(), 23 | 'Revision' => '3.0.0', 24 | ], 25 | 'Data' => $data, 26 | ]; 27 | $url = 'https://einvoice-stage.ecpay.com.tw/B2CInvoice/Invalid'; 28 | 29 | $response = $postService->post($input, $url); 30 | var_dump($response); 31 | -------------------------------------------------------------------------------- /example/Invoice/B2C/InvoiceNotify.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'InvoiceNo' => 'MJ80009449', 16 | 'NotifyMail' => 'test-customer@ecpay.com.tw', 17 | 'Notify' => 'E', 18 | 'InvoiceTag' => 'I', 19 | 'Notified' => 'C', 20 | ]; 21 | $input = [ 22 | 'MerchantID' => '2000132', 23 | 'RqHeader' => [ 24 | 'Timestamp' => time(), 25 | 'Revision' => '3.0.0', 26 | ], 27 | 'Data' => $data, 28 | ]; 29 | $url = 'https://einvoice-stage.ecpay.com.tw/B2CInvoice/InvoiceNotify'; 30 | 31 | $response = $postService->post($input, $url); 32 | var_dump($response); 33 | -------------------------------------------------------------------------------- /example/Invoice/B2C/Issue.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $itemCount = 3; 14 | $itemPriceIncludeTax = 10.5; 15 | $itemAmount = round(($itemPriceIncludeTax * $itemCount), 0); 16 | $saleAmount = $itemAmount; 17 | $data = [ 18 | 'MerchantID' => '2000132', 19 | 'RelateNumber' => 'Test' . time(), 20 | 'CustomerPhone' => '0911222333', 21 | 'Print' => '0', 22 | 'Donation' => '0', 23 | 'CarrierType' => '1', 24 | 'TaxType' => '1', 25 | 'SalesAmount' => $saleAmount, 26 | 'Items' => [ 27 | [ 28 | 'ItemName' => '測試商品01', 29 | 'ItemCount' => $itemCount, 30 | 'ItemWord' => '個', 31 | 'ItemPrice' => $itemPriceIncludeTax, 32 | 'ItemTaxType' => '1', 33 | 'ItemAmount' => $itemAmount, 34 | ], 35 | ], 36 | 'InvType' => '07' 37 | ]; 38 | $input = [ 39 | 'MerchantID' => '2000132', 40 | 'RqHeader' => [ 41 | 'Timestamp' => time(), 42 | 'Revision' => '3.0.0', 43 | ], 44 | 'Data' => $data, 45 | ]; 46 | $url = 'https://einvoice-stage.ecpay.com.tw/B2CInvoice/Issue'; 47 | 48 | $response = $postService->post($input, $url); 49 | var_dump($response); 50 | -------------------------------------------------------------------------------- /example/Invoice/B2C/TriggerIssue.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'Tsr' => 'tsr1627439050', 16 | 'PayType' => '2', 17 | ]; 18 | $input = [ 19 | 'MerchantID' => '2000132', 20 | 'RqHeader' => [ 21 | 'Timestamp' => time(), 22 | 'Revision' => '3.0.0', 23 | ], 24 | 'Data' => $data, 25 | ]; 26 | $url = 'https://einvoice-stage.ecpay.com.tw/B2CInvoice/TriggerIssue'; 27 | 28 | $response = $postService->post($input, $url); 29 | var_dump($response); 30 | -------------------------------------------------------------------------------- /example/Invoice/B2C/VoidWithReIssue.php: -------------------------------------------------------------------------------- 1 | 'ejCk326UnaZWKisg', 9 | 'hashIv' => 'q9jcZX8Ib9LM8wYk', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $itemCount = 1; 14 | $itemPriceIncludeTax = 10.5; 15 | $itemAmount = round(($itemPriceIncludeTax * $itemCount), 0); 16 | $saleAmount = $itemAmount; 17 | $data = [ 18 | 'VoidModel' => [ 19 | 'MerchantID' => '2000132', 20 | 'InvoiceNo' => 'MJ80009359', 21 | 'VoidReason' => 'Testing void reason', 22 | ], 23 | 'IssueModel' => [ 24 | 'MerchantID' => '2000132', 25 | 'RelateNumber' => 'test' . time(), 26 | 'InvoiceDate' => '2021-07-28 13:32:48', 27 | 'CustomerEmail' => 'test-customer@ecpay.com.tw', 28 | 'Print' => '0', 29 | 'Donation' => '0', 30 | 'TaxType' => '1', 31 | 'SalesAmount' => $saleAmount, 32 | 'Items' => [ 33 | [ 34 | 'ItemName' => '測試商品01', 35 | 'ItemCount' => $itemCount, 36 | 'ItemWord' => '個', 37 | 'ItemPrice' => $itemPriceIncludeTax, 38 | 'ItemTaxType' => '1', 39 | 'ItemAmount' => $itemAmount, 40 | ], 41 | ], 42 | 'InvType' => '07' 43 | ], 44 | ]; 45 | $input = [ 46 | 'MerchantID' => '2000132', 47 | 'RqHeader' => [ 48 | 'Timestamp' => time(), 49 | 'Revision' => '3.0.0', 50 | ], 51 | 'Data' => $data, 52 | ]; 53 | $url = 'https://einvoice-stage.ecpay.com.tw/B2CInvoice/VoidWithReIssue'; 54 | 55 | $response = $postService->post($input, $url); 56 | var_dump($response); 57 | -------------------------------------------------------------------------------- /example/Logistics/AllInOne/B2C/CreateTestData.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'LogisticsSubType' => 'FAMI', 16 | ]; 17 | $input = [ 18 | 'MerchantID' => '2000132', 19 | 'RqHeader' => [ 20 | 'Timestamp' => time(), 21 | 'Revision' => '1.0.0', 22 | ], 23 | 'Data' => $data, 24 | ]; 25 | $url = 'https://logistics-stage.ecpay.com.tw/Express/v2/CreateTestData'; 26 | 27 | $response = $postService->post($input, $url); 28 | var_dump($response); 29 | -------------------------------------------------------------------------------- /example/Logistics/AllInOne/B2C/ReturnFamiCVS.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'LogisticsID' => '1769542', 16 | 'GoodsAmount' => 130, 17 | 'ServiceType' => '4', 18 | 'SenderName' => '王大明', 19 | 20 | // 請參考 example/Logistics/AllInOne/LogisticsStatusNotify.php 範例開發 21 | 'ServerReplyURL' => 'https://www.ecpay.com.tw/example/server-reply', 22 | ]; 23 | $input = [ 24 | 'MerchantID' => '2000132', 25 | 'RqHeader' => [ 26 | 'Timestamp' => time(), 27 | 'Revision' => '1.0.0', 28 | ], 29 | 'Data' => $data, 30 | ]; 31 | $url = 'https://logistics-stage.ecpay.com.tw/Express/v2/ReturnCVS'; 32 | 33 | $response = $postService->post($input, $url); 34 | var_dump($response); 35 | -------------------------------------------------------------------------------- /example/Logistics/AllInOne/B2C/ReturnHilifeCvs.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'LogisticsID' => '1865733', 16 | 'GoodsAmount' => 100, 17 | 'ServiceType' => '4', 18 | 'SenderName' => '王大明', 19 | 'SenderPhone' => '0911222333', 20 | 21 | // 請參考 example/Logistics/AllInOne/LogisticsStatusNotify.php 範例開發 22 | 'ServerReplyURL' => 'https://www.ecpay.com.tw/example/server-reply', 23 | ]; 24 | $input = [ 25 | 'MerchantID' => '2000132', 26 | 'RqHeader' => [ 27 | 'Timestamp' => time(), 28 | 'Revision' => '1.0.0', 29 | ], 30 | 'Data' => $data, 31 | ]; 32 | $url = 'https://logistics-stage.ecpay.com.tw/Express/v2/ReturnHilifeCVS'; 33 | 34 | $response = $postService->post($input, $url); 35 | var_dump($response); 36 | -------------------------------------------------------------------------------- /example/Logistics/AllInOne/B2C/ReturnUnimartCvs.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'LogisticsID' => '1769541', 16 | 'GoodsAmount' => 130, 17 | 'ServiceType' => '4', 18 | 'SenderName' => '王大明', 19 | 20 | // 請參考 example/Logistics/AllInOne/LogisticsStatusNotify.php 範例開發 21 | 'ServerReplyURL' => 'https://www.ecpay.com.tw/example/server-reply', 22 | ]; 23 | $input = [ 24 | 'MerchantID' => '2000132', 25 | 'RqHeader' => [ 26 | 'Timestamp' => time(), 27 | 'Revision' => '1.0.0', 28 | ], 29 | 'Data' => $data, 30 | ]; 31 | $url = 'https://logistics-stage.ecpay.com.tw/Express/v2/ReturnUniMartCVS'; 32 | 33 | $response = $postService->post($input, $url); 34 | var_dump($response); 35 | -------------------------------------------------------------------------------- /example/Logistics/AllInOne/B2C/UpdateShipmentInfo.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'LogisticsID' => '1770237', 16 | 'ShipmentDate' => '2021/10/25', 17 | ]; 18 | $input = [ 19 | 'MerchantID' => '2000132', 20 | 'RqHeader' => [ 21 | 'Timestamp' => time(), 22 | 'Revision' => '1.0.0', 23 | ], 24 | 'Data' => $data, 25 | ]; 26 | $url = 'https://logistics-stage.ecpay.com.tw/Express/v2/UpdateShipmentInfo'; 27 | 28 | $response = $postService->post($input, $url); 29 | var_dump($response); 30 | -------------------------------------------------------------------------------- /example/Logistics/AllInOne/C2C/CancelC2cOrder.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'LogisticsID' => '1770265', 16 | 'CVSPaymentNo' => 'C1234567', 17 | 'CVSValidationNo' => '4111', 18 | ]; 19 | $input = [ 20 | 'MerchantID' => '2000132', 21 | 'RqHeader' => [ 22 | 'Timestamp' => time(), 23 | 'Revision' => '1.0.0', 24 | ], 25 | 'Data' => $data, 26 | ]; 27 | $url = 'https://logistics-stage.ecpay.com.tw/Express/v2/CancelC2COrder'; 28 | 29 | $response = $postService->post($input, $url); 30 | var_dump($response); 31 | -------------------------------------------------------------------------------- /example/Logistics/AllInOne/C2C/UpdateStoreInfo.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'LogisticsID' => '1770242', 16 | 'CVSPaymentNo' => '144310142000', 17 | 'CVSValidationNo' => '9926', 18 | 'StoreType' => '01', 19 | 'ReceiverStoreID' => '018527', 20 | ]; 21 | $input = [ 22 | 'MerchantID' => '2000132', 23 | 'RqHeader' => [ 24 | 'Timestamp' => time(), 25 | 'Revision' => '1.0.0', 26 | ], 27 | 'Data' => $data, 28 | ]; 29 | $url = 'https://logistics-stage.ecpay.com.tw/Express/v2/UpdateStoreInfo'; 30 | 31 | $response = $postService->post($input, $url); 32 | var_dump($response); 33 | -------------------------------------------------------------------------------- /example/Logistics/AllInOne/CreateByTempTrade.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'TempLogisticsID' => '2264', 15 | ]; 16 | $input = [ 17 | 'MerchantID' => '2000132', 18 | 'RqHeader' => [ 19 | 'Timestamp' => time(), 20 | 'Revision' => '1.0.0', 21 | ], 22 | 'Data' => $data, 23 | ]; 24 | $url = 'https://logistics-stage.ecpay.com.tw/Express/v2/CreateByTempTrade'; 25 | 26 | $response = $postService->post($input, $url); 27 | var_dump($response); 28 | -------------------------------------------------------------------------------- /example/Logistics/AllInOne/Home/ReturnHome.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'LogisticsID' => '1769853', 16 | 'GoodsAmount' => 130, 17 | 'Temperature' => '0001', 18 | 'Distance' => '00', 19 | 'Specification' => '0001', 20 | 21 | // 請參考 example/Logistics/AllInOne/LogisticsStatusNotify.php 範例開發 22 | 'ServerReplyURL' => 'https://www.ecpay.com.tw/example/server-reply', 23 | ]; 24 | $input = [ 25 | 'MerchantID' => '2000132', 26 | 'RqHeader' => [ 27 | 'Timestamp' => time(), 28 | 'Revision' => '1.0.0', 29 | ], 30 | 'Data' => $data, 31 | ]; 32 | $url = 'https://logistics-stage.ecpay.com.tw/Express/v2/ReturnHome'; 33 | 34 | $response = $postService->post($input, $url); 35 | var_dump($response); 36 | -------------------------------------------------------------------------------- /example/Logistics/AllInOne/LogisticsStatusNotify.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 11 | 'hashIv' => 'v77hoKGq4kWxNNIS', 12 | ]); 13 | $aesParser = $factory->create(AesParser::class); 14 | $parsedRequest = $aesParser->get(file_get_contents('php://input')); 15 | 16 | // 物流狀態(貨態) or 物流狀態(逆物流)通知相關處理 17 | 18 | $aesGenerater = $factory->create(AesGenerater::class); 19 | $data = [ 20 | 'RtnCode' => '1', 21 | 'RtnMsg' => '', 22 | ]; 23 | $input = [ 24 | 'MerchantID' => '2000132', 25 | 'RqHeader' => [ 26 | 'Timestamp' => time(), 27 | ], 28 | 'TransCode' => '1', 29 | 'TransMsg' => '', 30 | 'Data' => $data, 31 | ]; 32 | $response = $aesGenerater->get($input); 33 | var_dump($response); 34 | -------------------------------------------------------------------------------- /example/Logistics/AllInOne/PrintTradeDocument.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | ]); 11 | $postService = $factory->create('PostWithAesStrResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'LogisticsID' => ['1769543'], 16 | 'LogisticsSubType' => 'FAMI', 17 | ]; 18 | $input = [ 19 | 'MerchantID' => '2000132', 20 | 'RqHeader' => [ 21 | 'Timestamp' => time(), 22 | 'Revision' => '1.0.0', 23 | ], 24 | 'Data' => $data, 25 | ]; 26 | $url = 'https://logistics-stage.ecpay.com.tw/Express/v2/PrintTradeDocument'; 27 | 28 | $response = $postService->post($input, $url); 29 | echo $response['body']; 30 | -------------------------------------------------------------------------------- /example/Logistics/AllInOne/QueryLogisticsTradeInfo.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'LogisticsID' => '1769853', 16 | ]; 17 | $input = [ 18 | 'MerchantID' => '2000132', 19 | 'RqHeader' => [ 20 | 'Timestamp' => time(), 21 | 'Revision' => '1.0.0', 22 | ], 23 | 'Data' => $data, 24 | ]; 25 | $url = 'https://logistics-stage.ecpay.com.tw/Express/v2/QueryLogisticsTradeInfo'; 26 | 27 | $response = $postService->post($input, $url); 28 | var_dump($response); 29 | -------------------------------------------------------------------------------- /example/Logistics/AllInOne/RedirectToLogisticsSelection.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | ]); 11 | $postService = $factory->create('PostWithAesStrResponseService'); 12 | 13 | $data = [ 14 | 'TempLogisticsID' => '0', 15 | 'GoodsAmount' => 100, 16 | 'GoodsName' => '範例商品', 17 | 'SenderName' => '陳大明', 18 | 'SenderZipCode' => '11560', 19 | 'SenderAddress' => '台北市南港區三重路19-2號6樓', 20 | 21 | // 請參考 example/Logistics/AllInOne/LogisticsStatusNotify.php 範例開發 22 | 'ServerReplyURL' => 'https://www.ecpay.com.tw/example/server-reply', 23 | 24 | // 請參考 example/Logistics/AllInOne/TempTradeEstablishedResponse.php 範例開發 25 | 'ClientReplyURL' => 'https://www.ecpay.com.tw/example/client-reply', 26 | ]; 27 | $input = [ 28 | 'MerchantID' => '2000132', 29 | 'RqHeader' => [ 30 | 'Timestamp' => time(), 31 | 'Revision' => '1.0.0', 32 | ], 33 | 'Data' => $data, 34 | ]; 35 | $url = 'https://logistics-stage.ecpay.com.tw/Express/v2/RedirectToLogisticsSelection'; 36 | 37 | $response = $postService->post($input, $url); 38 | echo $response['body']; 39 | -------------------------------------------------------------------------------- /example/Logistics/AllInOne/RedirectWithUnimartFreeze.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | ]); 11 | $postService = $factory->create('PostWithAesStrResponseService'); 12 | 13 | $data = [ 14 | 'TempLogisticsID' => '0', 15 | 'GoodsAmount' => 100, 16 | 'GoodsName' => '範例商品', 17 | 'SenderName' => '陳大明', 18 | 'SenderZipCode' => '11560', 19 | 'SenderAddress' => '台北市南港區三重路19-2號6樓', 20 | 'Temperature' => '0003', 21 | 22 | // 請參考 example/Logistics/AllInOne/LogisticsStatusNotify.php 範例開發 23 | 'ServerReplyURL' => 'https://www.ecpay.com.tw/example/server-reply', 24 | 25 | // 請參考 example/Logistics/AllInOne/TempTradeEstablishedResponse.php 範例開發 26 | 'ClientReplyURL' => 'https://www.ecpay.com.tw/example/client-reply', 27 | ]; 28 | $input = [ 29 | 'MerchantID' => '2000132', 30 | 'RqHeader' => [ 31 | 'Timestamp' => time(), 32 | 'Revision' => '1.0.0', 33 | ], 34 | 'Data' => $data, 35 | ]; 36 | $url = 'https://logistics-stage.ecpay.com.tw/Express/v2/RedirectToLogisticsSelection'; 37 | 38 | $response = $postService->post($input, $url); 39 | echo $response['body']; 40 | -------------------------------------------------------------------------------- /example/Logistics/AllInOne/TempTradeEstablishedResponse.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 10 | 'hashIv' => 'v77hoKGq4kWxNNIS', 11 | ]); 12 | $response = $factory->create(AesJsonResponse::class); 13 | $parsed = []; 14 | $parsed['ResultData'] = $response->get($_POST['ResultData']); 15 | var_dump($parsed); 16 | -------------------------------------------------------------------------------- /example/Logistics/AllInOne/UpdateTempTrade.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | $data = [ 13 | 'TempLogisticsID' => '2264', 14 | 'SenderName' => '王小美', 15 | ]; 16 | $input = [ 17 | 'MerchantID' => '2000132', 18 | 'RqHeader' => [ 19 | 'Timestamp' => time(), 20 | 'Revision' => '1.0.0', 21 | ], 22 | 'Data' => $data, 23 | ]; 24 | $url = 'https://logistics-stage.ecpay.com.tw/Express/v2/UpdateTempTrade'; 25 | 26 | $response = $postService->post($input, $url); 27 | var_dump($response); 28 | -------------------------------------------------------------------------------- /example/Logistics/CrossBorder/CreateTestData.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'Country' => 'SG', 16 | 'LogisticsType' => 'CB', 17 | 'LogisticsSubType' => 'UNIMARTCBCVS', 18 | ]; 19 | $input = [ 20 | 'MerchantID' => '2000132', 21 | 'RqHeader' => [ 22 | 'Timestamp' => time(), 23 | 'Revision' => '1.0.0', 24 | ], 25 | 'Data' => $data, 26 | ]; 27 | $url = 'https://logistics-stage.ecpay.com.tw/CrossBorder/CreateTestData'; 28 | 29 | $response = $postService->post($input, $url); 30 | var_dump($response); 31 | -------------------------------------------------------------------------------- /example/Logistics/CrossBorder/CreateUnimartCvsOrder.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'MerchantTradeDate' => date('Y/m/d H:i:s'), 16 | 'MerchantTradeNo' => 'Test' . time(), 17 | 'LogisticsType' => 'CB', 18 | 'LogisticsSubType' => 'UNIMARTCBCVS', 19 | 'GoodsAmount' => 1000, 20 | 'GoodsWeight' => 5.0, 21 | 'GoodsEnglishName' => 'Test goods', 22 | 'ReceiverCountry' => 'SG', 23 | 'ReceiverName' => 'Test Receiver', 24 | 'ReceiverCellPhone' => '65212345678', 25 | 'ReceiverStoreID' => '711_1', 26 | 'ReceiverZipCode' => '419701', 27 | 'ReceiverAddress' => 'address 23424 -fr 13-2', 28 | 'ReceiverEmail' => 'test-receiver@ecpay.com.tw', 29 | 'SenderName' => 'Test Sender', 30 | 'SenderCellPhone' => '886987654321', 31 | 'SenderAddress' => 'address 23424 -fr 13-2, Nangang Dist., Taipei City 115, Taiwan (R.O.C.)', 32 | 'SenderEmail' => 'test-sender@ecpay.com.tw', 33 | 'Remark' => 'Test Remark', 34 | 35 | // 請參考 example/Logistics/CrossBorder/GetStatusChangedResponse.php 範例開發 36 | 'ServerReplyURL' => 'https://logistics-stage.ecpay.com.tw/MockMerchant/NoticsTestRtn', 37 | ]; 38 | $input = [ 39 | 'MerchantID' => '2000132', 40 | 'RqHeader' => [ 41 | 'Timestamp' => time(), 42 | 'Revision' => '1.0.0', 43 | ], 44 | 'Data' => $data, 45 | ]; 46 | $url = 'https://logistics-stage.ecpay.com.tw/CrossBorder/Create'; 47 | 48 | $response = $postService->post($input, $url); 49 | var_dump($response); 50 | -------------------------------------------------------------------------------- /example/Logistics/CrossBorder/CreateUnimartHomeOrder.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'MerchantTradeDate' => date('Y/m/d H:i:s'), 16 | 'MerchantTradeNo' => 'Test' . time(), 17 | 'LogisticsType' => 'CB', 18 | 'LogisticsSubType' => 'UNIMARTCBHOME', 19 | 'GoodsAmount' => 1000, 20 | 'GoodsWeight' => 5.0, 21 | 'GoodsEnglishName' => 'Test goods', 22 | 'ReceiverCountry' => 'SG', 23 | 'ReceiverName' => 'Test Receiver', 24 | 'ReceiverCellPhone' => '65212345678', 25 | 'ReceiverZipCode' => '419701', 26 | 'ReceiverAddress' => 'address 23424 -fr 13-2', 27 | 'ReceiverEmail' => 'test-receiver@ecpay.com.tw', 28 | 'SenderName' => 'Test Sender', 29 | 'SenderCellPhone' => '886987654321', 30 | 'SenderAddress' => 'address 23424 -fr 13-2, Nangang Dist., Taipei City 115, Taiwan (R.O.C.)', 31 | 'SenderEmail' => 'test-sender@ecpay.com.tw', 32 | 'Remark' => 'Test Remark', 33 | 34 | // 請參考 example/Logistics/CrossBorder/GetStatusChangedResponse.php 範例開發 35 | 'ServerReplyURL' => 'https://logistics-stage.ecpay.com.tw/MockMerchant/NoticsTestRtn', 36 | ]; 37 | $input = [ 38 | 'MerchantID' => '2000132', 39 | 'RqHeader' => [ 40 | 'Timestamp' => time(), 41 | 'Revision' => '1.0.0', 42 | ], 43 | 'Data' => $data, 44 | ]; 45 | $url = 'https://logistics-stage.ecpay.com.tw/CrossBorder/Create'; 46 | 47 | $response = $postService->post($input, $url); 48 | var_dump($response); 49 | -------------------------------------------------------------------------------- /example/Logistics/CrossBorder/GetMapResponse.php: -------------------------------------------------------------------------------- 1 | create(ArrayResponse::class); 10 | 11 | var_dump($arrayResponse->get($_POST)); 12 | -------------------------------------------------------------------------------- /example/Logistics/CrossBorder/GetStatusChangedResponse.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 10 | 'hashIv' => 'v77hoKGq4kWxNNIS', 11 | ]); 12 | $aesJsonResponse = $factory->create(AesJsonResponse::class); 13 | $response = file_get_contents('php://input'); 14 | 15 | var_dump($aesJsonResponse->get($response)); 16 | -------------------------------------------------------------------------------- /example/Logistics/CrossBorder/Map.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | ]); 11 | $postService = $factory->create('AutoSubmitFormService'); 12 | 13 | $input = [ 14 | 'MerchantID' => '2000132', 15 | 'MerchantTradeNo' => 'Test' . time(), 16 | 'LogisticsType' => 'CB', 17 | 'LogisticsSubType' => 'UNIMARTCBCVS', 18 | 'Destination' => 'SG', 19 | 20 | // 請參考 example/Logistics/CrossBorder/GetMapResponse.php 範例開發 21 | 'ServerReplyURL' => 'https://logistics-stage.ecpay.com.tw/MockMerchant/NoticsTestRtn', 22 | ]; 23 | $action = 'https://logistics-stage.ecpay.com.tw/CrossBorder/Map'; 24 | 25 | echo $postService->generate($input, $action); 26 | -------------------------------------------------------------------------------- /example/Logistics/CrossBorder/Print.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'LogisticsID' => '1658389', 16 | ]; 17 | $input = [ 18 | 'MerchantID' => '2000132', 19 | 'RqHeader' => [ 20 | 'Timestamp' => time(), 21 | 'Revision' => '1.0.0', 22 | ], 23 | 'Data' => $data, 24 | ]; 25 | $url = 'https://logistics-stage.ecpay.com.tw/CrossBorder/Print'; 26 | 27 | $response = $postService->post($input, $url); 28 | var_dump($response); 29 | -------------------------------------------------------------------------------- /example/Logistics/CrossBorder/QueryLogisticsTradeInfo.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'MerchantID' => '2000132', 15 | 'LogisticsID' => '1658389', 16 | ]; 17 | $input = [ 18 | 'MerchantID' => '2000132', 19 | 'RqHeader' => [ 20 | 'Timestamp' => time(), 21 | 'Revision' => '1.0.0', 22 | ], 23 | 'Data' => $data, 24 | ]; 25 | $url = 'https://logistics-stage.ecpay.com.tw/CrossBorder/QueryLogisticsTradeInfo'; 26 | 27 | $response = $postService->post($input, $url); 28 | var_dump($response); 29 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/CancelC2cOrder.php: -------------------------------------------------------------------------------- 1 | 'XBERn1YOvpM9nfZc', 9 | 'hashIv' => 'h1ONHk4P4yqbl5LK', 10 | 'hashMethod' => 'md5', 11 | ]); 12 | $postService = $factory->create('PostWithCmvStrResponseService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '2000933', 16 | 'AllPayLogisticsID' => '1718552', 17 | 'CVSPaymentNo' => 'C9681067', 18 | 'CVSValidationNo' => '2448', 19 | ]; 20 | $url = 'https://logistics-stage.ecpay.com.tw/Express/CancelC2COrder'; 21 | 22 | $response = $postService->post($input, $url); 23 | var_dump($response); 24 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/CreateCvs.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | 'hashMethod' => 'md5', 11 | ]); 12 | $postService = $factory->create('PostWithCmvEncodedStrResponseService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '2000132', 16 | 'MerchantTradeNo' => 'Test' . time(), 17 | 'MerchantTradeDate' => date('Y/m/d H:i:s'), 18 | 'LogisticsType' => 'CVS', 19 | 'LogisticsSubType' => 'FAMI', 20 | 'GoodsAmount' => 1000, 21 | 'GoodsName' => '綠界 SDK 範例商品', 22 | 'SenderName' => '陳大明', 23 | 'SenderCellPhone' => '0911222333', 24 | 'ReceiverName' => '王小美', 25 | 'ReceiverCellPhone' => '0933222111', 26 | 27 | // 請參考 example/Logistics/Domestic/GetLogisticStatueResponse.php 範例開發 28 | 'ServerReplyURL' => 'https://www.ecpay.com.tw/example/server-reply', 29 | 30 | // 請參考 example/Logistics/Domestic/GetMapResponse.php 範例取得 31 | 'ReceiverStoreID' => '006598', 32 | ]; 33 | $url = 'https://logistics-stage.ecpay.com.tw/Express/Create'; 34 | 35 | $response = $postService->post($input, $url); 36 | var_dump($response); 37 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/CreateCvsForm.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | 'hashMethod' => 'md5', 11 | ]); 12 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '2000132', 16 | 'MerchantTradeNo' => 'Test' . time(), 17 | 'MerchantTradeDate' => date('Y/m/d H:i:s'), 18 | 'LogisticsType' => 'CVS', 19 | 'LogisticsSubType' => 'FAMI', 20 | 'GoodsAmount' => 1000, 21 | 'GoodsName' => '綠界 SDK 範例商品', 22 | 'SenderName' => '陳大明', 23 | 'SenderCellPhone' => '0911222333', 24 | 'ReceiverName' => '王小美', 25 | 'ReceiverCellPhone' => '0933222111', 26 | 27 | // 請參考 example/Logistics/Domestic/GetLogisticStatueResponse.php 範例開發 28 | 'ServerReplyURL' => 'https://www.ecpay.com.tw/example/server-reply', 29 | 'ClientReplyURL' => 'https://www.ecpay.com.tw/example/client-reply', 30 | 31 | // 請參考 example/Logistics/Domestic/GetMapResponse.php 範例取得 32 | 'ReceiverStoreID' => '006598' 33 | ]; 34 | $action = 'https://logistics-stage.ecpay.com.tw/Express/Create'; 35 | 36 | echo $autoSubmitFormService->generate($input, $action); 37 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/CreateHome.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | 'hashMethod' => 'md5', 11 | ]); 12 | $postService = $factory->create('PostWithCmvEncodedStrResponseService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '2000132', 16 | 'MerchantTradeNo' => 'Test' . time(), 17 | 'MerchantTradeDate' => date('Y/m/d H:i:s'), 18 | 'LogisticsType' => 'HOME', 19 | 'LogisticsSubType' => 'TCAT', 20 | 'GoodsAmount' => 1000, 21 | 'GoodsName' => '綠界 SDK 範例商品', 22 | 'SenderName' => '陳大明', 23 | 'SenderCellPhone' => '0911222333', 24 | 'SenderZipCode' => '11560', 25 | 'SenderAddress' => '台北市南港區三重路19-2號6樓', 26 | 'ReceiverName' => '王小美', 27 | 'ReceiverCellPhone' => '0933222111', 28 | 'ReceiverZipCode' => '11560', 29 | 'ReceiverAddress' => '台北市南港區三重路19-2號6樓', 30 | 'Temperature' => '0001', 31 | 'Distance' => '00', 32 | 'Specification' => '0001', 33 | 'ScheduledPickupTime' => '4', 34 | 'ScheduledDeliveryTime' => '4', 35 | 36 | // 請參考 example/Logistics/Domestic/GetLogisticStatueResponse.php 範例開發 37 | 'ServerReplyURL' => 'https://www.ecpay.com.tw/example/server-reply', 38 | ]; 39 | $url = 'https://logistics-stage.ecpay.com.tw/Express/Create'; 40 | 41 | $response = $postService->post($input, $url); 42 | var_dump($response); 43 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/CreateHomeForm.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | 'hashMethod' => 'md5', 11 | ]); 12 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '2000132', 16 | 'MerchantTradeNo' => 'Test' . time(), 17 | 'MerchantTradeDate' => date('Y/m/d H:i:s'), 18 | 'LogisticsType' => 'HOME', 19 | 'LogisticsSubType' => 'TCAT', 20 | 'GoodsAmount' => 1000, 21 | 'GoodsName' => '綠界 SDK 範例商品', 22 | 'SenderName' => '陳大明', 23 | 'SenderCellPhone' => '0911222333', 24 | 'SenderZipCode' => '11560', 25 | 'SenderAddress' => '台北市南港區三重路19-2號6樓', 26 | 'ReceiverName' => '王小美', 27 | 'ReceiverCellPhone' => '0933222111', 28 | 'ReceiverZipCode' => '11560', 29 | 'ReceiverAddress' => '台北市南港區三重路19-2號6樓', 30 | 'Temperature' => '0001', 31 | 'Distance' => '00', 32 | 'Specification' => '0001', 33 | 'ScheduledPickupTime' => '4', 34 | 'ScheduledDeliveryTime' => '4', 35 | 36 | // 請參考 example/Logistics/Domestic/GetLogisticStatueResponse.php 範例開發 37 | 'ServerReplyURL' => 'https://www.ecpay.com.tw/example/server-reply', 38 | 'ClientReplyURL' => 'https://www.ecpay.com.tw/example/client-reply', 39 | ]; 40 | $action = 'https://logistics-stage.ecpay.com.tw/Express/Create'; 41 | 42 | echo $autoSubmitFormService->generate($input, $action); 43 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/CreateTestData.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | 'hashMethod' => 'md5', 11 | ]); 12 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '2000132', 16 | 'LogisticsSubType' => 'FAMI', 17 | 18 | // 請參考 example/Logistics/Domestic/GetCreateTestDataResponse.php 範例開發 19 | 'ClientReplyURL' => 'https://www.ecpay.com.tw/example/client-reply', 20 | 21 | ]; 22 | $action = 'https://logistics-stage.ecpay.com.tw/Express/CreateTestData'; 23 | 24 | echo $autoSubmitFormService->generate($input, $action); 25 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/CreateUnimartFreeze.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | 'hashMethod' => 'md5', 11 | ]); 12 | $postService = $factory->create('PostWithCmvEncodedStrResponseService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '2000132', 16 | 'MerchantTradeNo' => 'Test' . time(), 17 | 'MerchantTradeDate' => date('Y/m/d H:i:s'), 18 | 'LogisticsType' => 'CVS', 19 | 'LogisticsSubType' => 'UNIMARTFREEZE', 20 | 'GoodsAmount' => 1000, 21 | 'GoodsName' => '綠界 SDK 範例商品', 22 | 'SenderName' => '陳大明', 23 | 'SenderCellPhone' => '0911222333', 24 | 'ReceiverName' => '王小美', 25 | 'ReceiverCellPhone' => '0933222111', 26 | 27 | // 請參考 example/Logistics/Domestic/GetLogisticStatueResponse.php 範例開發 28 | 'ServerReplyURL' => 'https://www.ecpay.com.tw/example/server-reply', 29 | 30 | // 請參考 example/Logistics/Domestic/GetMapResponse.php 範例取得 31 | 'ReceiverStoreID' => '896539', 32 | ]; 33 | $url = 'https://logistics-stage.ecpay.com.tw/Express/Create'; 34 | 35 | $response = $postService->post($input, $url); 36 | var_dump($response); 37 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/GetCreateTestDataResponse.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 10 | 'hashIv' => 'v77hoKGq4kWxNNIS', 11 | 'hashMethod' => 'md5', 12 | ]); 13 | $checkoutResponse = $factory->create(VerifiedArrayResponse::class); 14 | 15 | var_dump($checkoutResponse->get($_POST)); 16 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/GetLogisticStatueResponse.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 10 | 'hashIv' => 'v77hoKGq4kWxNNIS', 11 | 'hashMethod' => 'md5', 12 | ]); 13 | $checkoutResponse = $factory->create(VerifiedArrayResponse::class); 14 | 15 | var_dump($checkoutResponse->get($_POST)); 16 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/GetMapResponse.php: -------------------------------------------------------------------------------- 1 | create(ArrayResponse::class); 10 | 11 | var_dump($response->get($_POST)); 12 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/GetReturnResponse.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 10 | 'hashIv' => 'v77hoKGq4kWxNNIS', 11 | 'hashMethod' => 'md5', 12 | ]); 13 | $checkoutResponse = $factory->create(VerifiedArrayResponse::class); 14 | 15 | var_dump($checkoutResponse->get($_POST)); 16 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/GetStoreList.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | 'hashMethod' => 'md5', 11 | ]); 12 | $postService = $factory->create('PostWithCmvJsonResponseService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '2000132', 16 | 17 | // 超商類別(最新類別請參考開發文件: https://developers.ecpay.com.tw/?p=47496) 18 | // 1. All 19 | // 2. FAMI: 全家 20 | // 3. UNIMART: 7-ELEVEN超商(常溫) 21 | // 4. HILIFE: 萊爾富 22 | // 5. OKMART: OK超商 23 | // 6. UNIMARTFREEZE: 7-ELEVEN超商(冷鏈) 24 | 'CvsType' => 'All', 25 | ]; 26 | $url = 'https://logistics-stage.ecpay.com.tw/Helper/GetStoreList'; 27 | 28 | $response = $postService->post($input, $url); 29 | var_dump($response); 30 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/Map.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | 'hashMethod' => 'md5', 11 | ]); 12 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '2000132', 16 | 'MerchantTradeNo' => 'Test' . time(), 17 | 'LogisticsType' => 'CVS', 18 | 'LogisticsSubType' => 'FAMI', 19 | 'IsCollection' => 'N', 20 | 21 | // 請參考 example/Logistics/Domestic/GetMapResponse.php 範例開發 22 | 'ServerReplyURL' => 'https://www.ecpay.com.tw/example/server-reply', 23 | ]; 24 | $action = 'https://logistics-stage.ecpay.com.tw/Express/map'; 25 | 26 | echo $autoSubmitFormService->generate($input, $action); 27 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/PrintFamic2cOrderInfo.php: -------------------------------------------------------------------------------- 1 | 'XBERn1YOvpM9nfZc', 9 | 'hashIv' => 'h1ONHk4P4yqbl5LK', 10 | 'hashMethod' => 'md5', 11 | ]); 12 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '2000933', 16 | 'AllPayLogisticsID' => '1717813', 17 | 'CVSPaymentNo' => '11000062128', 18 | ]; 19 | $action = 'https://logistics-stage.ecpay.com.tw/Express/PrintFAMIC2COrderInfo'; 20 | 21 | echo $autoSubmitFormService->generate($input, $action); 22 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/PrintHilifec2cOrderInfo.php: -------------------------------------------------------------------------------- 1 | 'XBERn1YOvpM9nfZc', 9 | 'hashIv' => 'h1ONHk4P4yqbl5LK', 10 | 'hashMethod' => 'md5', 11 | ]); 12 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '2000933', 16 | 'AllPayLogisticsID' => '1717823', 17 | 'CVSPaymentNo' => '161D54490371', 18 | ]; 19 | $action = 'https://logistics-stage.ecpay.com.tw/Express/PrintHILIFEC2COrderInfo'; 20 | 21 | echo $autoSubmitFormService->generate($input, $action); 22 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/PrintOkmartc2cOrderInfo.php: -------------------------------------------------------------------------------- 1 | 'XBERn1YOvpM9nfZc', 9 | 'hashIv' => 'h1ONHk4P4yqbl5LK', 10 | 'hashMethod' => 'md5', 11 | ]); 12 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '2000933', 16 | 'AllPayLogisticsID' => '1717858', 17 | 'CVSPaymentNo' => 'W5254579754', 18 | ]; 19 | $action = 'https://logistics-stage.ecpay.com.tw/Express/PrintOKMARTC2COrderInfo'; 20 | 21 | echo $autoSubmitFormService->generate($input, $action); 22 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/PrintTradeDocument.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | 'hashMethod' => 'md5', 11 | ]); 12 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '2000132', 16 | 'AllPayLogisticsID' => '1717876', 17 | ]; 18 | $action = 'https://logistics-stage.ecpay.com.tw/helper/printTradeDocument'; 19 | 20 | echo $autoSubmitFormService->generate($input, $action); 21 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/PrintUniMartc2cOrderInfo.php: -------------------------------------------------------------------------------- 1 | 'XBERn1YOvpM9nfZc', 9 | 'hashIv' => 'h1ONHk4P4yqbl5LK', 10 | 'hashMethod' => 'md5', 11 | ]); 12 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '2000933', 16 | 'AllPayLogisticsID' => '1717812', 17 | 'CVSPaymentNo' => 'C9680734', 18 | 'CVSValidationNo' => '4551', 19 | ]; 20 | $action = 'https://logistics-stage.ecpay.com.tw/Express/PrintUniMartC2COrderInfo'; 21 | 22 | echo $autoSubmitFormService->generate($input, $action); 23 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/QueryLogisticsTradeInfo.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | 'hashMethod' => 'md5', 11 | ]); 12 | $postService = $factory->create('PostWithCmvVerifiedEncodedStrResponseService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '2000132', 16 | 'AllPayLogisticsID' => '1718546', 17 | 'TimeStamp' => time(), 18 | ]; 19 | $url = 'https://logistics-stage.ecpay.com.tw/Helper/QueryLogisticsTradeInfo/V2'; 20 | 21 | $response = $postService->post($input, $url); 22 | var_dump($response); 23 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/ReturnFamiCvs.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | 'hashMethod' => 'md5', 11 | ]); 12 | $postService = $factory->create('PostWithCmvStrResponseService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '2000132', 16 | 'GoodsAmount' => 1000, 17 | 'ServiceType' => '4', 18 | 'SenderName' => '陳大明', 19 | 20 | // 請參考 example/Logistics/Domestic/GetReturnResponse.php 範例開發 21 | 'ServerReplyURL' => 'https://www.ecpay.com.tw/example/server-reply', 22 | ]; 23 | $url = 'https://logistics-stage.ecpay.com.tw/express/ReturnCVS'; 24 | 25 | $response = $postService->post($input, $url); 26 | var_dump($response); 27 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/ReturnHome.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | 'hashMethod' => 'md5', 11 | ]); 12 | $postService = $factory->create('PostWithCmvStrResponseService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '2000132', 16 | 'AllPayLogisticsID' => '1718537', 17 | 'GoodsAmount' => 1000, 18 | 'Temperature' => '0001', 19 | 'Distance' => '00', 20 | 21 | // 請參考 example/Logistics/Domestic/GetReturnResponse.php 範例開發 22 | 'ServerReplyURL' => 'https://www.ecpay.com.tw/example/server-reply', 23 | ]; 24 | $url = 'https://logistics-stage.ecpay.com.tw/Express/ReturnHome'; 25 | 26 | $response = $postService->post($input, $url); 27 | var_dump($response); 28 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/ReturnUniMartCvs.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | 'hashMethod' => 'md5', 11 | ]); 12 | $postService = $factory->create('PostWithCmvStrResponseService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '2000132', 16 | 'GoodsAmount' => 1000, 17 | 'ServiceType' => '4', 18 | 'SenderName' => '陳大明', 19 | 20 | // 請參考 example/Logistics/Domestic/GetReturnResponse.php 範例開發 21 | 'ServerReplyURL' => 'https://www.ecpay.com.tw/example/server-reply', 22 | ]; 23 | $url = 'https://logistics-stage.ecpay.com.tw/express/ReturnUniMartCVS'; 24 | 25 | $response = $postService->post($input, $url); 26 | var_dump($response); 27 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/UpdateShipmentInfo.php: -------------------------------------------------------------------------------- 1 | '5294y06JbISpM5x9', 9 | 'hashIv' => 'v77hoKGq4kWxNNIS', 10 | 'hashMethod' => 'md5', 11 | ]); 12 | $postService = $factory->create('PostWithCmvStrResponseService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '2000132', 16 | 'AllPayLogisticsID' => '1718550', 17 | 'ShipmentDate' => date('Y/m/d'), 18 | ]; 19 | $url = 'https://logistics-stage.ecpay.com.tw/Helper/UpdateShipmentInfo'; 20 | 21 | $response = $postService->post($input, $url); 22 | var_dump($response); 23 | -------------------------------------------------------------------------------- /example/Logistics/Domestic/UpdateStoreInfo.php: -------------------------------------------------------------------------------- 1 | 'XBERn1YOvpM9nfZc', 9 | 'hashIv' => 'h1ONHk4P4yqbl5LK', 10 | 'hashMethod' => 'md5', 11 | ]); 12 | $postService = $factory->create('PostWithCmvStrResponseService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '2000933', 16 | 'AllPayLogisticsID' => '1718552', 17 | 'CVSPaymentNo' => 'C9681067', 18 | 'CVSValidationNo' => '2448', 19 | 'StoreType' => '01', 20 | 'ReceiverStoreID' => '131386', 21 | ]; 22 | $url = 'https://logistics-stage.ecpay.com.tw/Express/UpdateStoreInfo'; 23 | 24 | $response = $postService->post($input, $url); 25 | var_dump($response); 26 | -------------------------------------------------------------------------------- /example/Logistics/crossborder_logistics_status.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ECPay/SDK_PHP/e25fcc04f43f52bce152167d040826ebebb70fe4/example/Logistics/crossborder_logistics_status.xlsx -------------------------------------------------------------------------------- /example/Logistics/logistics_history.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ECPay/SDK_PHP/e25fcc04f43f52bce152167d040826ebebb70fe4/example/Logistics/logistics_history.xlsx -------------------------------------------------------------------------------- /example/Logistics/logistics_status.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ECPay/SDK_PHP/e25fcc04f43f52bce152167d040826ebebb70fe4/example/Logistics/logistics_status.xlsx -------------------------------------------------------------------------------- /example/Payment/Aio/Capture.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 9 | 'hashIv' => 'EkRm7iFT261dpevs', 10 | ]); 11 | $postService = $factory->create('PostWithCmvEncodedStrResponseService'); 12 | 13 | $input = [ 14 | 'MerchantID' => '3002607', 15 | 'MerchantTradeNo' => '5fa271cc74e51', 16 | 'TradeNo' => '2011041718071855', 17 | 'Action' => 'C', 18 | 'TotalAmount' => 8685, 19 | ]; 20 | $url = 'https://payment-stage.ecpay.com.tw/CreditDetail/DoAction'; 21 | 22 | $response = $postService->post($input, $url); 23 | var_dump($response); 24 | -------------------------------------------------------------------------------- /example/Payment/Aio/CreateAtmOrder.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 10 | 'hashIv' => 'EkRm7iFT261dpevs', 11 | ]); 12 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '3002607', 16 | 'MerchantTradeNo' => 'Test' . time(), 17 | 'MerchantTradeDate' => date('Y/m/d H:i:s'), 18 | 'PaymentType' => 'aio', 19 | 'TotalAmount' => 100, 20 | 'TradeDesc' => UrlService::ecpayUrlEncode('交易描述範例'), 21 | 'ItemName' => '範例商品一批 100 TWD x 1', 22 | 'ChoosePayment' => 'ATM', 23 | 'EncryptType' => 1, 24 | 25 | // ATM 專用參數 26 | 'ExpireDate' => 7, 27 | 28 | // 請參考 example/Payment/GetCheckoutResponse.php 範例開發 29 | 'ReturnURL' => 'https://www.ecpay.com.tw/example/receive', 30 | 'PaymentInfoURL' => 'https://www.ecpay.com.tw/example/payment-info', 31 | ]; 32 | $action = 'https://payment-stage.ecpay.com.tw/Cashier/AioCheckOut/V5'; 33 | 34 | echo $autoSubmitFormService->generate($input, $action); 35 | -------------------------------------------------------------------------------- /example/Payment/Aio/CreateBarcodeOrder.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 10 | 'hashIv' => 'EkRm7iFT261dpevs', 11 | ]); 12 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '3002607', 16 | 'MerchantTradeNo' => 'Test' . time(), 17 | 'MerchantTradeDate' => date('Y/m/d H:i:s'), 18 | 'PaymentType' => 'aio', 19 | 'TotalAmount' => 100, 20 | 'TradeDesc' => UrlService::ecpayUrlEncode('交易描述範例'), 21 | 'ItemName' => '範例商品一批 100 TWD x 1', 22 | 'ChoosePayment' => 'BARCODE', 23 | 'EncryptType' => 1, 24 | 25 | // Barcode 專用參數 26 | 'StoreExpireDate' => 5, 27 | 'Desc_1' => '範例交易描述 1', 28 | 'Desc_2' => '範例交易描述 2', 29 | 'Desc_3' => '範例交易描述 3', 30 | 'Desc_4' => '範例交易描述 4', 31 | 32 | // 請參考 example/Payment/GetCheckoutResponse.php 範例開發 33 | 'ReturnURL' => 'https://www.ecpay.com.tw/example/receive', 34 | 'PaymentInfoURL' => 'https://www.ecpay.com.tw/example/payment-info', 35 | ]; 36 | $action = 'https://payment-stage.ecpay.com.tw/Cashier/AioCheckOut/V5'; 37 | 38 | echo $autoSubmitFormService->generate($input, $action); 39 | -------------------------------------------------------------------------------- /example/Payment/Aio/CreateBnplOrder.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 10 | 'hashIv' => 'EkRm7iFT261dpevs', 11 | ]); 12 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '3002607', 16 | 'MerchantTradeNo' => 'Test' . time(), 17 | 'MerchantTradeDate' => date('Y/m/d H:i:s'), 18 | 'PaymentType' => 'aio', 19 | 'TotalAmount' => 3000, // 金額須大於2999 20 | 'TradeDesc' => UrlService::ecpayUrlEncode('交易描述範例'), 21 | 'ItemName' => '範例商品一批 100 TWD x 1', 22 | 'ChoosePayment' => 'BNPL', 23 | 'EncryptType' => 1, 24 | 25 | // 請參考 example/Payment/GetCheckoutResponse.php 範例開發 26 | 'ReturnURL' => 'https://www.ecpay.com.tw/example/receive', 27 | ]; 28 | $action = 'https://payment-stage.ecpay.com.tw/Cashier/AioCheckOut/V5'; 29 | 30 | echo $autoSubmitFormService->generate($input, $action); 31 | -------------------------------------------------------------------------------- /example/Payment/Aio/CreateCreditOrder.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 10 | 'hashIv' => 'EkRm7iFT261dpevs', 11 | ]); 12 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '3002607', 16 | 'MerchantTradeNo' => 'Test' . time(), 17 | 'MerchantTradeDate' => date('Y/m/d H:i:s'), 18 | 'PaymentType' => 'aio', 19 | 'TotalAmount' => 100, 20 | 'TradeDesc' => UrlService::ecpayUrlEncode('交易描述範例'), 21 | 'ItemName' => '範例商品一批 100 TWD x 1', 22 | 'ChoosePayment' => 'Credit', 23 | 'EncryptType' => 1, 24 | 25 | // 請參考 example/Payment/GetCheckoutResponse.php 範例開發 26 | 'ReturnURL' => 'https://www.ecpay.com.tw/example/receive', 27 | ]; 28 | $action = 'https://payment-stage.ecpay.com.tw/Cashier/AioCheckOut/V5'; 29 | 30 | echo $autoSubmitFormService->generate($input, $action); 31 | -------------------------------------------------------------------------------- /example/Payment/Aio/CreateCvsOrder.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 10 | 'hashIv' => 'EkRm7iFT261dpevs', 11 | ]); 12 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '3002607', 16 | 'MerchantTradeNo' => 'Test' . time(), 17 | 'MerchantTradeDate' => date('Y/m/d H:i:s'), 18 | 'PaymentType' => 'aio', 19 | 'TotalAmount' => 100, 20 | 'TradeDesc' => UrlService::ecpayUrlEncode('交易描述範例'), 21 | 'ItemName' => '範例商品一批 100 TWD x 1', 22 | 'ChoosePayment' => 'CVS', 23 | 'EncryptType' => 1, 24 | 25 | // CVS 專用參數 26 | 'StoreExpireDate' => 4320, 27 | 'Desc_1' => '範例交易描述 1', 28 | 'Desc_2' => '範例交易描述 2', 29 | 'Desc_3' => '範例交易描述 3', 30 | 'Desc_4' => '範例交易描述 4', 31 | 32 | // 請參考 example/Payment/GetCheckoutResponse.php 範例開發 33 | 'ReturnURL' => 'https://www.ecpay.com.tw/example/receive', 34 | 'PaymentInfoURL' => 'https://www.ecpay.com.tw/example/payment-info', 35 | ]; 36 | $action = 'https://payment-stage.ecpay.com.tw/Cashier/AioCheckOut/V5'; 37 | 38 | echo $autoSubmitFormService->generate($input, $action); 39 | -------------------------------------------------------------------------------- /example/Payment/Aio/CreateInstallmentOrder.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 10 | 'hashIv' => 'EkRm7iFT261dpevs', 11 | ]); 12 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '3002607', 16 | 'MerchantTradeNo' => 'Test' . time(), 17 | 'MerchantTradeDate' => date('Y/m/d H:i:s'), 18 | 'PaymentType' => 'aio', 19 | 'TotalAmount' => 100, 20 | 'TradeDesc' => UrlService::ecpayUrlEncode('交易描述範例'), 21 | 'ItemName' => '範例商品一批 100 TWD x 1', 22 | 'ChoosePayment' => 'Credit', 23 | 'EncryptType' => 1, 24 | 25 | // 信用卡分期專用參數 26 | 'CreditInstallment' => '3,6,18', 27 | 28 | // 請參考 example/Payment/GetCheckoutResponse.php 範例開發 29 | 'ReturnURL' => 'https://www.ecpay.com.tw/example/receive', 30 | ]; 31 | $action = 'https://payment-stage.ecpay.com.tw/Cashier/AioCheckOut/V5'; 32 | 33 | echo $autoSubmitFormService->generate($input, $action); 34 | -------------------------------------------------------------------------------- /example/Payment/Aio/CreateOrder.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 10 | 'hashIv' => 'EkRm7iFT261dpevs', 11 | ]); 12 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '3002607', 16 | 'MerchantTradeNo' => 'Test' . time(), 17 | 'MerchantTradeDate' => date('Y/m/d H:i:s'), 18 | 'PaymentType' => 'aio', 19 | 'TotalAmount' => 100, 20 | 'TradeDesc' => UrlService::ecpayUrlEncode('交易描述範例'), 21 | 'ItemName' => '範例商品一批 100 TWD x 1', 22 | 'ChoosePayment' => 'ALL', 23 | 'EncryptType' => 1, 24 | 25 | // 請參考 example/Payment/GetCheckoutResponse.php 範例開發 26 | 'ReturnURL' => 'https://www.ecpay.com.tw/example/receive', 27 | ]; 28 | $action = 'https://payment-stage.ecpay.com.tw/Cashier/AioCheckOut/V5'; 29 | 30 | echo $autoSubmitFormService->generate($input, $action); 31 | -------------------------------------------------------------------------------- /example/Payment/Aio/CreatePeriodicOrder.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 10 | 'hashIv' => 'EkRm7iFT261dpevs', 11 | ]); 12 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '3002607', 16 | 'MerchantTradeNo' => 'Test' . time(), 17 | 'MerchantTradeDate' => date('Y/m/d H:i:s'), 18 | 'PaymentType' => 'aio', 19 | 'TotalAmount' => 100, 20 | 'TradeDesc' => UrlService::ecpayUrlEncode('交易描述範例'), 21 | 'ItemName' => '範例商品一批 100 TWD x 1', 22 | 'ReturnURL' => 'https://www.ecpay.com.tw/example/receive', 23 | 'ChoosePayment' => 'Credit', 24 | 'EncryptType' => 1, 25 | 26 | // 定期定額專用參數 27 | 'PeriodAmount' => 100, 28 | 'PeriodType' => 'M', 29 | 'Frequency' => 1, 30 | 'ExecTimes' => 6, 31 | 32 | // 請參考 example/Payment/GetCheckoutResponse.php 範例開發 33 | 'PeriodReturnURL' => 'https://www.ecpay.com.tw/example/receive', 34 | ]; 35 | $action = 'https://payment-stage.ecpay.com.tw/Cashier/AioCheckOut/V5'; 36 | 37 | echo $autoSubmitFormService->generate($input, $action); 38 | -------------------------------------------------------------------------------- /example/Payment/Aio/CreateTwqrOrder.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 10 | 'hashIv' => 'EkRm7iFT261dpevs', 11 | ]); 12 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '3002607', 16 | 'MerchantTradeNo' => 'Test' . time(), 17 | 'MerchantTradeDate' => date('Y/m/d H:i:s'), 18 | 'PaymentType' => 'aio', 19 | 'TotalAmount' => 100, 20 | 'TradeDesc' => UrlService::ecpayUrlEncode('交易描述範例'), 21 | 'ItemName' => '範例商品一批 100 TWD x 1', 22 | 'ChoosePayment' => 'TWQR', 23 | 'EncryptType' => 1, 24 | 25 | // 請參考 example/Payment/GetCheckoutResponse.php 範例開發 26 | 'ReturnURL' => 'https://www.ecpay.com.tw/example/receive', 27 | ]; 28 | $action = 'https://payment-stage.ecpay.com.tw/Cashier/AioCheckOut/V5'; 29 | 30 | echo $autoSubmitFormService->generate($input, $action); 31 | -------------------------------------------------------------------------------- /example/Payment/Aio/CreateWebAtmOrder.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 10 | 'hashIv' => 'EkRm7iFT261dpevs', 11 | ]); 12 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 13 | 14 | $input = [ 15 | 'MerchantID' => '3002607', 16 | 'MerchantTradeNo' => 'Test' . time(), 17 | 'MerchantTradeDate' => date('Y/m/d H:i:s'), 18 | 'PaymentType' => 'aio', 19 | 'TotalAmount' => 100, 20 | 'TradeDesc' => UrlService::ecpayUrlEncode('交易描述範例'), 21 | 'ItemName' => '範例商品一批 100 TWD x 1', 22 | 'ReturnURL' => 'https://www.ecpay.com.tw/example/receive', 23 | 'ChoosePayment' => 'WebATM', 24 | 'EncryptType' => 1, 25 | ]; 26 | $action = 'https://payment-stage.ecpay.com.tw/Cashier/AioCheckOut/V5'; 27 | 28 | echo $autoSubmitFormService->generate($input, $action); 29 | -------------------------------------------------------------------------------- /example/Payment/Aio/DownloadCreditReconcileCsv.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 9 | 'hashIv' => 'EkRm7iFT261dpevs', 10 | ]); 11 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 12 | 13 | $input = [ 14 | 'MerchantID' => '3002607', 15 | 'PayDateType' => 'close', 16 | 'StartDate' => '2015-02-12', 17 | 'EndDate' => '2015-02-12', 18 | ]; 19 | $action = 'https://payment-stage.ecpay.com.tw/CreditDetail/FundingReconDetail'; 20 | 21 | echo $autoSubmitFormService->generate($input, $action); 22 | -------------------------------------------------------------------------------- /example/Payment/Aio/DownloadReconcileCsv.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 9 | 'hashIv' => 'EkRm7iFT261dpevs', 10 | ]); 11 | $autoSubmitFormService = $factory->create('AutoSubmitFormWithCmvService'); 12 | 13 | $input = [ 14 | 'MerchantID' => '3002607', 15 | 'DateType' => '2', 16 | 'BeginDate' => '2015-02-12', 17 | 'EndDate' => '2015-02-12', 18 | 'MediaFormated' => '0', 19 | ]; 20 | $action = 'https://vendor-stage.ecpay.com.tw/PaymentMedia/TradeNoAio'; 21 | 22 | echo $autoSubmitFormService->generate($input, $action); 23 | -------------------------------------------------------------------------------- /example/Payment/Aio/GetCheckoutResponse.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 10 | 'hashIv' => 'EkRm7iFT261dpevs', 11 | ]); 12 | $checkoutResponse = $factory->create(VerifiedArrayResponse::class); 13 | 14 | // 模擬綠界付款結果回傳格式範例,非真實付款結果 15 | $_POST = [ 16 | 'MerchantID' => '3002607', 17 | 'MerchantTradeNo' => 'WPLL4E341E122DB44D62', 18 | 'PaymentDate' => '2019/05/09 00:01:21', 19 | 'PaymentType' => 'Credit_CreditCard', 20 | 'PaymentTypeChargeFee' => '1', 21 | 'RtnCode' => '1', 22 | 'RtnMsg' => '交易成功', 23 | 'SimulatePaid' => '0', 24 | 'TradeAmt' => '500', 25 | 'TradeDate' => '2019/05/09 00:00:18', 26 | 'TradeNo' => '1905090000188278', 27 | 'CheckMacValue' => '6E7F053EF215FC851A050A2FF01D72CBE440EA138DC3E905647985DDF236FD25', 28 | ]; 29 | 30 | var_dump($checkoutResponse->get($_POST)); 31 | -------------------------------------------------------------------------------- /example/Payment/Aio/QueryCreditTrade.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 9 | 'hashIv' => 'EkRm7iFT261dpevs', 10 | ]); 11 | $postService = $factory->create('PostWithCmvJsonResponseService'); 12 | 13 | $parameters = [ 14 | 'MerchantID' => '3002607', 15 | 'CreditRefundId' => 13475885, 16 | 'CreditAmount' => 100, 17 | 'CreditCheckCode' => 62861749, 18 | ]; 19 | $url = 'https://payment-stage.ecPay.com.tw/CreditDetail/QueryTrade/V2'; 20 | 21 | $response = $postService->post($parameters, $url); 22 | var_dump($response); 23 | -------------------------------------------------------------------------------- /example/Payment/Aio/QueryPaymentInfo.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 9 | 'hashIv' => 'EkRm7iFT261dpevs', 10 | ]); 11 | $postService = $factory->create('PostWithCmvVerifiedEncodedStrResponseService'); 12 | 13 | $input = [ 14 | 'MerchantID' => '3002607', 15 | 'MerchantTradeNo' => 'Test1732693750', 16 | 'TimeStamp' => time(), 17 | ]; 18 | $url = 'https://payment-stage.ecpay.com.tw/Cashier/QueryPaymentInfo'; 19 | 20 | $response = $postService->post($input, $url); 21 | var_dump($response); 22 | -------------------------------------------------------------------------------- /example/Payment/Aio/QueryPeridicTrade.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 9 | 'hashIv' => 'EkRm7iFT261dpevs', 10 | ]); 11 | $postService = $factory->create('PostWithCmvJsonResponseService'); 12 | 13 | $input = [ 14 | 'MerchantID' => '3002607', 15 | 'MerchantTradeNo' => 'Test1732694169', 16 | 'TimeStamp' => time(), 17 | ]; 18 | $url = 'https://payment-stage.ecpay.com.tw/Cashier/QueryCreditCardPeriodInfo'; 19 | 20 | $response = $postService->post($input, $url); 21 | var_dump($response); 22 | -------------------------------------------------------------------------------- /example/Payment/Aio/QueryTrade.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 9 | 'hashIv' => 'EkRm7iFT261dpevs', 10 | ]); 11 | $postService = $factory->create('PostWithCmvVerifiedEncodedStrResponseService'); 12 | 13 | $input = [ 14 | 'MerchantID' => '3002607', 15 | 'MerchantTradeNo' => 'Test1732693750', 16 | 'TimeStamp' => time(), 17 | ]; 18 | $url = 'https://payment-stage.ecpay.com.tw/Cashier/QueryTradeInfo/V5'; 19 | 20 | $response = $postService->post($input, $url); 21 | var_dump($response); 22 | -------------------------------------------------------------------------------- /example/Payment/Ecpg/Capture.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 9 | 'hashIv' => 'EkRm7iFT261dpevs', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | $data = [ 14 | 'PlatformID' => '3002607', 15 | 'MerchantID' => '3002607', 16 | 'MerchantTradeNo' => '20180914001', 17 | 'TradeNo' => '1809261503338172', 18 | 'Action' => 'C', 19 | 'TotalAmount' => 100 20 | ]; 21 | 22 | $input = [ 23 | 'MerchantID' => '3002607', 24 | 'RqHeader' => [ 25 | 'Timestamp' => time() 26 | ], 27 | 'Data' => $data 28 | ]; 29 | 30 | $url = 'https://ecpayment-stage.ecpay.com.tw/1.0.0/Credit/DoAction'; 31 | 32 | $response = $postService->post($input, $url); 33 | var_dump($response); 34 | -------------------------------------------------------------------------------- /example/Payment/Ecpg/CreateAllOrder/GetToken.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 9 | 'hashIv' => 'EkRm7iFT261dpevs', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | // 請依照平台商提供的付款方式參照 API 文件調整 $data 中的參數 14 | // (參考開發文件: https://developers.ecpay.com.tw/?p=9040) 15 | $merchantTradeNo = 'test' . time(); 16 | $data = [ 17 | 'MerchantID' => '3002607', 18 | 'RememberCard' => 1, 19 | 'PaymentUIType' => 2, 20 | 'ChoosePaymentList' => "0", 21 | 'OrderInfo' => [ 22 | 'MerchantTradeDate' => date('Y/m/d H:i:s'), 23 | 'MerchantTradeNo' => $merchantTradeNo, 24 | 'TotalAmount' => '100', 25 | 'ReturnURL' => 'https://www.ecpay.com.tw/example/receive', 26 | 'TradeDesc' => 'DESC', 27 | 'ItemName' => 'Test' 28 | ], 29 | 'CardInfo' => [ 30 | 'Redeem' => 0, 31 | 'OrderResultURL' => 'https://www.ecpay.com.tw/example/receive', 32 | 'CreditInstallment' => '3,6,12', 33 | 'FlexibleInstallment' => 30 34 | ], 35 | 'UnionPayInfo' => [ 36 | 'OrderResultURL' => 'https://www.ecpay.com.tw/example/receive' 37 | ], 38 | 'ATMInfo' => [ 39 | 'ExpireDate' => 3 40 | ], 41 | 'CVSInfo' => [ 42 | 'StoreExpireDate' => 10080 43 | ], 44 | 'BarcodeInfo' => [ 45 | 'StoreExpireDate' => 7 46 | ], 47 | 'ConsumerInfo' => [ 48 | 'MerchantMemberID' => 'test123456', 49 | 'Email' => 'customer@email.com', 50 | 'Phone' => '0912345678', 51 | 'Name' => 'Test', 52 | 'CountryCode' => '158' 53 | ] 54 | ]; 55 | 56 | $input = [ 57 | 'MerchantID' => '3002607', 58 | 'RqHeader' => [ 59 | 'Timestamp' => time() 60 | ], 61 | 'Data' => $data 62 | ]; 63 | 64 | $url = 'https://ecpg-stage.ecpay.com.tw/Merchant/GetTokenbyTrade'; 65 | $response = $postService->post($input, $url); 66 | 67 | // 回傳前端畫面所需資訊 68 | $result = [ 69 | 'Token' => $response['Data']['Token'], 70 | 'MerchantTradeNo' => $merchantTradeNo 71 | ]; 72 | 73 | echo(json_encode($result)); 74 | -------------------------------------------------------------------------------- /example/Payment/Ecpg/CreateApplePayOrder/GetToken.php: -------------------------------------------------------------------------------- 1 | 'pwFHCqoQZGmho4w6', 9 | 'hashIv' => 'EkRm7iFT261dpevs', 10 | ]); 11 | $postService = $factory->create('PostWithAesJsonResponseService'); 12 | 13 | // 請依照平台商提供的付款方式參照 API 文件調整 $data 中的參數 14 | // (參考開發文件: https://developers.ecpay.com.tw/?p=9040) 15 | $merchantTradeNo = 'test' . time(); 16 | $data = [ 17 | 'MerchantID' => '3002607', 18 | 'RememberCard' => 1, 19 | 'PaymentUIType' => 2, 20 | 'ChoosePaymentList' => "7", 21 | 'OrderInfo' => [ 22 | 'MerchantTradeDate' => date('Y/m/d H:i:s'), 23 | 'MerchantTradeNo' => $merchantTradeNo, 24 | 'TotalAmount' => '100', 25 | 'ReturnURL' => 'https://www.ecpay.com.tw/example/receive', 26 | 'TradeDesc' => 'DESC', 27 | 'ItemName' => 'Test' 28 | ], 29 | 'ConsumerInfo' => [ 30 | 'MerchantMemberID' => 'test123456', 31 | 'Email' => 'customer@email.com', 32 | 'Phone' => '0912345678', 33 | 'Name' => 'Test', 34 | 'CountryCode' => '158' 35 | ] 36 | ]; 37 | 38 | $input = [ 39 | 'MerchantID' => '3002607', 40 | 'RqHeader' => [ 41 | 'Timestamp' => time() 42 | ], 43 | 'Data' => $data 44 | ]; 45 | 46 | $url = 'https://ecpg-stage.ecpay.com.tw/Merchant/GetTokenbyTrade'; 47 | $response = $postService->post($input, $url); 48 | 49 | // 回傳前端畫面所需資訊 50 | $result = [ 51 | 'Token' => $response['Data']['Token'], 52 | 'MerchantTradeNo' => $merchantTradeNo 53 | ]; 54 | 55 | echo(json_encode($result)); 56 | -------------------------------------------------------------------------------- /example/Payment/Ecpg/CreateApplePayOrder/WebJS.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |' . print_r($content, true) . '