@gizwits/react-native-s-alipay-harmony
v0.1.0
Published
HarmonyOS payment implementation for react-native-s-alipay (RNOH 0.82)
Keywords
Readme
@gizwits/react-native-s-alipay-harmony
HarmonyOS companion for [email protected]. Version 0.1.0 targets RN 0.82 / RNOH 0.82.30, HarmonyOS API 13+, and pins @cashier_alipay/[email protected] in OHPM.
Integration
Install alongside the original npm package, retain createHarmonyMetroConfig, run RNOH autolinking and ohpm install. JS imports remain unchanged:
import Alipay from 'react-native-s-alipay';
const result = await Alipay.pay(serverSignedOrderString);
// { code: '9000', resultStatus: '9000', memo, result }The SDK is a bytecode HAR: the Harmony product build options must set strictMode.useNormalizedOHMUrl: true. The product minimum must be API 13 or newer. Add https to the entry module's querySchemes. No Alipay-specific EntryAbility forwarding is required for Pay.pay.
The bridge runs on the UI thread, provides the UIAbility context and uses the SDK's standard router-based H5 fallback when Alipay is absent. Validate the fallback, cancel/back navigation and loading UI on a real device; RN navigation does not replace the SDK's ArkUI router.
Contract and limitations
pay(orderString, { timeout?: seconds })passes the signed order string verbatim. Timeout defaults to 120 seconds, allowed range 1–600.- Success follows the upstream Android object contract, not the upstream iOS array contract. Non-9000 statuses reject an
AlipayErrorwith string.codeand raw.response. Examples:6001cancelled,8000pending,6004unknown. The consuming app must not classify HarmonyOS as iOS when reading this result. E_TIMEOUTis unknown, not failed. System launch-dialog cancellation may never trigger an SDK callback. The native session remains busy until the SDK settles; query the backend before any retry. If the callback never arrives, restart the app after checking the order.- Use backend notification/order query to confirm success and credit balances. No private keys, signing, order-string logging or client-side crediting is included.
- Only
payis supported, matching this upstream wrapper's public API. Alipay auth is not implemented by this payment SDK. - Include Alipay and its transitive SDKs in the host's privacy/consent review. No real payment or account configuration has been performed by this implementation.
Development and packaging
npm run build:har creates a source HAR containing bridge sources and pinned OHPM dependencies. The app compiles the bridge; third-party SDK binaries are not republished. npm pack runs this automatically. In this repository, run yarn payments:sync, then ohpm install in harmony, after changes.
Not published. UNLICENSED is intentional pending the owner's release/license decision. Confirm namespace rights, license and real-device acceptance before publishing.
Sources: official OHPM package, official integration guide, SDK privacy notice.
