antom / global-open-sdk-php
global-open-sdk-php
Requires
- ext-curl: *
- ext-json: *
- ext-openssl: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-master
- v1.6.2
- v1.6.1
- v1.6.0
- v1.5.8
- v1.5.7
- v1.5.6
- v1.5.5
- v1.5.4
- v1.5.3
- v1.5.2
- v1.5.1
- v1.4.36
- v1.4.35
- v1.4.34
- v1.4.33
- v1.4.32
- v1.4.31
- v1.4.30
- v1.4.29
- v1.4.27
- v1.4.26
- v1.4.25
- v1.4.24
- v1.4.23
- v1.4.22
- v1.4.21
- v1.4.20
- v1.4.13
- v1.4.12
- v1.4.11
- v1.4.10
- v1.4.9
- v1.4.8
- v1.4.7
- v1.4.6
- v1.4.5
- v1.4.4
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.9
- v1.3.8
- v1.3.7
- 1.3.6
- v1.3.5
- v1.3.4
- v1.3.3
- v1.3.0
- v1.2.0
- dev-sdk-automation/20260924-0331
- dev-sdk-automation/20260924-0201
- dev-feature/amount-util
- dev-sdk-automation/20260922-1244
- dev-sdk-automation/20260922-0409
- dev-docs/restore-readme-examples-20260921
- dev-docs/simplify-readme-20260921
- dev-release/1.6.1
- dev-fix/response-integrity
- dev-sdk-automation/20260918-0810
- dev-sdk-automation/20260918-0710
- dev-feat/independent-api-key-client
- dev-feat/api-key-auth
- dev-sdk-automation/20260916-0658
- dev-sdk-automation/20260909-1013
- dev-sdk-automation/20260909-0913
- dev-release/1.5.8
- dev-sdk-automation/20260908-1010
- dev-sdk-automation/20260907-0958
- dev-sdk-automation/20260907-0753
- dev-release/1.5.7
- dev-fix/init-model-interface
- dev-feature/notify-dispute-issuer-comments-20260827
- dev-sdk-automation/20260826-0650
- dev-sdk-automation/20260826-0614
- dev-sdk-automation/20260825-1021
- dev-sdk-automation/20260825-0758
- dev-sdk-automation/20260824-0640
- dev-sdk-automation/20260824-0552
- dev-sdk-automation/20260824-0439
- dev-sdk-automation/20260824-0400
- dev-sdk-automation/20260824-0354
- dev-sdk-automation/20260824-0345
- dev-sdk-automation/20260824-0338
- dev-sdk-automation/20260824-0333
- dev-sdk-automation/20260821-1048
- dev-sdk-automation/20260820-0902
- dev-sdk-automation/20260820-0802
- dev-sdk-automation/20260819-0838
- dev-sdk-automation/20260818-0701
- dev-release/1.5.5
- dev-sdk-automation/20260814-0935
- dev-sdk-automation/20260813-1052
- dev-release/1.5.4
- dev-sdk-automation/20260811-1233
- dev-sdk-automation/20260811-0804
- dev-feature/sandbox-billing-meter
- dev-sdk-automation/20260805-0452
- dev-sdk-automation/20260805-0213
- dev-feature/sdk-user-agent-version
- dev-validation/jackson-migration-01-php
- dev-sdk-automation/20260728-0616
- dev-sdk-automation/20260728-0300
- dev-validation/billing-sdk-07271425-php
- dev-sdk-automation/20260727-1025
- dev-validation/billing-sdk-notify-php
- dev-validation/billing-sdk-generation-notify-php
- dev-validation/billing-sdk-generation-php
- dev-release/1.4.36
- dev-feature/update-amount-notify
- dev-sdk-automation/20260723-0240
- dev-release/1.4.35
- dev-sdk-automation/20260720-0809
- dev-sdk-automation/20260715-0345
- dev-sdk-automation/20260714-1105
- dev-sdk-automation/20260714-1017
- dev-release/1.4.33
- dev-sdk-automation/20260629-0858
- dev-sdk-automation/20260520-0313
- dev-sdk-automation/20260520-0221
- dev-sdk-automation/20260519-1207
- dev-sdk-automation/20260515-1123
- dev-sdk-automation/20260514-0708
- dev-sdk-automation/20260511-0553
- dev-sdk-automation/20260508-0622
- dev-sdk-automation/20260506-0642
- dev-sdk-automation/20260506-0641
- dev-sdk-automation/20260429-0911
- dev-sdk-automation/20260429-0902
- dev-sdk-automation/20260428-0615
- dev-sdk-automation/20260427-0727
- dev-sdk-automation/20260427-0640
- dev-sdk-automation/20260427-0622
- dev-sdk-automation/20260427-0610
- dev-sdk-automation/20260427-0555
- dev-sdk-automation/20260427-0238
- dev-sdk-automation/20260424-0834
- dev-sdk-automation/20260416-0958
- dev-sdk-automation/20260416-0731
- dev-sdk-automation/20260416-0718
- dev-sdk-automation/20260415-0432
- dev-sdk-automation/20260409-0832
- dev-sdk-automation/20260409-0744
- dev-sdk-automation/20260409-0717
- dev-sdk-automation/20260408-0833
- dev-sdk-automation/20260408-0706
- dev-sdk-automation/20260407-1036
- dev-sdk-automation/20260407-1034
- dev-sdk-automation/20260407-1028
- dev-sdk-automation/20260407-1025
- dev-sdk-automation/20260407-1023
- dev-sdk-automation/20260407-1019
- dev-sdk-automation/20260407-1004
- dev-sdk-automation/20260326-0814
- dev-sdk-automation/20260326-0751
- dev-sdk-automation/20260317-0648
- dev-sdk-automation/20260316-1209
- dev-sdk-automation/20260316-1101
- dev-sdk-automation/20260316-1058
- dev-sdk-automation/20260316-1050
- dev-sdk-automation/20260316-1006
- dev-sdk-automation/20260316-0946
- dev-sdk-automation/20260316-0923
- dev-sdk-automation/20260316-0911
- dev-sdk-automation/20260316-0857
- dev-sdk-automation/20260305-0909
- dev-sdk-automation/20260305-0848
- dev-sdk-automation/20260210-1141
- dev-sdk-automation/20260206-0728
- dev-sdk-automation/20260206-0723
- dev-sdk-automation/20260126-0758
- dev-sdk-automation/20260126-0743
- dev-sdk-automation/20260126-0715
- dev-sdk-automation/20260122-1120
- dev-sdk-automation/20260122-1059
- dev-sdk-automation/20260122-0954
- dev-sdk-automation/20260119-1010
- dev-sdk-automation/20260119-1005
- dev-sdk-automation/20260107-0545
- dev-sdk-automation/20251225-0646
- dev-sdk-automation/20251225-0332
- dev-sdk-automation/20251225-0313
- dev-sdk-automation/20251225-0306
- dev-sdk-automation/20251225-0302
- dev-sdk-automation/20251225-0256
- dev-sdk-automation/20251224-1058
- dev-sdk-automation/20251224-1025
- dev-sdk-automation/20251210-0704
- dev-sdk-automation/20251210-0654
- dev-sdk-automation/20251210-0640
- dev-sdk-automation/20251210-0628
- dev-sdk-automation/20251210-0626
- dev-sdk-automation/20251210-0621
- dev-sdk-automation/20251210-0617
- dev-sdk-automation/20251210-0605
- dev-sdk-automation/20251210-0600
- dev-sdk-automation/20251210-0554
- dev-sdk-automation/20251210-0340
- dev-sdk-automation/20251210-0332
- dev-sdk-automation/20251210-0328
- dev-sdk-automation/20251210-0318
- dev-sdk-automation/20251210-0308
- dev-sdk-automation/20251201-0645
- dev-sdk-automation/models
- dev-sdk-automation/models-new
- dev-feature-250410
- dev-feature-250313
- dev-feature-250205
- dev-feature-250106
- dev-feature-241224
- dev-feature-241216
- dev-feature-update-version
This package is auto-updated.
Last update: 2026-09-24 07:12:12 UTC
README
Latest release: 1.6.2
Installation
composer require antom/global-open-sdk-php
Requires the JSON, OpenSSL, and cURL extensions.
Quick start
- RSA: follow the configuration and inline example below.
- API Key (limited availability): follow the setup guide and run the sandbox example.
- Browse more examples and the API documentation.
RSA and API Key clients share request/response models. File uploads and notification verification still require RSA credentials.
RSA configuration
Before using the RSA client, prepare these values from your Antom integration:
gatewayUrl=your_regional_https_gateway clientId=your_client_id merchantPrivateKey=your_merchant_private_key alipayPublicKey=your_antom_public_key
The examples read them from ANTOM_GATEWAY_URL, ANTOM_CLIENT_ID,
ANTOM_MERCHANT_PRIVATE_KEY, and ANTOM_PUBLIC_KEY, respectively.
Keep keys in server-side configuration. Replace sample order data and callback
URLs with your own values before sending a request.
Payment
Save this file in your application's Composer project root.
<?php require __DIR__ . '/vendor/autoload.php'; use Request\pay\AlipayPayRequest; use Client\DefaultAlipayClient; use Model\Amount; use Model\Buyer; use Model\Env; use Model\Merchant; use Model\Order; use Model\OsType; use Model\PaymentFactor; use Model\PaymentMethod; use Model\PresentmentMode; use Model\ProductCodeType; use Model\SettlementStrategy; use Model\Store; use Model\TerminalType; use Model\WalletPaymentMethodType; $gatewayUrl = getenv('ANTOM_GATEWAY_URL'); $clientId = getenv('ANTOM_CLIENT_ID'); $merchantPrivateKey = getenv('ANTOM_MERCHANT_PRIVATE_KEY'); $alipayPublicKey = getenv('ANTOM_PUBLIC_KEY'); $request = new AlipayPayRequest(); $paymentRequestId = 'PR_' . round(microtime(true) * 1000); $order = new Order(); $order->setOrderDescription("test order desc"); $order->setReferenceOrderId("102775745075668"); $orderAmount = new Amount(); $orderAmount->setCurrency("HKD"); $orderAmount->setValue("100"); $order->setOrderAmount($orderAmount); $merchant = new Merchant(); $merchant->setReferenceMerchantId('seller2322174590001'); $merchant->setMerchantMCC('7011'); $merchant->setMerchantName('Some_Mer'); $store = new Store(); $store->setStoreMCC('7011'); $store->setReferenceStoreId('store232217459000021'); $store->setStoreName('Some_Store'); $merchant->setStore($store); $order->setMerchant($merchant); $env = new Env(); $env->setUserAgent('"Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15G77 NebulaSDK/1.8.100112 Nebula PSDType(1) AlipayDefined(nt:4G,ws:320|504|2.0) AliApp(AP/10.1.32.600) AlipayClient/10.1.32.600 Alipay Language/zh-Hans AlipayConnect"'); $env->setOsType(OsType::ANDROID); $env->setTerminalType(TerminalType::WEB); $order->setEnv($env); $request->setOrder($order); $paymentAmount = new Amount(); $paymentAmount->setCurrency("HKD"); $paymentAmount->setValue("100"); $request->setPaymentAmount($paymentAmount); $paymentNotifyUrl = "https://www.alipay.com/notify"; $paymentRedirectUrl = "https://www.alipay.com"; $request->setPaymentNotifyUrl($paymentNotifyUrl); $request->setPaymentRedirectUrl($paymentRedirectUrl); $paymentMethod = new PaymentMethod(); $paymentMethod->setPaymentMethodType(WalletPaymentMethodType::ALIPAY_HK); $request->setPaymentMethod($paymentMethod); $request->setProductCode(ProductCodeType::CASHIER_PAYMENT); $request->setClientId($clientId); $request->setPaymentRequestId($paymentRequestId); $settlementStrategy = new SettlementStrategy(); $settlementStrategy->setSettlementCurrency("USD"); $request->setSettlementStrategy($settlementStrategy); $alipayClient = new DefaultAlipayClient($gatewayUrl, $merchantPrivateKey, $alipayPublicKey, $clientId); $alipayResponse = $alipayClient->execute($request);
API Key client (limited availability)
API Key access is not yet available to all merchants. Use this client only if API Key access has been enabled for your account; otherwise, use RSA.
Set ANTOM_GATEWAY_URL and ANTOM_API_KEY in your server environment.
This initializes the client; see the setup guide for a
complete sandbox request and its additional configuration.
require_once 'vendor/autoload.php'; $client = new \Client\ApiKeyAlipayClient([ 'gatewayUrl' => getenv('ANTOM_GATEWAY_URL'), 'apiKey' => getenv('ANTOM_API_KEY'), ]);
Upgrade notes
Gateway responses with resultStatus S must be signed; responses with only one
of the signature and response-time headers are rejected.
Billing integrations: availableAmount now uses Amount; the AvailableAmount
model has been removed.
Meter event upload
meter/createSession uses the regular signed AMS transport. Use its session ID
to call meter/uploadEvent through executeWithHeaders:
The fragment below assumes an initialized RSA client, a valid session ID from
meter/createSession, and a populated collection of meter event batches.
$request = new \Request\billing\AlipayMeterUploadEventRequest([ 'meters' => $meters, ]); $response = $client->executeWithHeaders($request, [ 'X-Session-Id' => $sessionId, ]);
The SDK sends meter/uploadEvent to the gateway URL configured on the client,
without sandbox path rewriting, request signing, response signature verification,
or automatic retries. This API requires an HTTP/2-enabled libcurl 8.10.0 or later.
Advanced usage
Custom HTTP transport
This extension skeleton accepts a transport callback returning a populated
Model\HttpRpcResult. Preserve the original body, signature, and response-time
values so the SDK can verify the response. Use DefaultAlipayClient for normal usage.
<?php require __DIR__ . '/vendor/autoload.php'; class YourAlipayClient extends \Client\BaseAlipayClient { private $transport; public function __construct($gatewayUrl, $merchantPrivateKey, $alipayPublicKey, $clientId, callable $transport) { parent::__construct($gatewayUrl, $merchantPrivateKey, $alipayPublicKey, $clientId); $this->transport = $transport; } protected function buildCustomHeader() { return []; } protected function sendRequest($requestUrl, $httpMethod, $headers, $reqBody) { $result = call_user_func($this->transport, $requestUrl, $httpMethod, $headers, $reqBody); if (!$result instanceof \Model\HttpRpcResult) { throw new \RuntimeException('Transport must return HttpRpcResult'); } return $result; } }
Sign and verify without the HTTP client
After loading Composer's autoloader, use the exact transmitted path, timestamp,
body, and configured keys. The variables below come from your request/response.
Verification returns 1 on success; do not treat every nonzero value as success.
$signature = \Client\SignatureTool::sign( $httpMethod, $path, $clientId, $requestTime, $requestBody, $merchantPrivateKey); $verified = \Client\SignatureTool::verify( $httpMethod, $path, $clientId, $responseTime, $responseBody, $responseSignature, $alipayPublicKey) === 1;
Support
For integration questions, contact overseas_support@service.alibaba.com.