react-native-hyperpay-sdk 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,6 +22,7 @@ A React Native SDK for integrating [HyperPay](https://www.hyperpay.com/) — a l
22
22
  - [Check Payment Status](#check-payment-status)
23
23
  - [Track Loading State](#track-loading-state)
24
24
  - [Supported Payment Brands](#supported-payment-brands)
25
+ - [Supported Apple Pay Networks](#supported-apple-pay-networks-ios-only)
25
26
  - [Android Configuration](#android-configuration-optional)
26
27
  - [API Reference](#api-reference)
27
28
  - [TypeScript Types](#typescript-types)
@@ -81,7 +82,8 @@ HyperPay.init({
81
82
  merchantIdentifier: 'merchant.com.yourapp', // Apple Pay merchant identifier (iOS only)
82
83
  mode: 'TestMode', // 'TestMode' | 'LiveMode'
83
84
  companyName: 'Your Company', // displayed in Apple Pay sheet (iOS only)
84
- supportedNetworks: ['visa', 'masterCard'], // Apple Pay supported networks (iOS only)
85
+ supportedNetworks: ['Visa', 'MasterCard'], // Apple Pay supported networks (iOS only)
86
+ currencyCode: 'SAR', // ISO 4217 currency code, Apple Pay only (iOS only)
85
87
  });
86
88
  ```
87
89
 
@@ -94,7 +96,8 @@ HyperPay.init({
94
96
  | `merchantIdentifier` | `string` | No | Apple Pay merchant identifier registered in your Apple Developer account (iOS only) |
95
97
  | `mode` | `'TestMode' \| 'LiveMode'` | No | Payment environment — defaults to `'TestMode'` |
96
98
  | `companyName` | `string` | No | Merchant name displayed in the Apple Pay sheet as "Pay `<companyName>`" (iOS only) |
97
- | `supportedNetworks` | `SupportedNetworks[]` | No | Card networks accepted by Apple Pay (e.g. `'visa'`, `'masterCard'`, `'mada'`) (iOS only) |
99
+ | `supportedNetworks` | `SupportedNetworks[]` | No | Card networks accepted by Apple Pay (e.g. `'Visa'`, `'MasterCard'`, `'mada'`) — see [Supported Apple Pay Networks](#supported-apple-pay-networks-ios-only) (iOS only) |
100
+ | `currencyCode` | `string` | No | ISO 4217 currency code (e.g. `'SAR'`, `'USD'`) used for Apple Pay (iOS only) |
98
101
 
99
102
  ---
100
103
 
@@ -139,6 +142,7 @@ const result = await HyperPay.applePay({
139
142
  checkoutID: '<checkout_id_from_your_server>',
140
143
  companyName: 'Your Company', // optional — overrides init value
141
144
  amount: '100.00', // optional — displayed in the Apple Pay sheet
145
+ currencyCode: 'SAR', // optional — overrides init value
142
146
  });
143
147
 
144
148
  // result shape:
@@ -235,6 +239,52 @@ For the complete list of 40+ supported brands, see [CardAccountBrands.ts](lib/ty
235
239
 
236
240
  ---
237
241
 
242
+ ## Supported Apple Pay Networks (iOS Only)
243
+
244
+ The `supportedNetworks` config option accepts any value from the `SupportedNetworks` type. Matching is case-insensitive on the native side. A network is only honored if the shopper's device is running an iOS version that supports it — older devices simply ignore networks they don't support.
245
+
246
+ | Network | Minimum iOS | Notes |
247
+ |-------------------|-------------|----------------------------|
248
+ | `Visa` | 8.0 | Global |
249
+ | `MasterCard` | 8.0 | Global |
250
+ | `AmEx` | 8.0 | Global |
251
+ | `Discover` | 9.0 | Global |
252
+ | `ChinaUnionPay` | 9.2 | China |
253
+ | `Interac` | 9.2 | Canada |
254
+ | `PrivateLabel` | 9.0 | — |
255
+ | `JCB` | 10.1 | Japan |
256
+ | `Suica` | 10.1 | Japan (transit) |
257
+ | `iD` | 10.3 | Japan |
258
+ | `QUICPay` | 10.3 | Japan |
259
+ | `CartesBancaires` | 11.2 | France |
260
+ | `Maestro` | 12.0 | Europe |
261
+ | `Electron` | 12.0 | Global |
262
+ | `VPay` | 12.0 | Europe |
263
+ | `Eftpos` | 12.0 | Australia |
264
+ | `mada` | 12.1.1 | Saudi Arabia (KSA) |
265
+ | `Elo` | 12.1.1 | Brazil |
266
+ | `Barcode` | 14.0 | — |
267
+ | `Girocard` | 14.0 | Germany |
268
+ | `Mir` | 14.5 | Russia |
269
+ | `WAON` | 15.0 | Japan |
270
+ | `Nanaco` | 15.0 | Japan |
271
+ | `Dankort` | 15.1 | Denmark |
272
+ | `Bancontact` | 16.0 | Belgium |
273
+ | `PostFinance` | 16.4 | Switzerland |
274
+ | `PagoBancomat` | 17.0 | Italy |
275
+ | `Tmoney` | 17.0 | South Korea |
276
+ | `Meeza` | 17.4 | Egypt |
277
+ | `NAPAS` | 17.5 | Vietnam |
278
+ | `BankAxept` | 17.5 | Norway |
279
+ | `Himyan` | 18.4 | — |
280
+ | `Jaywan` | 18.4 | United Arab Emirates |
281
+ | `MyDebit` | 26.0 | Malaysia |
282
+ | `Conecs` | 26.2 | France |
283
+
284
+ For the full type definition, see [SupportedNetworks.d.ts](lib/typescript/SupportedNetworks.d.ts).
285
+
286
+ ---
287
+
238
288
  ## Android Configuration (Optional)
239
289
 
240
290
  To override the default Android SDK build versions used by the library, add the following to your root `android/build.gradle`:
package/ios/HyperPay.m CHANGED
@@ -1,6 +1,7 @@
1
1
 
2
2
  #import <Foundation/Foundation.h>
3
3
  #import "HyperPay.h"
4
+ #import "HyperPaySupportedNetworks.h"
4
5
  #import <React/RCTLog.h>
5
6
 
6
7
  @interface HyperPay ()
@@ -128,12 +129,7 @@ RCT_EXPORT_METHOD(applePay:(NSDictionary*)params resolver:(RCTPromiseResolveBloc
128
129
  NSArray *rawNetworks = [params valueForKey:@"supportedNetworks"] ?: supportedNetworks;
129
130
  if (rawNetworks.count > 0 && [rawNetworks[0] isKindOfClass:[NSString class]]) {
130
131
  NSMutableArray *mapped = [NSMutableArray array];
131
- NSDictionary *networkMap = @{
132
- @"visa": PKPaymentNetworkVisa,
133
- @"mastercard": PKPaymentNetworkMasterCard,
134
- @"amex": PKPaymentNetworkAmex,
135
- @"mada": PKPaymentNetworkMada,
136
- };
132
+ NSDictionary<NSString *, PKPaymentNetwork> *networkMap = [HyperPaySupportedNetworks map];
137
133
  for (NSString *name in rawNetworks) {
138
134
  PKPaymentNetwork net = networkMap[[name lowercaseString]];
139
135
  if (net) [mapped addObject:net];
@@ -0,0 +1,14 @@
1
+ #ifndef HyperPaySupportedNetworks_h
2
+ #define HyperPaySupportedNetworks_h
3
+ #import <Foundation/Foundation.h>
4
+ #import <PassKit/PassKit.h>
5
+
6
+ @interface HyperPaySupportedNetworks : NSObject
7
+
8
+ /// Maps a lowercased network name (e.g. "visa", "mastercard", "mada") to its PKPaymentNetwork constant.
9
+ /// Only includes networks available on the running OS version.
10
+ + (NSDictionary<NSString *, PKPaymentNetwork> *)map;
11
+
12
+ @end
13
+
14
+ #endif /* HyperPaySupportedNetworks_h */
@@ -0,0 +1,77 @@
1
+ #import "HyperPaySupportedNetworks.h"
2
+
3
+ @implementation HyperPaySupportedNetworks
4
+
5
+ + (NSDictionary<NSString *, PKPaymentNetwork> *)map {
6
+ NSMutableDictionary<NSString *, PKPaymentNetwork> *map = [NSMutableDictionary dictionary];
7
+
8
+ // Available since iOS 13 (this SDK's minimum deployment target)
9
+ map[@"amex"] = PKPaymentNetworkAmex;
10
+ map[@"cartesbancaires"] = PKPaymentNetworkCartesBancaires;
11
+ map[@"chinaunionpay"] = PKPaymentNetworkChinaUnionPay;
12
+ map[@"discover"] = PKPaymentNetworkDiscover;
13
+ map[@"id"] = PKPaymentNetworkIDCredit;
14
+ map[@"interac"] = PKPaymentNetworkInterac;
15
+ map[@"jcb"] = PKPaymentNetworkJCB;
16
+ map[@"mastercard"] = PKPaymentNetworkMasterCard;
17
+ map[@"privatelabel"] = PKPaymentNetworkPrivateLabel;
18
+ map[@"quicpay"] = PKPaymentNetworkQuicPay;
19
+ map[@"suica"] = PKPaymentNetworkSuica;
20
+ map[@"visa"] = PKPaymentNetworkVisa;
21
+
22
+ if (@available(iOS 12.0, *)) {
23
+ map[@"maestro"] = PKPaymentNetworkMaestro;
24
+ map[@"electron"] = PKPaymentNetworkElectron;
25
+ map[@"vpay"] = PKPaymentNetworkVPay;
26
+ map[@"eftpos"] = PKPaymentNetworkEftpos;
27
+ }
28
+ if (@available(iOS 12.1.1, *)) {
29
+ map[@"mada"] = PKPaymentNetworkMada;
30
+ map[@"elo"] = PKPaymentNetworkElo;
31
+ }
32
+ if (@available(iOS 14.0, *)) {
33
+ map[@"barcode"] = PKPaymentNetworkBarcode;
34
+ map[@"girocard"] = PKPaymentNetworkGirocard;
35
+ }
36
+ if (@available(iOS 14.5, *)) {
37
+ map[@"mir"] = PKPaymentNetworkMir;
38
+ }
39
+ if (@available(iOS 15.0, *)) {
40
+ map[@"waon"] = PKPaymentNetworkWaon;
41
+ map[@"nanaco"] = PKPaymentNetworkNanaco;
42
+ }
43
+ if (@available(iOS 15.1, *)) {
44
+ map[@"dankort"] = PKPaymentNetworkDankort;
45
+ }
46
+ if (@available(iOS 16.0, *)) {
47
+ map[@"bancontact"] = PKPaymentNetworkBancontact;
48
+ }
49
+ if (@available(iOS 16.4, *)) {
50
+ map[@"postfinance"] = PKPaymentNetworkPostFinance;
51
+ }
52
+ if (@available(iOS 17.0, *)) {
53
+ map[@"pagobancomat"] = PKPaymentNetworkPagoBancomat;
54
+ map[@"tmoney"] = PKPaymentNetworkTmoney;
55
+ }
56
+ if (@available(iOS 17.4, *)) {
57
+ map[@"meeza"] = PKPaymentNetworkMeeza;
58
+ }
59
+ if (@available(iOS 17.5, *)) {
60
+ map[@"napas"] = PKPaymentNetworkNAPAS;
61
+ map[@"bankaxept"] = PKPaymentNetworkBankAxept;
62
+ }
63
+ if (@available(iOS 18.4, *)) {
64
+ map[@"himyan"] = PKPaymentNetworkHimyan;
65
+ map[@"jaywan"] = PKPaymentNetworkJaywan;
66
+ }
67
+ if (@available(iOS 26.0, *)) {
68
+ map[@"mydebit"] = PKPaymentNetworkMyDebit;
69
+ }
70
+ if (@available(iOS 26.2, *)) {
71
+ map[@"conecs"] = PKPaymentNetworkConecs;
72
+ }
73
+
74
+ return map;
75
+ }
76
+
77
+ @end
@@ -1,29 +1,42 @@
1
1
 
2
+ /**
3
+ * Apple Pay supported card networks (PKPaymentNetwork).
4
+ * Matching is case-insensitive on the native side.
5
+ * Networks newer than iOS 13 are only honored on devices running an OS that supports them.
6
+ */
2
7
  export type SupportedNetworks =
3
- "mada" |
4
- "Visa" |
5
- "JCB" |
6
- "Elo" |
7
- "Mir" |
8
- "Suica" |
9
- "MasterCard" |
10
- "iD" |
11
- "CarteBancaires" |
12
- "ChinaUnionPay" |
13
8
  "AmEx" |
14
- "WAON" |
15
- "VPay" |
16
- "Eftpos" |
17
- "nanaco" |
9
+ "Bancontact" |
10
+ "BankAxept" |
18
11
  "Barcode" |
12
+ "CartesBancaires" |
13
+ "ChinaUnionPay" |
14
+ "Conecs" |
19
15
  "Dankort" |
20
- "Interac" |
21
- "Maestro" |
22
16
  "Discover" |
17
+ "Eftpos" |
23
18
  "Electron" |
24
- "girocard" |
25
- "QUICPay" |
19
+ "Elo" |
20
+ "Girocard" |
21
+ "Himyan" |
22
+ "iD" |
23
+ "Interac" |
24
+ "Jaywan" |
25
+ "JCB" |
26
+ "mada" |
27
+ "Maestro" |
28
+ "MasterCard" |
29
+ "Meeza" |
30
+ "Mir" |
31
+ "MyDebit" |
32
+ "Nanaco" |
33
+ "NAPAS" |
34
+ "PagoBancomat" |
35
+ "PostFinance" |
26
36
  "PrivateLabel" |
27
- "CartesBancaires" |
28
- "CarteBancaire"
29
-
37
+ "QUICPay" |
38
+ "Suica" |
39
+ "Tmoney" |
40
+ "Visa" |
41
+ "VPay" |
42
+ "WAON"
@@ -27,16 +27,27 @@ export interface Config {
27
27
 
28
28
  /**
29
29
  * set up supported payment networks for apple pay
30
- * @Platform IOS Only
30
+ * @Platform IOS Only
31
31
  */
32
32
  supportedNetworks?: Array<SupportedNetworks>
33
33
 
34
+ /**
35
+ * ISO 4217 currency code (e.g. "SAR", "USD"), Apple Pay only
36
+ * @Platform IOS Only
37
+ */
38
+ currencyCode?: string;
39
+
34
40
  }
35
41
 
36
42
  export type ApplyPayParams = {
37
43
  checkoutID:string;
38
44
  companyName?:string;
39
45
  amount?:string;
46
+ /**
47
+ * ISO 4217 currency code (e.g. "SAR", "USD") — overrides init value
48
+ * @Platform IOS Only
49
+ */
50
+ currencyCode?:string;
40
51
  }
41
52
 
42
53
  export type CreateTransactionParams = {
@@ -63,7 +74,8 @@ export default class HyperPay {
63
74
  * @param {CountryCodes} countryCode
64
75
  * @param {string} merchantIdentifier
65
76
  * @param {string} mode
66
- * @param {SupportedNetworks[]} supportedNetworks
77
+ * @param {SupportedNetworks[]} supportedNetworks
78
+ * @param {string} currencyCode
67
79
  * @returns Config
68
80
  */
69
81
 
@@ -72,7 +84,8 @@ export default class HyperPay {
72
84
  /**
73
85
  * @param {string} checkoutID
74
86
  * @param {string} companyName
75
- * @param {number} amount
87
+ * @param {number} amount
88
+ * @param {string} currencyCode
76
89
  * @param {(isProgress: boolean) => void} onProgress
77
90
  * @returns ```Promise<{ redirectURL?: string,
78
91
  resourcePath?: string}>```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-hyperpay-sdk",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "hyperpay",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",