@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.
- package/CHANGELOG.md +32 -0
- package/LICENSE +21 -0
- package/README.md +82 -2
- package/docs/checkouts.md +98 -0
- package/docs/getting-started.md +140 -0
- package/docs/going-live.md +45 -0
- package/docs/own-screen.md +81 -0
- package/docs/results-and-errors.md +75 -0
- package/docs/server.md +163 -0
- package/docs/troubleshooting.md +57 -0
- package/lib/commonjs/HostedCheckout.js +115 -0
- package/lib/commonjs/checkout-webview.js +85 -0
- package/lib/commonjs/checkouts/PaymentSheet.js +1317 -0
- package/lib/commonjs/checkouts/direct.js +671 -0
- package/lib/commonjs/context.js +64 -0
- package/lib/commonjs/core/api/direct-payment-api.js +425 -0
- package/lib/commonjs/core/api/discount-api.js +19 -0
- package/lib/commonjs/core/api/gateway-api.js +366 -0
- package/lib/commonjs/core/api/payments-api.js +79 -0
- package/lib/commonjs/core/api/repositories.js +5 -0
- package/lib/commonjs/core/assets/images.js +12 -0
- package/lib/commonjs/core/assets/method-logos.js +19 -0
- package/lib/commonjs/core/assets/pwa-images.js +13 -0
- package/lib/commonjs/core/browser/clipboard.js +30 -0
- package/lib/commonjs/core/browser/dom.js +71 -0
- package/lib/commonjs/core/browser/hosted-checkout.js +107 -0
- package/lib/commonjs/core/browser/index.js +119 -0
- package/lib/commonjs/core/browser/qr.js +109 -0
- package/lib/commonjs/core/browser/three-ds.js +151 -0
- package/lib/commonjs/core/client.js +344 -0
- package/lib/commonjs/core/config.js +132 -0
- package/lib/commonjs/core/environment.js +34 -0
- package/lib/commonjs/core/errors.js +138 -0
- package/lib/commonjs/core/events.js +57 -0
- package/lib/commonjs/core/flows/controller.js +106 -0
- package/lib/commonjs/core/flows/countdown.js +41 -0
- package/lib/commonjs/core/flows/direct-bank-transfer.js +236 -0
- package/lib/commonjs/core/flows/direct-card.js +354 -0
- package/lib/commonjs/core/flows/direct-ewallet.js +124 -0
- package/lib/commonjs/core/flows/direct-one-bill.js +172 -0
- package/lib/commonjs/core/flows/direct-qr.js +109 -0
- package/lib/commonjs/core/flows/direct-rtp.js +302 -0
- package/lib/commonjs/core/flows/discount-lookup.js +80 -0
- package/lib/commonjs/core/flows/headless.js +94 -0
- package/lib/commonjs/core/flows/payment-sheet.js +1321 -0
- package/lib/commonjs/core/flows/services.js +31 -0
- package/lib/commonjs/core/flows/shared.js +90 -0
- package/lib/commonjs/core/http/api-client.js +208 -0
- package/lib/commonjs/core/http/endpoints.js +61 -0
- package/lib/commonjs/core/http/token-manager.js +46 -0
- package/lib/commonjs/core/http/transport.js +134 -0
- package/lib/commonjs/core/index.js +688 -0
- package/lib/commonjs/core/models/category.js +113 -0
- package/lib/commonjs/core/models/discount.js +51 -0
- package/lib/commonjs/core/models/payment.js +95 -0
- package/lib/commonjs/core/models/session.js +131 -0
- package/lib/commonjs/core/server/index.js +64 -0
- package/lib/commonjs/core/server/node.js +60 -0
- package/lib/commonjs/core/server/proxy.js +194 -0
- package/lib/commonjs/core/server/verify.js +122 -0
- package/lib/commonjs/core/swichpay.js +72 -0
- package/lib/commonjs/core/utils/crypto.js +78 -0
- package/lib/commonjs/core/utils/formatters.js +68 -0
- package/lib/commonjs/core/utils/json.js +110 -0
- package/lib/commonjs/core/utils/log.js +75 -0
- package/lib/commonjs/core/utils/runtime.js +34 -0
- package/lib/commonjs/core/utils/validators.js +59 -0
- package/lib/commonjs/hooks.js +77 -0
- package/lib/commonjs/index.js +203 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/polyfills.js +3 -0
- package/lib/commonjs/presenter.js +61 -0
- package/lib/commonjs/provider.js +192 -0
- package/lib/commonjs/swichpay.js +192 -0
- package/lib/commonjs/theme.js +54 -0
- package/lib/commonjs/ui.js +1142 -0
- package/lib/commonjs/webviews.js +279 -0
- package/lib/module/HostedCheckout.js +111 -0
- package/lib/module/checkout-webview.js +83 -0
- package/lib/module/checkouts/PaymentSheet.js +1313 -0
- package/lib/module/checkouts/direct.js +661 -0
- package/lib/module/context.js +58 -0
- package/lib/module/core/api/direct-payment-api.js +413 -0
- package/lib/module/core/api/discount-api.js +14 -0
- package/lib/module/core/api/gateway-api.js +358 -0
- package/lib/module/core/api/payments-api.js +73 -0
- package/lib/module/core/api/repositories.js +3 -0
- package/lib/module/core/assets/images.js +8 -0
- package/lib/module/core/assets/method-logos.js +15 -0
- package/lib/module/core/assets/pwa-images.js +9 -0
- package/lib/module/core/browser/clipboard.js +27 -0
- package/lib/module/core/browser/dom.js +63 -0
- package/lib/module/core/browser/hosted-checkout.js +102 -0
- package/lib/module/core/browser/index.js +12 -0
- package/lib/module/core/browser/qr.js +100 -0
- package/lib/module/core/browser/three-ds.js +145 -0
- package/lib/module/core/client.js +338 -0
- package/lib/module/core/config.js +128 -0
- package/lib/module/core/environment.js +29 -0
- package/lib/module/core/errors.js +125 -0
- package/lib/module/core/events.js +51 -0
- package/lib/module/core/flows/controller.js +101 -0
- package/lib/module/core/flows/countdown.js +36 -0
- package/lib/module/core/flows/direct-bank-transfer.js +231 -0
- package/lib/module/core/flows/direct-card.js +349 -0
- package/lib/module/core/flows/direct-ewallet.js +119 -0
- package/lib/module/core/flows/direct-one-bill.js +167 -0
- package/lib/module/core/flows/direct-qr.js +104 -0
- package/lib/module/core/flows/direct-rtp.js +297 -0
- package/lib/module/core/flows/discount-lookup.js +75 -0
- package/lib/module/core/flows/headless.js +90 -0
- package/lib/module/core/flows/payment-sheet.js +1315 -0
- package/lib/module/core/flows/services.js +27 -0
- package/lib/module/core/flows/shared.js +78 -0
- package/lib/module/core/http/api-client.js +203 -0
- package/lib/module/core/http/endpoints.js +57 -0
- package/lib/module/core/http/token-manager.js +41 -0
- package/lib/module/core/http/transport.js +126 -0
- package/lib/module/core/index.js +52 -0
- package/lib/module/core/models/category.js +104 -0
- package/lib/module/core/models/discount.js +46 -0
- package/lib/module/core/models/payment.js +89 -0
- package/lib/module/core/models/session.js +120 -0
- package/lib/module/core/server/index.js +11 -0
- package/lib/module/core/server/node.js +56 -0
- package/lib/module/core/server/proxy.js +191 -0
- package/lib/module/core/server/verify.js +115 -0
- package/lib/module/core/swichpay.js +68 -0
- package/lib/module/core/utils/crypto.js +72 -0
- package/lib/module/core/utils/formatters.js +56 -0
- package/lib/module/core/utils/json.js +94 -0
- package/lib/module/core/utils/log.js +67 -0
- package/lib/module/core/utils/runtime.js +28 -0
- package/lib/module/core/utils/validators.js +54 -0
- package/lib/module/hooks.js +72 -0
- package/lib/module/index.js +36 -0
- package/lib/module/polyfills.js +4 -0
- package/lib/module/presenter.js +58 -0
- package/lib/module/provider.js +188 -0
- package/lib/module/swichpay.js +187 -0
- package/lib/module/theme.js +50 -0
- package/lib/module/ui.js +1116 -0
- package/lib/module/webviews.js +272 -0
- package/lib/typescript/commonjs/HostedCheckout.d.ts +17 -0
- package/lib/typescript/commonjs/checkout-webview.d.ts +14 -0
- package/lib/typescript/commonjs/checkouts/PaymentSheet.d.ts +14 -0
- package/lib/typescript/commonjs/checkouts/direct.d.ts +18 -0
- package/lib/typescript/commonjs/context.d.ts +20 -0
- package/lib/typescript/commonjs/core/api/direct-payment-api.d.ts +103 -0
- package/lib/typescript/commonjs/core/api/discount-api.d.ts +10 -0
- package/lib/typescript/commonjs/core/api/gateway-api.d.ts +150 -0
- package/lib/typescript/commonjs/core/api/payments-api.d.ts +22 -0
- package/lib/typescript/commonjs/core/api/repositories.d.ts +86 -0
- package/lib/typescript/commonjs/core/assets/images.d.ts +5 -0
- package/lib/typescript/commonjs/core/assets/method-logos.d.ts +12 -0
- package/lib/typescript/commonjs/core/assets/pwa-images.d.ts +7 -0
- package/lib/typescript/commonjs/core/browser/clipboard.d.ts +3 -0
- package/lib/typescript/commonjs/core/browser/dom.d.ts +11 -0
- package/lib/typescript/commonjs/core/browser/hosted-checkout.d.ts +27 -0
- package/lib/typescript/commonjs/core/browser/index.d.ts +11 -0
- package/lib/typescript/commonjs/core/browser/qr.d.ts +18 -0
- package/lib/typescript/commonjs/core/browser/three-ds.d.ts +45 -0
- package/lib/typescript/commonjs/core/client.d.ts +181 -0
- package/lib/typescript/commonjs/core/config.d.ts +86 -0
- package/lib/typescript/commonjs/core/environment.d.ts +22 -0
- package/lib/typescript/commonjs/core/errors.d.ts +78 -0
- package/lib/typescript/commonjs/core/events.d.ts +19 -0
- package/lib/typescript/commonjs/core/flows/controller.d.ts +41 -0
- package/lib/typescript/commonjs/core/flows/countdown.d.ts +15 -0
- package/lib/typescript/commonjs/core/flows/direct-bank-transfer.d.ts +49 -0
- package/lib/typescript/commonjs/core/flows/direct-card.d.ts +94 -0
- package/lib/typescript/commonjs/core/flows/direct-ewallet.d.ts +39 -0
- package/lib/typescript/commonjs/core/flows/direct-one-bill.d.ts +38 -0
- package/lib/typescript/commonjs/core/flows/direct-qr.d.ts +25 -0
- package/lib/typescript/commonjs/core/flows/direct-rtp.d.ts +72 -0
- package/lib/typescript/commonjs/core/flows/discount-lookup.d.ts +37 -0
- package/lib/typescript/commonjs/core/flows/headless.d.ts +38 -0
- package/lib/typescript/commonjs/core/flows/payment-sheet.d.ts +263 -0
- package/lib/typescript/commonjs/core/flows/services.d.ts +22 -0
- package/lib/typescript/commonjs/core/flows/shared.d.ts +40 -0
- package/lib/typescript/commonjs/core/http/api-client.d.ts +37 -0
- package/lib/typescript/commonjs/core/http/endpoints.d.ts +39 -0
- package/lib/typescript/commonjs/core/http/token-manager.d.ts +19 -0
- package/lib/typescript/commonjs/core/http/transport.d.ts +37 -0
- package/lib/typescript/commonjs/core/index.d.ts +42 -0
- package/lib/typescript/commonjs/core/models/category.d.ts +35 -0
- package/lib/typescript/commonjs/core/models/discount.d.ts +41 -0
- package/lib/typescript/commonjs/core/models/payment.d.ts +104 -0
- package/lib/typescript/commonjs/core/models/session.d.ts +87 -0
- package/lib/typescript/commonjs/core/server/index.d.ts +10 -0
- package/lib/typescript/commonjs/core/server/node.d.ts +19 -0
- package/lib/typescript/commonjs/core/server/proxy.d.ts +30 -0
- package/lib/typescript/commonjs/core/server/verify.d.ts +61 -0
- package/lib/typescript/commonjs/core/swichpay.d.ts +40 -0
- package/lib/typescript/commonjs/core/utils/crypto.d.ts +19 -0
- package/lib/typescript/commonjs/core/utils/formatters.d.ts +19 -0
- package/lib/typescript/commonjs/core/utils/json.d.ts +27 -0
- package/lib/typescript/commonjs/core/utils/log.d.ts +15 -0
- package/lib/typescript/commonjs/core/utils/runtime.d.ts +12 -0
- package/lib/typescript/commonjs/core/utils/validators.d.ts +23 -0
- package/lib/typescript/commonjs/hooks.d.ts +21 -0
- package/lib/typescript/commonjs/index.d.ts +26 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/polyfills.d.ts +2 -0
- package/lib/typescript/commonjs/presenter.d.ts +25 -0
- package/lib/typescript/commonjs/provider.d.ts +22 -0
- package/lib/typescript/commonjs/swichpay.d.ts +125 -0
- package/lib/typescript/commonjs/theme.d.ts +52 -0
- package/lib/typescript/commonjs/ui.d.ts +583 -0
- package/lib/typescript/commonjs/webviews.d.ts +40 -0
- package/lib/typescript/module/HostedCheckout.d.ts +17 -0
- package/lib/typescript/module/checkout-webview.d.ts +14 -0
- package/lib/typescript/module/checkouts/PaymentSheet.d.ts +14 -0
- package/lib/typescript/module/checkouts/direct.d.ts +18 -0
- package/lib/typescript/module/context.d.ts +20 -0
- package/lib/typescript/module/core/api/direct-payment-api.d.ts +103 -0
- package/lib/typescript/module/core/api/discount-api.d.ts +10 -0
- package/lib/typescript/module/core/api/gateway-api.d.ts +150 -0
- package/lib/typescript/module/core/api/payments-api.d.ts +22 -0
- package/lib/typescript/module/core/api/repositories.d.ts +86 -0
- package/lib/typescript/module/core/assets/images.d.ts +5 -0
- package/lib/typescript/module/core/assets/method-logos.d.ts +12 -0
- package/lib/typescript/module/core/assets/pwa-images.d.ts +7 -0
- package/lib/typescript/module/core/browser/clipboard.d.ts +3 -0
- package/lib/typescript/module/core/browser/dom.d.ts +11 -0
- package/lib/typescript/module/core/browser/hosted-checkout.d.ts +27 -0
- package/lib/typescript/module/core/browser/index.d.ts +11 -0
- package/lib/typescript/module/core/browser/qr.d.ts +18 -0
- package/lib/typescript/module/core/browser/three-ds.d.ts +45 -0
- package/lib/typescript/module/core/client.d.ts +181 -0
- package/lib/typescript/module/core/config.d.ts +86 -0
- package/lib/typescript/module/core/environment.d.ts +22 -0
- package/lib/typescript/module/core/errors.d.ts +78 -0
- package/lib/typescript/module/core/events.d.ts +19 -0
- package/lib/typescript/module/core/flows/controller.d.ts +41 -0
- package/lib/typescript/module/core/flows/countdown.d.ts +15 -0
- package/lib/typescript/module/core/flows/direct-bank-transfer.d.ts +49 -0
- package/lib/typescript/module/core/flows/direct-card.d.ts +94 -0
- package/lib/typescript/module/core/flows/direct-ewallet.d.ts +39 -0
- package/lib/typescript/module/core/flows/direct-one-bill.d.ts +38 -0
- package/lib/typescript/module/core/flows/direct-qr.d.ts +25 -0
- package/lib/typescript/module/core/flows/direct-rtp.d.ts +72 -0
- package/lib/typescript/module/core/flows/discount-lookup.d.ts +37 -0
- package/lib/typescript/module/core/flows/headless.d.ts +38 -0
- package/lib/typescript/module/core/flows/payment-sheet.d.ts +263 -0
- package/lib/typescript/module/core/flows/services.d.ts +22 -0
- package/lib/typescript/module/core/flows/shared.d.ts +40 -0
- package/lib/typescript/module/core/http/api-client.d.ts +37 -0
- package/lib/typescript/module/core/http/endpoints.d.ts +39 -0
- package/lib/typescript/module/core/http/token-manager.d.ts +19 -0
- package/lib/typescript/module/core/http/transport.d.ts +37 -0
- package/lib/typescript/module/core/index.d.ts +42 -0
- package/lib/typescript/module/core/models/category.d.ts +35 -0
- package/lib/typescript/module/core/models/discount.d.ts +41 -0
- package/lib/typescript/module/core/models/payment.d.ts +104 -0
- package/lib/typescript/module/core/models/session.d.ts +87 -0
- package/lib/typescript/module/core/server/index.d.ts +10 -0
- package/lib/typescript/module/core/server/node.d.ts +19 -0
- package/lib/typescript/module/core/server/proxy.d.ts +30 -0
- package/lib/typescript/module/core/server/verify.d.ts +61 -0
- package/lib/typescript/module/core/swichpay.d.ts +40 -0
- package/lib/typescript/module/core/utils/crypto.d.ts +19 -0
- package/lib/typescript/module/core/utils/formatters.d.ts +19 -0
- package/lib/typescript/module/core/utils/json.d.ts +27 -0
- package/lib/typescript/module/core/utils/log.d.ts +15 -0
- package/lib/typescript/module/core/utils/runtime.d.ts +12 -0
- package/lib/typescript/module/core/utils/validators.d.ts +23 -0
- package/lib/typescript/module/hooks.d.ts +21 -0
- package/lib/typescript/module/index.d.ts +26 -0
- package/lib/typescript/module/polyfills.d.ts +2 -0
- package/lib/typescript/module/presenter.d.ts +25 -0
- package/lib/typescript/module/provider.d.ts +22 -0
- package/lib/typescript/module/swichpay.d.ts +125 -0
- package/lib/typescript/module/theme.d.ts +52 -0
- package/lib/typescript/module/ui.d.ts +583 -0
- package/lib/typescript/module/webviews.d.ts +40 -0
- package/package.json +129 -4
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { SwichPayClientDependencies } from './core/client.js';
|
|
2
|
+
import type { CardDetails, PaymentCategory, PaymentDetails, PaymentResult, PaymentSessionInquiryResult, Subscription, SwichPayClient, SwichPayOptions } from './core/index.js';
|
|
3
|
+
import { type AsyncState } from './hooks.js';
|
|
4
|
+
import { type HeadlessCardInput, type WalletName } from './core/index.js';
|
|
5
|
+
/** Payments for your own screen: call a method, no SDK screen. */
|
|
6
|
+
export interface SwichPayDirect {
|
|
7
|
+
/**
|
|
8
|
+
* Card payment from your own form. The SDK runs the device check and 3-D Secure itself; the
|
|
9
|
+
* bank's OTP page opens only when the bank asks for it. Needs `<SwichPayProvider>` mounted and a
|
|
10
|
+
* checksum source (proxy, `getChecksum` or `secretHashKey`), like `presentCardCheckout`.
|
|
11
|
+
*/
|
|
12
|
+
payWithCard(input: HeadlessCardInput): Promise<PaymentResult>;
|
|
13
|
+
/** JazzCash / EasyPaisa from your own form; the customer approves in their wallet app. */
|
|
14
|
+
payWithWallet(input: {
|
|
15
|
+
details: PaymentDetails;
|
|
16
|
+
wallet: WalletName;
|
|
17
|
+
msisdn: string;
|
|
18
|
+
}): Promise<PaymentResult>;
|
|
19
|
+
}
|
|
20
|
+
/** Every checkout the SDK can present (`SwichPay.present*`). */
|
|
21
|
+
export interface SwichPayPresenters {
|
|
22
|
+
/** The built-in payment sheet. Resolves `null` when dismissed or when the session can't start. */
|
|
23
|
+
presentPaymentSheet(details: PaymentDetails, options?: {
|
|
24
|
+
categories?: readonly PaymentCategory[];
|
|
25
|
+
}): Promise<PaymentResult | null>;
|
|
26
|
+
/** SwichPay's hosted checkout page in a full-screen WebView. */
|
|
27
|
+
presentHostedCheckout(details: PaymentDetails, options?: {
|
|
28
|
+
categories?: readonly PaymentCategory[];
|
|
29
|
+
}): Promise<PaymentResult | null>;
|
|
30
|
+
/** Same as `presentHostedCheckout`. */
|
|
31
|
+
presentHostedCheckoutSheet(details: PaymentDetails, options?: {
|
|
32
|
+
categories?: readonly PaymentCategory[];
|
|
33
|
+
}): Promise<PaymentResult | null>;
|
|
34
|
+
presentEwalletCheckout(details: PaymentDetails): Promise<PaymentResult | null>;
|
|
35
|
+
presentBankTransferCheckout(details: PaymentDetails): Promise<PaymentResult | null>;
|
|
36
|
+
/** Needs a checksum source: proxy, `getChecksum` or `secretHashKey`. */
|
|
37
|
+
presentCardCheckout(details: PaymentDetails, options?: {
|
|
38
|
+
allowSaveCard?: boolean;
|
|
39
|
+
}): Promise<PaymentResult | null>;
|
|
40
|
+
presentOneBillCheckout(details: PaymentDetails): Promise<PaymentResult | null>;
|
|
41
|
+
presentQrCheckout(details: PaymentDetails): Promise<PaymentResult | null>;
|
|
42
|
+
presentRtpNowCheckout(details: PaymentDetails): Promise<PaymentResult | null>;
|
|
43
|
+
presentRtpEwalletCheckout(details: PaymentDetails): Promise<PaymentResult | null>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The `SwichPay` facade for React Native:
|
|
47
|
+
*
|
|
48
|
+
* ```ts
|
|
49
|
+
* SwichPay.initialize({ clientId, referrer, merchantId, appId, environment, proxyUrl });
|
|
50
|
+
* const result = await SwichPay.presentPaymentSheet(details);
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* `present*` methods need `<SwichPayProvider>` mounted at the root of the app.
|
|
54
|
+
*/
|
|
55
|
+
export declare const SwichPay: {
|
|
56
|
+
/** Call once, as early as possible. Calling again replaces (and disposes) the previous client. */
|
|
57
|
+
initialize(options: SwichPayOptions, deps?: SwichPayClientDependencies): SwichPayClient;
|
|
58
|
+
client: SwichPayClient;
|
|
59
|
+
isInitialized: boolean;
|
|
60
|
+
/** Submits a card payment directly against your own form. */
|
|
61
|
+
pay(input: {
|
|
62
|
+
details: PaymentDetails;
|
|
63
|
+
card: CardDetails;
|
|
64
|
+
}): Promise<PaymentResult>;
|
|
65
|
+
/** Listens for every payment result. Returns an unsubscribe function (also `.cancel()`). */
|
|
66
|
+
onResult(callback: (result: PaymentResult) => void): Subscription;
|
|
67
|
+
availableCategories(): Promise<PaymentCategory[]>;
|
|
68
|
+
inquirePaymentSession(input: {
|
|
69
|
+
paymentSessionGuid: string;
|
|
70
|
+
}): Promise<PaymentSessionInquiryResult>;
|
|
71
|
+
dispose(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Card payment from your own form. The SDK runs the device check and 3-D Secure itself; the
|
|
74
|
+
* bank's OTP page opens only when the bank asks for it. Needs `<SwichPayProvider>` mounted and a
|
|
75
|
+
* checksum source (proxy, `getChecksum` or `secretHashKey`), like `presentCardCheckout`.
|
|
76
|
+
*/
|
|
77
|
+
payWithCard(input: HeadlessCardInput): Promise<PaymentResult>;
|
|
78
|
+
/** JazzCash / EasyPaisa from your own form; the customer approves in their wallet app. */
|
|
79
|
+
payWithWallet(input: {
|
|
80
|
+
details: PaymentDetails;
|
|
81
|
+
wallet: WalletName;
|
|
82
|
+
msisdn: string;
|
|
83
|
+
}): Promise<PaymentResult>;
|
|
84
|
+
/** The built-in payment sheet. Resolves `null` when dismissed or when the session can't start. */
|
|
85
|
+
presentPaymentSheet(details: PaymentDetails, options?: {
|
|
86
|
+
categories?: readonly PaymentCategory[];
|
|
87
|
+
}): Promise<PaymentResult | null>;
|
|
88
|
+
/** SwichPay's hosted checkout page in a full-screen WebView. */
|
|
89
|
+
presentHostedCheckout(details: PaymentDetails, options?: {
|
|
90
|
+
categories?: readonly PaymentCategory[];
|
|
91
|
+
}): Promise<PaymentResult | null>;
|
|
92
|
+
/** Same as `presentHostedCheckout`. */
|
|
93
|
+
presentHostedCheckoutSheet(details: PaymentDetails, options?: {
|
|
94
|
+
categories?: readonly PaymentCategory[];
|
|
95
|
+
}): Promise<PaymentResult | null>;
|
|
96
|
+
presentEwalletCheckout(details: PaymentDetails): Promise<PaymentResult | null>;
|
|
97
|
+
presentBankTransferCheckout(details: PaymentDetails): Promise<PaymentResult | null>;
|
|
98
|
+
/** Needs a checksum source: proxy, `getChecksum` or `secretHashKey`. */
|
|
99
|
+
presentCardCheckout(details: PaymentDetails, options?: {
|
|
100
|
+
allowSaveCard?: boolean;
|
|
101
|
+
}): Promise<PaymentResult | null>;
|
|
102
|
+
presentOneBillCheckout(details: PaymentDetails): Promise<PaymentResult | null>;
|
|
103
|
+
presentQrCheckout(details: PaymentDetails): Promise<PaymentResult | null>;
|
|
104
|
+
presentRtpNowCheckout(details: PaymentDetails): Promise<PaymentResult | null>;
|
|
105
|
+
presentRtpEwalletCheckout(details: PaymentDetails): Promise<PaymentResult | null>;
|
|
106
|
+
};
|
|
107
|
+
export interface UseSwichPay extends SwichPayPresenters, SwichPayDirect {
|
|
108
|
+
client: SwichPayClient;
|
|
109
|
+
pay(input: {
|
|
110
|
+
details: PaymentDetails;
|
|
111
|
+
card: CardDetails;
|
|
112
|
+
}): Promise<PaymentResult>;
|
|
113
|
+
onResult(callback: (result: PaymentResult) => void): Subscription;
|
|
114
|
+
availableCategories(): Promise<PaymentCategory[]>;
|
|
115
|
+
inquirePaymentSession(input: {
|
|
116
|
+
paymentSessionGuid: string;
|
|
117
|
+
}): Promise<PaymentSessionInquiryResult>;
|
|
118
|
+
}
|
|
119
|
+
/** Everything `SwichPay` offers, bound to the nearest `<SwichPayProvider>`'s client. */
|
|
120
|
+
export declare function useSwichPay(): UseSwichPay;
|
|
121
|
+
/** Subscribes to every payment result and unsubscribes on unmount. */
|
|
122
|
+
export declare function usePaymentResult(callback: (result: PaymentResult) => void): void;
|
|
123
|
+
/** The merchant's enabled payment categories, loaded on mount. */
|
|
124
|
+
export declare function useAvailableCategories(): AsyncState<PaymentCategory[]>;
|
|
125
|
+
//# sourceMappingURL=swichpay.d.ts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** Colours and sizes shared by every SwichPay screen (same palette on every SwichPay SDK). */
|
|
2
|
+
export declare const colors: {
|
|
3
|
+
readonly accentFrom: "#1dcd9f";
|
|
4
|
+
readonly accentTo: "#2563eb";
|
|
5
|
+
readonly blue: "#2563eb";
|
|
6
|
+
readonly text: "#111827";
|
|
7
|
+
readonly muted: "#4b5563";
|
|
8
|
+
readonly faint: "#6b7280";
|
|
9
|
+
readonly border: "#d1d5db";
|
|
10
|
+
readonly fieldBorder: "#6b7280";
|
|
11
|
+
readonly surface: "#ffffff";
|
|
12
|
+
readonly surfaceAlt: "#f3f4f6";
|
|
13
|
+
readonly danger: "#dc2626";
|
|
14
|
+
readonly dangerBg: "#fef2f2";
|
|
15
|
+
readonly dangerBorder: "#fecaca";
|
|
16
|
+
readonly success: "#059669";
|
|
17
|
+
readonly successBg: "#ecfdf5";
|
|
18
|
+
readonly successBorder: "#a7f3d0";
|
|
19
|
+
readonly overlay: "rgba(17, 24, 39, 0.5)";
|
|
20
|
+
readonly dark: "#111827";
|
|
21
|
+
};
|
|
22
|
+
export declare const radius: {
|
|
23
|
+
readonly sm: 6;
|
|
24
|
+
readonly md: 10;
|
|
25
|
+
readonly lg: 16;
|
|
26
|
+
readonly pill: 999;
|
|
27
|
+
};
|
|
28
|
+
export declare const space: {
|
|
29
|
+
readonly xs: 4;
|
|
30
|
+
readonly sm: 8;
|
|
31
|
+
readonly md: 12;
|
|
32
|
+
readonly lg: 16;
|
|
33
|
+
readonly xl: 24;
|
|
34
|
+
};
|
|
35
|
+
export declare const font: {
|
|
36
|
+
readonly sm: 12;
|
|
37
|
+
readonly md: 14;
|
|
38
|
+
readonly lg: 16;
|
|
39
|
+
readonly xl: 20;
|
|
40
|
+
};
|
|
41
|
+
export type SwichPayTheme = {
|
|
42
|
+
colors: typeof colors;
|
|
43
|
+
};
|
|
44
|
+
/** Covers the parent (StyleSheet.absoluteFillObject was removed in React Native 0.81+). */
|
|
45
|
+
export declare const FILL: {
|
|
46
|
+
readonly position: "absolute";
|
|
47
|
+
readonly left: 0;
|
|
48
|
+
readonly right: 0;
|
|
49
|
+
readonly top: 0;
|
|
50
|
+
readonly bottom: 0;
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=theme.d.ts.map
|