HiTechPay App-to-App Payment SDK Integration
HiTechPay App-to-App Payment SDK Integration#
Overview#
App-to-App Payment with HiTechPay provides a fast and secure way to pay for orders using smartphones. When a user chooses HiTechPay as a payment method in your mobile app, the flow seamlessly navigates to the HiTechPay application, where payment is processed. This integration enables quick payments, allows easy promotion integration, minimizes physical contact or cash needs, and maintains transaction security between apps.Payment Flow#
1.
Merchant app adds HiTechPay as a payment method and initializes the HiTechPay SDK with the provided app_id.
2.
User selects HiTechPay as payment method and proceeds to checkout.
3.
Merchant app calls the CreateOrder API to create a new payment order, receiving a transToken in response.
4.
Merchant app invokes the SDK's payment function with the transToken.
5.
App navigates to HiTechPay’s order screen (handle the case where user doesn’t have HiTechPay installed).
6.
User completes payment in HiTechPay app, which then returns to merchant app with a response.
7.
Merchant app processes the response and provides user feedback.
Prerequisites#
Registered merchant account with app_id and mac_key (from Merchant Portal)
Understanding of CreateOrder API and secure data transmission
Supported development environments:iOS: XCode ≥ 14.1, Ruby ≥ 2.7.6, Swift ≥ 5.7.1
Android: Gradle ≥ 7.5, Android Gradle plugin ≥ 7.2.2, JDK ≥ 11.0.13
Download hitechpay-sdk-swift-x.x.x.framework (iOS) and hitechpay-sdk-release-vx.x.aar (Android)
Visit our GitHub repository for step-by-step example integrations:React Native (Android/iOS) App
Flutter (Android/iOS) App
Integration Details#
iOS Integration#
1. Import and Initialize HiTechPay SDK#
Add HiTechPaySDK.framework to your project.
Configure Info.plist to support deep linking between apps:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>hitechpay</string>
<string>HiTechPay.api.v2</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>merchant-deeplink</string>
</array>
</dict>
</array>
In AppDelegate.swift, initialize the SDK:
2. Call Payment Function#
Call the CreateOrder API to get transToken.
3. Handle Returned Results#
Implement result callbacks:4. Handle User Not Installed HiTechPay#
Android Integration#
1. Import and Initialize HiTechPay SDK#
Import .aar package in Android Studio.
Add SDK dependency to build.gradle:
Register merchant deeplink in AndroidManifest.xml:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="merchant-deeplink"
android:host="app" />
</intent-filter>
Initialize SDK in onCreate:
2. Call Payment Function#
After receiving transToken through CreateOrder API:
3. Handle Returned Results#
Implement PayOrderListener:4. Handle User Not Installed HiTechPay#
React Native Integration#
1. Native Bridging (iOS & Android)#
Use native module bridges to expose SDK payment functionality to JS.
Export payment result events to React Native through event emitters.
2. JS Usage#
Flutter Integration#
1. Native Channel Setup#
Register Swift/Java/Kotlin method channels and event channels as per platform.
Communicate payment events to Flutter.
2. Flutter Client Usage#
Returned Result Data Structure#
| Field | Type | Description |
|---|
| transactionId | string | ID of the transaction |
| transToken | string | Token for the current order |
| appTransId | string | app_trans_id for the transaction |
| Field | Type | Description |
|---|
| transToken | string | Token for the current order |
| appTransId | string | app_trans_id for the transaction |
| Field | Type | Description |
|---|
| errorCode | string | Error code: UNKNOWN, PAYMENT_APP_NOT_FOUND, INPUT_IS_INVALID, FAIL, etc. |
| transToken | string | Token for the current order |
| appTransId | string | app_trans_id for the transaction |
Additional Resources#
Once implementation is complete, verify integration and test payment flows.
Modified at 2025-12-04 10:37:10