@swichpay/react-native 0.0.0-stage → 1.0.0

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.
Files changed (277) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/LICENSE +21 -0
  3. package/README.md +82 -2
  4. package/docs/checkouts.md +98 -0
  5. package/docs/getting-started.md +140 -0
  6. package/docs/going-live.md +45 -0
  7. package/docs/own-screen.md +81 -0
  8. package/docs/results-and-errors.md +75 -0
  9. package/docs/server.md +163 -0
  10. package/docs/troubleshooting.md +57 -0
  11. package/lib/commonjs/HostedCheckout.js +115 -0
  12. package/lib/commonjs/checkout-webview.js +85 -0
  13. package/lib/commonjs/checkouts/PaymentSheet.js +1317 -0
  14. package/lib/commonjs/checkouts/direct.js +671 -0
  15. package/lib/commonjs/context.js +64 -0
  16. package/lib/commonjs/core/api/direct-payment-api.js +425 -0
  17. package/lib/commonjs/core/api/discount-api.js +19 -0
  18. package/lib/commonjs/core/api/gateway-api.js +366 -0
  19. package/lib/commonjs/core/api/payments-api.js +79 -0
  20. package/lib/commonjs/core/api/repositories.js +5 -0
  21. package/lib/commonjs/core/assets/images.js +12 -0
  22. package/lib/commonjs/core/assets/method-logos.js +19 -0
  23. package/lib/commonjs/core/assets/pwa-images.js +13 -0
  24. package/lib/commonjs/core/browser/clipboard.js +30 -0
  25. package/lib/commonjs/core/browser/dom.js +71 -0
  26. package/lib/commonjs/core/browser/hosted-checkout.js +107 -0
  27. package/lib/commonjs/core/browser/index.js +119 -0
  28. package/lib/commonjs/core/browser/qr.js +109 -0
  29. package/lib/commonjs/core/browser/three-ds.js +151 -0
  30. package/lib/commonjs/core/client.js +344 -0
  31. package/lib/commonjs/core/config.js +132 -0
  32. package/lib/commonjs/core/environment.js +34 -0
  33. package/lib/commonjs/core/errors.js +138 -0
  34. package/lib/commonjs/core/events.js +57 -0
  35. package/lib/commonjs/core/flows/controller.js +106 -0
  36. package/lib/commonjs/core/flows/countdown.js +41 -0
  37. package/lib/commonjs/core/flows/direct-bank-transfer.js +236 -0
  38. package/lib/commonjs/core/flows/direct-card.js +354 -0
  39. package/lib/commonjs/core/flows/direct-ewallet.js +124 -0
  40. package/lib/commonjs/core/flows/direct-one-bill.js +172 -0
  41. package/lib/commonjs/core/flows/direct-qr.js +109 -0
  42. package/lib/commonjs/core/flows/direct-rtp.js +302 -0
  43. package/lib/commonjs/core/flows/discount-lookup.js +80 -0
  44. package/lib/commonjs/core/flows/headless.js +94 -0
  45. package/lib/commonjs/core/flows/payment-sheet.js +1321 -0
  46. package/lib/commonjs/core/flows/services.js +31 -0
  47. package/lib/commonjs/core/flows/shared.js +90 -0
  48. package/lib/commonjs/core/http/api-client.js +208 -0
  49. package/lib/commonjs/core/http/endpoints.js +61 -0
  50. package/lib/commonjs/core/http/token-manager.js +46 -0
  51. package/lib/commonjs/core/http/transport.js +134 -0
  52. package/lib/commonjs/core/index.js +688 -0
  53. package/lib/commonjs/core/models/category.js +113 -0
  54. package/lib/commonjs/core/models/discount.js +51 -0
  55. package/lib/commonjs/core/models/payment.js +95 -0
  56. package/lib/commonjs/core/models/session.js +131 -0
  57. package/lib/commonjs/core/server/index.js +64 -0
  58. package/lib/commonjs/core/server/node.js +60 -0
  59. package/lib/commonjs/core/server/proxy.js +194 -0
  60. package/lib/commonjs/core/server/verify.js +122 -0
  61. package/lib/commonjs/core/swichpay.js +72 -0
  62. package/lib/commonjs/core/utils/crypto.js +78 -0
  63. package/lib/commonjs/core/utils/formatters.js +68 -0
  64. package/lib/commonjs/core/utils/json.js +110 -0
  65. package/lib/commonjs/core/utils/log.js +75 -0
  66. package/lib/commonjs/core/utils/runtime.js +34 -0
  67. package/lib/commonjs/core/utils/validators.js +59 -0
  68. package/lib/commonjs/hooks.js +77 -0
  69. package/lib/commonjs/index.js +203 -0
  70. package/lib/commonjs/package.json +1 -0
  71. package/lib/commonjs/polyfills.js +3 -0
  72. package/lib/commonjs/presenter.js +61 -0
  73. package/lib/commonjs/provider.js +192 -0
  74. package/lib/commonjs/swichpay.js +192 -0
  75. package/lib/commonjs/theme.js +54 -0
  76. package/lib/commonjs/ui.js +1142 -0
  77. package/lib/commonjs/webviews.js +279 -0
  78. package/lib/module/HostedCheckout.js +111 -0
  79. package/lib/module/checkout-webview.js +83 -0
  80. package/lib/module/checkouts/PaymentSheet.js +1313 -0
  81. package/lib/module/checkouts/direct.js +661 -0
  82. package/lib/module/context.js +58 -0
  83. package/lib/module/core/api/direct-payment-api.js +413 -0
  84. package/lib/module/core/api/discount-api.js +14 -0
  85. package/lib/module/core/api/gateway-api.js +358 -0
  86. package/lib/module/core/api/payments-api.js +73 -0
  87. package/lib/module/core/api/repositories.js +3 -0
  88. package/lib/module/core/assets/images.js +8 -0
  89. package/lib/module/core/assets/method-logos.js +15 -0
  90. package/lib/module/core/assets/pwa-images.js +9 -0
  91. package/lib/module/core/browser/clipboard.js +27 -0
  92. package/lib/module/core/browser/dom.js +63 -0
  93. package/lib/module/core/browser/hosted-checkout.js +102 -0
  94. package/lib/module/core/browser/index.js +12 -0
  95. package/lib/module/core/browser/qr.js +100 -0
  96. package/lib/module/core/browser/three-ds.js +145 -0
  97. package/lib/module/core/client.js +338 -0
  98. package/lib/module/core/config.js +128 -0
  99. package/lib/module/core/environment.js +29 -0
  100. package/lib/module/core/errors.js +125 -0
  101. package/lib/module/core/events.js +51 -0
  102. package/lib/module/core/flows/controller.js +101 -0
  103. package/lib/module/core/flows/countdown.js +36 -0
  104. package/lib/module/core/flows/direct-bank-transfer.js +231 -0
  105. package/lib/module/core/flows/direct-card.js +349 -0
  106. package/lib/module/core/flows/direct-ewallet.js +119 -0
  107. package/lib/module/core/flows/direct-one-bill.js +167 -0
  108. package/lib/module/core/flows/direct-qr.js +104 -0
  109. package/lib/module/core/flows/direct-rtp.js +297 -0
  110. package/lib/module/core/flows/discount-lookup.js +75 -0
  111. package/lib/module/core/flows/headless.js +90 -0
  112. package/lib/module/core/flows/payment-sheet.js +1315 -0
  113. package/lib/module/core/flows/services.js +27 -0
  114. package/lib/module/core/flows/shared.js +78 -0
  115. package/lib/module/core/http/api-client.js +203 -0
  116. package/lib/module/core/http/endpoints.js +57 -0
  117. package/lib/module/core/http/token-manager.js +41 -0
  118. package/lib/module/core/http/transport.js +126 -0
  119. package/lib/module/core/index.js +52 -0
  120. package/lib/module/core/models/category.js +104 -0
  121. package/lib/module/core/models/discount.js +46 -0
  122. package/lib/module/core/models/payment.js +89 -0
  123. package/lib/module/core/models/session.js +120 -0
  124. package/lib/module/core/server/index.js +11 -0
  125. package/lib/module/core/server/node.js +56 -0
  126. package/lib/module/core/server/proxy.js +191 -0
  127. package/lib/module/core/server/verify.js +115 -0
  128. package/lib/module/core/swichpay.js +68 -0
  129. package/lib/module/core/utils/crypto.js +72 -0
  130. package/lib/module/core/utils/formatters.js +56 -0
  131. package/lib/module/core/utils/json.js +94 -0
  132. package/lib/module/core/utils/log.js +67 -0
  133. package/lib/module/core/utils/runtime.js +28 -0
  134. package/lib/module/core/utils/validators.js +54 -0
  135. package/lib/module/hooks.js +72 -0
  136. package/lib/module/index.js +36 -0
  137. package/lib/module/polyfills.js +4 -0
  138. package/lib/module/presenter.js +58 -0
  139. package/lib/module/provider.js +188 -0
  140. package/lib/module/swichpay.js +187 -0
  141. package/lib/module/theme.js +50 -0
  142. package/lib/module/ui.js +1116 -0
  143. package/lib/module/webviews.js +272 -0
  144. package/lib/typescript/commonjs/HostedCheckout.d.ts +17 -0
  145. package/lib/typescript/commonjs/checkout-webview.d.ts +14 -0
  146. package/lib/typescript/commonjs/checkouts/PaymentSheet.d.ts +14 -0
  147. package/lib/typescript/commonjs/checkouts/direct.d.ts +18 -0
  148. package/lib/typescript/commonjs/context.d.ts +20 -0
  149. package/lib/typescript/commonjs/core/api/direct-payment-api.d.ts +103 -0
  150. package/lib/typescript/commonjs/core/api/discount-api.d.ts +10 -0
  151. package/lib/typescript/commonjs/core/api/gateway-api.d.ts +150 -0
  152. package/lib/typescript/commonjs/core/api/payments-api.d.ts +22 -0
  153. package/lib/typescript/commonjs/core/api/repositories.d.ts +86 -0
  154. package/lib/typescript/commonjs/core/assets/images.d.ts +5 -0
  155. package/lib/typescript/commonjs/core/assets/method-logos.d.ts +12 -0
  156. package/lib/typescript/commonjs/core/assets/pwa-images.d.ts +7 -0
  157. package/lib/typescript/commonjs/core/browser/clipboard.d.ts +3 -0
  158. package/lib/typescript/commonjs/core/browser/dom.d.ts +11 -0
  159. package/lib/typescript/commonjs/core/browser/hosted-checkout.d.ts +27 -0
  160. package/lib/typescript/commonjs/core/browser/index.d.ts +11 -0
  161. package/lib/typescript/commonjs/core/browser/qr.d.ts +18 -0
  162. package/lib/typescript/commonjs/core/browser/three-ds.d.ts +45 -0
  163. package/lib/typescript/commonjs/core/client.d.ts +181 -0
  164. package/lib/typescript/commonjs/core/config.d.ts +86 -0
  165. package/lib/typescript/commonjs/core/environment.d.ts +22 -0
  166. package/lib/typescript/commonjs/core/errors.d.ts +78 -0
  167. package/lib/typescript/commonjs/core/events.d.ts +19 -0
  168. package/lib/typescript/commonjs/core/flows/controller.d.ts +41 -0
  169. package/lib/typescript/commonjs/core/flows/countdown.d.ts +15 -0
  170. package/lib/typescript/commonjs/core/flows/direct-bank-transfer.d.ts +49 -0
  171. package/lib/typescript/commonjs/core/flows/direct-card.d.ts +94 -0
  172. package/lib/typescript/commonjs/core/flows/direct-ewallet.d.ts +39 -0
  173. package/lib/typescript/commonjs/core/flows/direct-one-bill.d.ts +38 -0
  174. package/lib/typescript/commonjs/core/flows/direct-qr.d.ts +25 -0
  175. package/lib/typescript/commonjs/core/flows/direct-rtp.d.ts +72 -0
  176. package/lib/typescript/commonjs/core/flows/discount-lookup.d.ts +37 -0
  177. package/lib/typescript/commonjs/core/flows/headless.d.ts +38 -0
  178. package/lib/typescript/commonjs/core/flows/payment-sheet.d.ts +263 -0
  179. package/lib/typescript/commonjs/core/flows/services.d.ts +22 -0
  180. package/lib/typescript/commonjs/core/flows/shared.d.ts +40 -0
  181. package/lib/typescript/commonjs/core/http/api-client.d.ts +37 -0
  182. package/lib/typescript/commonjs/core/http/endpoints.d.ts +39 -0
  183. package/lib/typescript/commonjs/core/http/token-manager.d.ts +19 -0
  184. package/lib/typescript/commonjs/core/http/transport.d.ts +37 -0
  185. package/lib/typescript/commonjs/core/index.d.ts +42 -0
  186. package/lib/typescript/commonjs/core/models/category.d.ts +35 -0
  187. package/lib/typescript/commonjs/core/models/discount.d.ts +41 -0
  188. package/lib/typescript/commonjs/core/models/payment.d.ts +104 -0
  189. package/lib/typescript/commonjs/core/models/session.d.ts +87 -0
  190. package/lib/typescript/commonjs/core/server/index.d.ts +10 -0
  191. package/lib/typescript/commonjs/core/server/node.d.ts +19 -0
  192. package/lib/typescript/commonjs/core/server/proxy.d.ts +30 -0
  193. package/lib/typescript/commonjs/core/server/verify.d.ts +61 -0
  194. package/lib/typescript/commonjs/core/swichpay.d.ts +40 -0
  195. package/lib/typescript/commonjs/core/utils/crypto.d.ts +19 -0
  196. package/lib/typescript/commonjs/core/utils/formatters.d.ts +19 -0
  197. package/lib/typescript/commonjs/core/utils/json.d.ts +27 -0
  198. package/lib/typescript/commonjs/core/utils/log.d.ts +15 -0
  199. package/lib/typescript/commonjs/core/utils/runtime.d.ts +12 -0
  200. package/lib/typescript/commonjs/core/utils/validators.d.ts +23 -0
  201. package/lib/typescript/commonjs/hooks.d.ts +21 -0
  202. package/lib/typescript/commonjs/index.d.ts +26 -0
  203. package/lib/typescript/commonjs/package.json +1 -0
  204. package/lib/typescript/commonjs/polyfills.d.ts +2 -0
  205. package/lib/typescript/commonjs/presenter.d.ts +25 -0
  206. package/lib/typescript/commonjs/provider.d.ts +22 -0
  207. package/lib/typescript/commonjs/swichpay.d.ts +125 -0
  208. package/lib/typescript/commonjs/theme.d.ts +52 -0
  209. package/lib/typescript/commonjs/ui.d.ts +583 -0
  210. package/lib/typescript/commonjs/webviews.d.ts +40 -0
  211. package/lib/typescript/module/HostedCheckout.d.ts +17 -0
  212. package/lib/typescript/module/checkout-webview.d.ts +14 -0
  213. package/lib/typescript/module/checkouts/PaymentSheet.d.ts +14 -0
  214. package/lib/typescript/module/checkouts/direct.d.ts +18 -0
  215. package/lib/typescript/module/context.d.ts +20 -0
  216. package/lib/typescript/module/core/api/direct-payment-api.d.ts +103 -0
  217. package/lib/typescript/module/core/api/discount-api.d.ts +10 -0
  218. package/lib/typescript/module/core/api/gateway-api.d.ts +150 -0
  219. package/lib/typescript/module/core/api/payments-api.d.ts +22 -0
  220. package/lib/typescript/module/core/api/repositories.d.ts +86 -0
  221. package/lib/typescript/module/core/assets/images.d.ts +5 -0
  222. package/lib/typescript/module/core/assets/method-logos.d.ts +12 -0
  223. package/lib/typescript/module/core/assets/pwa-images.d.ts +7 -0
  224. package/lib/typescript/module/core/browser/clipboard.d.ts +3 -0
  225. package/lib/typescript/module/core/browser/dom.d.ts +11 -0
  226. package/lib/typescript/module/core/browser/hosted-checkout.d.ts +27 -0
  227. package/lib/typescript/module/core/browser/index.d.ts +11 -0
  228. package/lib/typescript/module/core/browser/qr.d.ts +18 -0
  229. package/lib/typescript/module/core/browser/three-ds.d.ts +45 -0
  230. package/lib/typescript/module/core/client.d.ts +181 -0
  231. package/lib/typescript/module/core/config.d.ts +86 -0
  232. package/lib/typescript/module/core/environment.d.ts +22 -0
  233. package/lib/typescript/module/core/errors.d.ts +78 -0
  234. package/lib/typescript/module/core/events.d.ts +19 -0
  235. package/lib/typescript/module/core/flows/controller.d.ts +41 -0
  236. package/lib/typescript/module/core/flows/countdown.d.ts +15 -0
  237. package/lib/typescript/module/core/flows/direct-bank-transfer.d.ts +49 -0
  238. package/lib/typescript/module/core/flows/direct-card.d.ts +94 -0
  239. package/lib/typescript/module/core/flows/direct-ewallet.d.ts +39 -0
  240. package/lib/typescript/module/core/flows/direct-one-bill.d.ts +38 -0
  241. package/lib/typescript/module/core/flows/direct-qr.d.ts +25 -0
  242. package/lib/typescript/module/core/flows/direct-rtp.d.ts +72 -0
  243. package/lib/typescript/module/core/flows/discount-lookup.d.ts +37 -0
  244. package/lib/typescript/module/core/flows/headless.d.ts +38 -0
  245. package/lib/typescript/module/core/flows/payment-sheet.d.ts +263 -0
  246. package/lib/typescript/module/core/flows/services.d.ts +22 -0
  247. package/lib/typescript/module/core/flows/shared.d.ts +40 -0
  248. package/lib/typescript/module/core/http/api-client.d.ts +37 -0
  249. package/lib/typescript/module/core/http/endpoints.d.ts +39 -0
  250. package/lib/typescript/module/core/http/token-manager.d.ts +19 -0
  251. package/lib/typescript/module/core/http/transport.d.ts +37 -0
  252. package/lib/typescript/module/core/index.d.ts +42 -0
  253. package/lib/typescript/module/core/models/category.d.ts +35 -0
  254. package/lib/typescript/module/core/models/discount.d.ts +41 -0
  255. package/lib/typescript/module/core/models/payment.d.ts +104 -0
  256. package/lib/typescript/module/core/models/session.d.ts +87 -0
  257. package/lib/typescript/module/core/server/index.d.ts +10 -0
  258. package/lib/typescript/module/core/server/node.d.ts +19 -0
  259. package/lib/typescript/module/core/server/proxy.d.ts +30 -0
  260. package/lib/typescript/module/core/server/verify.d.ts +61 -0
  261. package/lib/typescript/module/core/swichpay.d.ts +40 -0
  262. package/lib/typescript/module/core/utils/crypto.d.ts +19 -0
  263. package/lib/typescript/module/core/utils/formatters.d.ts +19 -0
  264. package/lib/typescript/module/core/utils/json.d.ts +27 -0
  265. package/lib/typescript/module/core/utils/log.d.ts +15 -0
  266. package/lib/typescript/module/core/utils/runtime.d.ts +12 -0
  267. package/lib/typescript/module/core/utils/validators.d.ts +23 -0
  268. package/lib/typescript/module/hooks.d.ts +21 -0
  269. package/lib/typescript/module/index.d.ts +26 -0
  270. package/lib/typescript/module/polyfills.d.ts +2 -0
  271. package/lib/typescript/module/presenter.d.ts +25 -0
  272. package/lib/typescript/module/provider.d.ts +22 -0
  273. package/lib/typescript/module/swichpay.d.ts +125 -0
  274. package/lib/typescript/module/theme.d.ts +52 -0
  275. package/lib/typescript/module/ui.d.ts +583 -0
  276. package/lib/typescript/module/webviews.d.ts +40 -0
  277. package/package.json +129 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,32 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0
4
+
5
+ Initial release — the SwichPay SDK for React Native / Expo:
6
+
7
+ - `<SwichPayProvider options>` (or `SwichPay.initialize`), `presentPaymentSheet`, card with 3-D Secure (device check and
8
+ challenge in WebViews), EasyPaisa/JazzCash, bank transfer with OTP, 1Bill, RAAST QR, RTP Now,
9
+ RTP E-wallet, hosted checkout, `pay`, `onResult`, `availableCategories`, `inquirePaymentSession`.
10
+ - Own-screen payments: `SwichPay.payWithCard` (3-D Secure handled by the SDK) and
11
+ `SwichPay.payWithWallet`, plus every direct client method.
12
+ - `@swichpay/react-native/server`: the proxy helper for your backend, `createPaymentVerifier`
13
+ (server-side verification with the inquire API) and `createCheckoutSessionCreator`.
14
+ - Checkouts open as content-height bottom sheets (hosted checkout and 3-D Secure stay full
15
+ screen); bank lists are a searchable dropdown.
16
+ - Full guides in `docs/`.
17
+
18
+ Security hardening:
19
+
20
+ - `clientSecret` / `secretHashKey` are now refused inside a React Native app, not only in a
21
+ browser (override with `dangerouslyAllowBrowserSecrets` for local testing).
22
+ - `production` requires `https://` for `proxyUrl`, `hosts` and `baseUrlOverride`; the checkout
23
+ and 3-D Secure WebViews no longer load plain-HTTP pages (redirect URLs are still detected).
24
+ - `createSwichPayProxy` now requires `authorize`, and `verifyAmount` when `secretHashKey` is set,
25
+ so the proxy no longer signs whatever amount the app sends. See docs/server.md.
26
+ - Log redaction now covers nested fields, CVV, expiry and the `Publickey` / `x-public-key` /
27
+ `Cookie` headers.
28
+
29
+ Packaging:
30
+
31
+ - Built with react-native-builder-bob: ES modules (`lib/module`), CommonJS (`lib/commonjs`) and
32
+ types for both, so Jest and `require()` work without configuration.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SwichPay
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,83 @@
1
- # Temporary Holding Version
1
+ # @swichpay/react-native
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Accept SwichPay payments in React Native and Expo apps. The SDK supports cards with 3-D Secure, JazzCash and EasyPaisa, bank accounts with OTP, 1Bill, RAAST QR, RTP Now and RTP E-Wallet. You can use the ready-made checkout screens, or keep your own design and take payments with a single function call.
4
+
5
+ ```tsx
6
+ const result = await SwichPay.presentPaymentSheet(order);
7
+ if (result?.isSuccess) navigation.navigate('ThankYou');
8
+ ```
9
+
10
+ | You want | Use |
11
+ |---|---|
12
+ | One screen with every payment method enabled for your account | `SwichPay.presentPaymentSheet(order)` |
13
+ | One specific method (card, wallet, bank, 1Bill, QR, RTP) | `SwichPay.presentCardCheckout(order)`, … |
14
+ | SwichPay's hosted payment page | `SwichPay.presentHostedCheckout(order)` |
15
+ | Your own checkout design, no SDK screen | `SwichPay.payWithCard(...)`, `SwichPay.payWithWallet(...)` |
16
+
17
+ ## Install
18
+
19
+ ```sh
20
+ npx expo install @swichpay/react-native react-native-webview
21
+ ```
22
+
23
+ Bare React Native: `npm install @swichpay/react-native react-native-webview && cd ios && pod install`
24
+
25
+ Requirements: React Native 0.74+, React 18.2+, `react-native-webview` 13+. It works in Expo Go.
26
+
27
+ ## Quick start
28
+
29
+ ```tsx
30
+ import { SwichPayProvider, SwichPay } from '@swichpay/react-native';
31
+
32
+ export default function App() {
33
+ return (
34
+ <SwichPayProvider
35
+ options={{
36
+ clientId: 'your-client-id',
37
+ merchantId: 1848,
38
+ appId: 'com.yourapp',
39
+ referrer: 'https://yourshop.com/',
40
+ environment: 'sandbox',
41
+ proxyUrl: 'https://api.yourshop.com/api/swichpay', // your backend, see docs/server.md
42
+ }}
43
+ >
44
+ <RootNavigator />
45
+ </SwichPayProvider>
46
+ );
47
+ }
48
+ ```
49
+
50
+ Your client secret never goes into the app. Your backend adds it through a small proxy that ships with this package (`@swichpay/react-native/server`).
51
+
52
+ ## Documentation
53
+
54
+ | Guide | |
55
+ |---|---|
56
+ | [Getting started](docs/getting-started.md) | Install, configure, take a first sandbox payment |
57
+ | [Checkout screens](docs/checkouts.md) | Payment sheet, each payment method, hosted checkout |
58
+ | [Your own screen](docs/own-screen.md) | Pay with your own fields: `payWithCard`, `payWithWallet` |
59
+ | [Server setup](docs/server.md) | Proxy, securing it, verifying payments before you ship |
60
+ | [Results and errors](docs/results-and-errors.md) | `PaymentResult`, error types, what to show the customer |
61
+ | [Going live](docs/going-live.md) | Production checklist |
62
+ | [Troubleshooting](docs/troubleshooting.md) | Common problems and fixes |
63
+
64
+ ## Example app
65
+
66
+ [`example/`](example) is a demo store that uses every checkout, plus a backend with the proxy.
67
+
68
+ ```sh
69
+ cd example
70
+ npm install
71
+ cp .env.example .env # your sandbox values
72
+ npm run server # backend on port 3230 (holds the secrets)
73
+ npx expo start # press "a" for Android, or scan the QR code with Expo Go
74
+ ```
75
+
76
+ ## Develop
77
+
78
+ ```sh
79
+ npm install
80
+ npm run verify # build + typecheck + tests
81
+ ```
82
+
83
+ MIT licensed. Security issues: see [SECURITY.md](SECURITY.md).
@@ -0,0 +1,98 @@
1
+ # Checkout screens
2
+
3
+ The SDK includes ready-made checkout screens. Each one opens as a bottom sheet that is only as tall as its content, and resolves with the outcome when the customer finishes or closes it.
4
+
5
+ ```ts
6
+ const result = await SwichPay.presentCardCheckout(order);
7
+ // result: PaymentResult, or null if the customer closed the sheet
8
+ ```
9
+
10
+ Every `present*` call needs `<SwichPayProvider>` mounted at the root of your app. You can call them on `SwichPay` from anywhere, or on `useSwichPay()` inside a component.
11
+
12
+ ## Payment sheet
13
+
14
+ ```ts
15
+ const result = await SwichPay.presentPaymentSheet(order);
16
+ ```
17
+
18
+ Shows every payment method enabled for your merchant account, then the form for the method the customer picks. It also shows saved cards and wallets, and any discount that applies.
19
+
20
+ To show only some methods, pass `categories`:
21
+
22
+ ```ts
23
+ import { PaymentCategory } from '@swichpay/react-native';
24
+
25
+ await SwichPay.presentPaymentSheet(order, {
26
+ categories: [PaymentCategory.visaMasterCardPayment, PaymentCategory.ewallet],
27
+ });
28
+ ```
29
+
30
+ To list the enabled methods yourself, use `useAvailableCategories()`, or `SwichPay.availableCategories()` outside a component.
31
+
32
+ ## One payment method
33
+
34
+ Open a single method directly. The customer skips the method list.
35
+
36
+ | Method | Call | What the customer does |
37
+ |---|---|---|
38
+ | Card | `presentCardCheckout(order)` | Enters card number, expiry and CVC, and can save the card. The bank's 3-D Secure page opens if the bank asks for it |
39
+ | JazzCash / EasyPaisa | `presentEwalletCheckout(order)` | Picks a wallet, enters the account number, approves the request in the wallet app |
40
+ | Bank account | `presentBankTransferCheckout(order)` | Picks a bank from the list, enters the account number, then the OTP the bank sends |
41
+ | 1Bill | `presentOneBillCheckout(order)` | Enters a mobile number, gets a 1Bill consumer number, pays it in any banking app |
42
+ | RAAST QR | `presentQrCheckout(order)` | Scans the QR code with any banking app. The QR can be shared or saved |
43
+ | RTP Now | `presentRtpNowCheckout(order)` | Receives a payment request by mobile number, IBAN or bank account, approves it in the banking app |
44
+ | RTP E-Wallet | `presentRtpEwalletCheckout(order)` | Picks a wallet bank, enters the mobile number, approves the request |
45
+
46
+ Banks are picked from a searchable dropdown. Fields are validated as the customer types, and errors appear under each field.
47
+
48
+ `presentCardCheckout` accepts `{ allowSaveCard: false }` to hide the "Save this card" option.
49
+
50
+ ## Hosted checkout
51
+
52
+ ```ts
53
+ await SwichPay.presentHostedCheckout(order); // full screen
54
+ await SwichPay.presentHostedCheckoutSheet(order); // tall sheet
55
+ ```
56
+
57
+ Opens SwichPay's hosted payment page in a WebView. Use it when you want SwichPay to render the whole checkout. The hosted page and 3-D Secure always open full screen, because a bank's web page needs the space.
58
+
59
+ ## Embed a checkout in your own screen
60
+
61
+ Every checkout is also a component. Render it inside your own screen instead of opening it as a sheet:
62
+
63
+ ```tsx
64
+ import { CardCheckout } from '@swichpay/react-native';
65
+
66
+ <CardCheckout details={order} onFinish={(result) => handle(result)} />
67
+ ```
68
+
69
+ Available components: `PaymentSheet`, `CardCheckout`, `EwalletCheckout`, `BankTransferCheckout`, `OneBillCheckout`, `QrCheckout`, `RtpNowCheckout`, `RtpEwalletCheckout`, `HostedCheckout`. They all take `details` and `onFinish`. `onFinish(null)` means the customer closed the checkout.
70
+
71
+ ## Listen to every result
72
+
73
+ `usePaymentResult` runs for every completed payment, whichever screen started it. It unsubscribes when the component unmounts.
74
+
75
+ ```tsx
76
+ import { usePaymentResult } from '@swichpay/react-native';
77
+
78
+ usePaymentResult((result) => {
79
+ if (result.isSuccess) analytics.track('payment_success', { orderId: result.orderId });
80
+ });
81
+ ```
82
+
83
+ Outside components, `SwichPay.onResult(callback)` returns an unsubscribe function.
84
+
85
+ ## The order (`PaymentDetails`)
86
+
87
+ | Field | Description |
88
+ |---|---|
89
+ | `orderNumber` | Your order number |
90
+ | `customerTransactionId` | Your reference for this payment attempt. Use a new value for every attempt, and look the order up by it in `verifyAmount` |
91
+ | `billReferenceNo` | Bill reference shown to the customer |
92
+ | `merchantName` | Shown in the checkout header |
93
+ | `consumerName`, `email`, `msisdn`, `cnic` | Customer details. `msisdn` is an 11-digit mobile number (`03001234567`); `cnic` is 13 digits |
94
+ | `amount`, `currency` | For example `1500` and `'PKR'` |
95
+ | `item` | What the customer is paying for, shown in the checkout |
96
+ | `successRedirectUrl`, `failedRedirectUrl` | Where the hosted page and 3-D Secure return to. Use your own HTTPS URLs |
97
+
98
+ Optional: `description`, `discountAmount`, `isRecurringPayment`.
@@ -0,0 +1,140 @@
1
+ # Getting started
2
+
3
+ This guide takes you from install to a first sandbox payment in about 15 minutes.
4
+
5
+ ## What you need
6
+
7
+ - A SwichPay merchant account with **sandbox** credentials:
8
+ - **Client ID** (public, goes in the app)
9
+ - **Client secret** (private, stays on your server)
10
+ - **Secret hash key** (private, stays on your server; needed only for card payments)
11
+ - **Merchant ID** and **App ID** (both public)
12
+ - A React Native 0.74+ or Expo app
13
+ - A backend you control (Node 18+) for the SwichPay proxy. During development, the proxy can run on your PC.
14
+
15
+ ## 1. Install
16
+
17
+ ```sh
18
+ npx expo install @swichpay/react-native react-native-webview
19
+ ```
20
+
21
+ `react-native-webview` shows the bank's 3-D Secure page and SwichPay's hosted checkout.
22
+
23
+ ## 2. Start the proxy on your server
24
+
25
+ The SDK never holds your client secret. It sends every request to your backend, and your backend adds the secret before forwarding the request to SwichPay. The proxy only forwards SwichPay's own payment endpoints, so it can't be used to call anything else.
26
+
27
+ ```ts
28
+ // server.ts (Express)
29
+ import express from 'express';
30
+ import { createSwichPayProxy, createNodeProxyMiddleware } from '@swichpay/react-native/server';
31
+
32
+ const swichpay = createSwichPayProxy({
33
+ clientId: process.env.SWICHPAY_CLIENT_ID!,
34
+ merchantId: Number(process.env.SWICHPAY_MERCHANT_ID),
35
+ appId: process.env.SWICHPAY_APP_ID!,
36
+ referrer: process.env.SWICHPAY_REFERRER!,
37
+ environment: 'sandbox',
38
+ clientSecret: process.env.SWICHPAY_CLIENT_SECRET,
39
+ secretHashKey: process.env.SWICHPAY_SECRET_HASH_KEY,
40
+ authorize: async (request) => {
41
+ if (!(await isSignedIn(request))) return new Response('Unauthorized', { status: 401 });
42
+ },
43
+ verifyAmount: async ({ customerTransactionId, amount, currency }) => {
44
+ const order = await db.orders.find(customerTransactionId);
45
+ return order?.amount === amount && order?.currency === currency;
46
+ },
47
+ });
48
+
49
+ const app = express();
50
+ app.use(createNodeProxyMiddleware(swichpay, '/api/swichpay'));
51
+ app.listen(3230);
52
+ ```
53
+
54
+ [Server setup](server.md) explains `authorize` and `verifyAmount`, and shows how to verify a payment before you ship an order.
55
+
56
+ ## 3. Add the provider
57
+
58
+ Mount `SwichPayProvider` once, at the root of your app. It creates the SDK client and shows checkouts on top of your screens.
59
+
60
+ ```tsx
61
+ import { SwichPayProvider } from '@swichpay/react-native';
62
+
63
+ export default function App() {
64
+ return (
65
+ <SwichPayProvider
66
+ options={{
67
+ clientId: process.env.EXPO_PUBLIC_SWICHPAY_CLIENT_ID!,
68
+ merchantId: 1848,
69
+ appId: 'com.yourapp',
70
+ referrer: 'https://yourshop.com/',
71
+ environment: 'sandbox',
72
+ proxyUrl: 'https://api.yourshop.com/api/swichpay',
73
+ }}
74
+ >
75
+ <RootNavigator />
76
+ </SwichPayProvider>
77
+ );
78
+ }
79
+ ```
80
+
81
+ | Option | Required | Description |
82
+ |---|---|---|
83
+ | `clientId` | yes | Your public client ID |
84
+ | `merchantId` | yes | Your merchant ID (a number) |
85
+ | `appId` | yes | Your app ID as registered with SwichPay |
86
+ | `referrer` | yes | The referrer URL registered with SwichPay |
87
+ | `environment` | yes | `'sandbox'` or `'production'` |
88
+ | `proxyUrl` | yes* | Your proxy route. *Or use `getAccessToken` / `getChecksum` if your backend issues tokens itself |
89
+ | `logger` | no | `(line) => console.log(line)`. Off by default. Card numbers, CVV, CNIC, OTPs and tokens are always masked |
90
+
91
+ During development, `proxyUrl` can point at your PC:
92
+
93
+ | Where the app runs | `proxyUrl` |
94
+ |---|---|
95
+ | Android emulator | `http://10.0.2.2:3230/api/swichpay` |
96
+ | Phone on the same Wi-Fi | `http://<your PC's LAN IP>:3230/api/swichpay` |
97
+ | Phone on USB, after `adb reverse tcp:3230 tcp:3230` | `http://localhost:3230/api/swichpay` |
98
+
99
+ `http://` works in sandbox only. Production requires `https://`.
100
+
101
+ ## 4. Take a payment
102
+
103
+ ```tsx
104
+ import { SwichPay, type PaymentDetails } from '@swichpay/react-native';
105
+
106
+ const order: PaymentDetails = {
107
+ orderNumber: 'ORD-1001',
108
+ customerTransactionId: 'ORD-1001', // must be unique per payment attempt
109
+ billReferenceNo: 'ORD-1001',
110
+ merchantName: 'Your Shop',
111
+ consumerName: 'Ayesha Khan',
112
+ amount: 1500,
113
+ currency: 'PKR',
114
+ email: 'ayesha@example.com',
115
+ msisdn: '03001234567',
116
+ cnic: '4220112345671',
117
+ item: 'Order #1001',
118
+ successRedirectUrl: 'https://yourshop.com/pay/success',
119
+ failedRedirectUrl: 'https://yourshop.com/pay/failed',
120
+ };
121
+
122
+ async function checkout() {
123
+ const result = await SwichPay.presentPaymentSheet(order);
124
+ if (result === null) return; // the customer closed the sheet
125
+ if (result.isSuccess) navigation.navigate('ThankYou', { orderId: order.orderNumber });
126
+ else showMessage(result.message ?? 'Payment failed');
127
+ }
128
+ ```
129
+
130
+ The payment sheet lists every payment method enabled for your merchant account.
131
+
132
+ ## 5. Confirm on your server
133
+
134
+ `result.isSuccess` is for your UI only. Before you mark the order paid or ship anything, confirm the payment from your backend. See [Verify payments](server.md#verify-payments-before-you-ship).
135
+
136
+ ## Next
137
+
138
+ - [Checkout screens](checkouts.md): open one payment method directly
139
+ - [Your own screen](own-screen.md): keep your design, pay with one call
140
+ - [Going live](going-live.md)
@@ -0,0 +1,45 @@
1
+ # Going live
2
+
3
+ Work through this list before you switch to production.
4
+
5
+ ## Credentials and configuration
6
+
7
+ - [ ] Production credentials received from SwichPay (client ID, client secret, secret hash key, merchant ID, app ID)
8
+ - [ ] App: `environment: 'production'`, and the production client ID, merchant ID and app ID
9
+ - [ ] Server: the same values plus the production client secret and secret hash key, stored in your secret manager, not in code
10
+ - [ ] `referrer` and `appId` match what SwichPay registered for production
11
+ - [ ] No secret in the app bundle: nothing with an `EXPO_PUBLIC_` prefix holds a secret
12
+
13
+ ## Transport
14
+
15
+ - [ ] `proxyUrl` is `https://`. The SDK throws in production if any host is `http://`
16
+ - [ ] Your release build does not allow cleartext HTTP (`usesCleartextTraffic` is off). The example app turns it on only to reach a local demo backend
17
+
18
+ ## Your backend
19
+
20
+ - [ ] `authorize` checks a real user session, and `dangerouslyAllowUnauthenticated` is gone
21
+ - [ ] `verifyAmount` checks the amount against your database, and `dangerouslySignAnyAmount` is gone
22
+ - [ ] Rate limiting is in front of the proxy route
23
+ - [ ] Orders are marked paid only after `createPaymentVerifier` returns `verified: true`
24
+ - [ ] `pending` orders are re-checked later instead of being cancelled
25
+
26
+ ## The app
27
+
28
+ - [ ] `<SwichPayProvider>` is mounted once, at the root
29
+ - [ ] `null` results (closed checkout) leave the cart untouched
30
+ - [ ] `pending` results show a "waiting for confirmation" screen, not a failure
31
+ - [ ] `logger` is removed or disabled
32
+ - [ ] Each payment attempt uses a new `customerTransactionId`
33
+
34
+ ## Test in sandbox first
35
+
36
+ Before switching, run every method you will offer end to end in sandbox, on a real device:
37
+
38
+ - [ ] Card with 3-D Secure, and a declined card
39
+ - [ ] JazzCash and EasyPaisa approval, and a rejected approval
40
+ - [ ] Bank account with OTP
41
+ - [ ] 1Bill and RAAST QR
42
+ - [ ] RTP Now and RTP E-Wallet
43
+ - [ ] Closing each checkout halfway
44
+ - [ ] Airplane mode during a payment
45
+ - [ ] Server verification for each of the above
@@ -0,0 +1,81 @@
1
+ # Pay from your own screen
2
+
3
+ Keep your own checkout design (your fields, your "Place order" button) and take the payment with one call. The SDK shows no screen of its own, except the bank's 3-D Secure page when the bank requires it.
4
+
5
+ ## Card
6
+
7
+ ```ts
8
+ import { SwichPay, SwichPayValidationException } from '@swichpay/react-native';
9
+
10
+ try {
11
+ const result = await SwichPay.payWithCard({
12
+ details: order,
13
+ card: { number: '4111111111111111', expMonth: 12, expYear: 2030, cvv: '123' },
14
+ });
15
+ if (result.isSuccess) navigation.navigate('ThankYou');
16
+ else showError(result.message);
17
+ } catch (error) {
18
+ if (error instanceof SwichPayValidationException) showError(error.message); // invalid card fields
19
+ else throw error;
20
+ }
21
+ ```
22
+
23
+ The SDK checks the card fields before it sends anything, runs the device check, and opens the bank's OTP page only if the bank asks for it.
24
+
25
+ Card payments need `secretHashKey` and `verifyAmount` on your proxy. See [Server setup](server.md).
26
+
27
+ ### Formatting helpers for your fields
28
+
29
+ The SDK's own validators and formatters are exported, so your fields behave like the built-in checkout:
30
+
31
+ ```ts
32
+ import { formatCardNumber, formatExpiry, CardValidators, validateCard } from '@swichpay/react-native';
33
+
34
+ formatCardNumber('4111111111111111'); // '4111 1111 1111 1111'
35
+ formatExpiry('1230'); // '12/30'
36
+ CardValidators.detectBrand('4111'); // 'visa'
37
+ ```
38
+
39
+ Payment method logos (Visa, Mastercard, PayPak, JazzCash, EasyPaisa, 1Bill, …) are exported as image data URIs, for example `<Image source={{ uri: LOGO_VISA }} />`.
40
+
41
+ ## JazzCash / EasyPaisa
42
+
43
+ ```ts
44
+ const result = await SwichPay.payWithWallet({
45
+ details: order,
46
+ wallet: 'jazzcash', // or 'easypaisa'
47
+ msisdn: '03001234567',
48
+ });
49
+ ```
50
+
51
+ The customer gets a request in their wallet app and approves it there. The promise resolves once the wallet answers.
52
+
53
+ ## Other methods
54
+
55
+ Every other flow is also available as a direct client method, so you can build any screen yourself:
56
+
57
+ | Flow | Methods on `SwichPay.client` |
58
+ |---|---|
59
+ | Bank account + OTP | `fetchDirectBankList()`, `directBankTransfer(...)`, `confirmDirectBankTransfer(...)` |
60
+ | 1Bill | `generateDirectOneBill(...)`, `checkDirectOneBillStatus(...)` |
61
+ | RAAST QR | `generateDirectQrPayment(...)`, `checkDirectQrStatus(...)` |
62
+ | RTP Now | `fetchDirectRtpNowBanks()`, `directRtpNowPayment(...)` |
63
+ | RTP E-Wallet | `fetchDirectRtpEwalletBanks()`, `directRtpEwalletPayment(...)` |
64
+
65
+ All methods are typed, so your editor shows their parameters and results.
66
+
67
+ ## Headless controllers (advanced)
68
+
69
+ The built-in screens are thin views over headless controllers that hold all the logic: validation, countdowns, polling and retry rules. If you want the SDK's exact behaviour with a completely custom UI, render a controller's state yourself:
70
+
71
+ ```tsx
72
+ import { useController, useSwichPayClient, DirectBankTransferController } from '@swichpay/react-native';
73
+
74
+ const client = useSwichPayClient();
75
+ const [controller, state] = useController(
76
+ () => new DirectBankTransferController(client, { details: order, onFinish: handleResult }),
77
+ (c) => c.start(),
78
+ );
79
+ ```
80
+
81
+ The source of the built-in screens (`src/checkouts/`) is the reference for every controller.
@@ -0,0 +1,75 @@
1
+ # Results and errors
2
+
3
+ ## `PaymentResult`
4
+
5
+ Every checkout resolves with a `PaymentResult`, or with `null` when the customer closed the checkout without paying.
6
+
7
+ ```ts
8
+ const result = await SwichPay.presentPaymentSheet(order);
9
+
10
+ if (result === null) {
11
+ // closed: leave the cart as it is
12
+ } else if (result.isSuccess) {
13
+ // paid (confirm on your server before shipping, see server.md)
14
+ } else if (result.status === 'pending') {
15
+ // waiting for the customer or the bank, e.g. a wallet approval not yet answered
16
+ } else {
17
+ showError(result.message ?? 'Payment failed. Please try again.');
18
+ }
19
+ ```
20
+
21
+ | Field | Description |
22
+ |---|---|
23
+ | `isSuccess` | `true` when the payment completed |
24
+ | `status` | `success`, `failed`, `pending`, `cancelled` or `error` |
25
+ | `message` | Text from SwichPay, safe to show the customer |
26
+ | `code` | SwichPay's result code (`0000` = success) |
27
+ | `orderId` | SwichPay's order identifier |
28
+ | `remainingAttempts` | Attempts left on the payment session, when SwichPay sends it |
29
+ | `consumerNumber` | The 1Bill consumer number (1Bill only) |
30
+ | `qrString` | The QR payload (RAAST QR only) |
31
+ | `transactionReferenceNo`, `bankTransactionId` | References to quote to support |
32
+
33
+ `pending` is not a failure. Don't let the customer pay again. Verify the payment on your server later, see [Verify payments](server.md#verify-payments-before-you-ship).
34
+
35
+ ## Errors
36
+
37
+ The built-in checkout screens handle errors themselves and show a message in the sheet. Errors reach your code only from direct calls (`payWithCard`, `payWithWallet`, `SwichPay.client.*`, `availableCategories`, …). Every error is a `SwichPayException` with a `kind`:
38
+
39
+ | Class | `kind` | When | What to do |
40
+ |---|---|---|---|
41
+ | `SwichPayValidationException` | `validation` | Invalid input (card number, mobile number, …) or invalid SDK options. Nothing was sent | Show `error.message` next to the field |
42
+ | `SwichPayNetworkException` | `network` | No connection or a timeout | Ask the customer to check their connection and retry |
43
+ | `SwichPayApiException` | `api` | SwichPay or your proxy answered with an error | Show the message. Check `error.isPending` first |
44
+ | `SwichPayNotInitializedException` | `not_initialized` | A call before `<SwichPayProvider>` (or `SwichPay.initialize`) ran | Mount the provider at the root of the app |
45
+
46
+ ```ts
47
+ import { SwichPayApiException, swichpayUserError } from '@swichpay/react-native';
48
+
49
+ try {
50
+ await SwichPay.payWithWallet({ details: order, wallet: 'easypaisa', msisdn });
51
+ } catch (error) {
52
+ if (error instanceof SwichPayApiException && error.isPending) {
53
+ return showPending(); // the bank is still deciding: never retry, it could charge twice
54
+ }
55
+ showError(swichpayUserError(error)); // customer-friendly text for any error
56
+ }
57
+ ```
58
+
59
+ `swichpayUserError(error)` turns any error into text you can show the customer. Technical details stay in `error.statusCode`, `error.code` and `error.serverMessage` for your logs.
60
+
61
+ ## Retries
62
+
63
+ - After a declined card, the checkout shows how many attempts remain (`remainingAttempts`). When none remain, the customer must start a new payment.
64
+ - Never retry a `pending` payment automatically. It may still complete.
65
+ - Use a new `customerTransactionId` for each new payment attempt.
66
+
67
+ ## Logging
68
+
69
+ Logging is off by default. To debug, pass a logger:
70
+
71
+ ```tsx
72
+ <SwichPayProvider options={{ ...options, logger: (line) => console.log('[swichpay]', line) }} />
73
+ ```
74
+
75
+ Card numbers, CVV, CNIC, OTPs, tokens and session keys are always masked in log lines. Turn logging off in production builds.