@blocklet/payment-react 1.20.4 → 1.20.6
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/.aigne/doc-smith/config.yaml +2 -2
- package/.aigne/doc-smith/upload-cache.yaml +381 -0
- package/docs/components-business-auto-topup.md +128 -179
- package/docs/components-business-overdue-invoice-payment.md +108 -143
- package/docs/components-business-resume-subscription.md +117 -104
- package/docs/components-business.md +12 -36
- package/docs/components-checkout-checkout-donate.md +209 -149
- package/docs/components-checkout-checkout-form.md +115 -136
- package/docs/components-checkout-checkout-table.md +92 -172
- package/docs/components-checkout.md +43 -109
- package/docs/components-history-credit-grants-list.md +45 -70
- package/docs/components-history-credit-transactions-list.md +57 -67
- package/docs/components-history-invoice-list.md +58 -52
- package/docs/components-history-payment-list.md +19 -40
- package/docs/components-history.md +42 -67
- package/docs/components-ui-form-elements-address-form.md +37 -65
- package/docs/components-ui-form-elements-country-select.md +80 -59
- package/docs/components-ui-form-elements-currency-selector.md +57 -73
- package/docs/components-ui-form-elements-phone-input.md +90 -112
- package/docs/components-ui-form-elements.md +46 -80
- package/docs/components-ui-payment-summary.md +71 -119
- package/docs/components-ui-pricing-table.md +117 -204
- package/docs/components-ui.md +59 -32
- package/docs/components.md +89 -62
- package/docs/getting-started.md +36 -63
- package/docs/guides-theming.md +122 -84
- package/docs/guides-utilities.md +107 -145
- package/docs/guides.md +7 -84
- package/docs/hooks-use-mobile.md +50 -36
- package/docs/hooks-use-subscription.md +72 -89
- package/docs/hooks.md +12 -82
- package/docs/overview.md +45 -52
- package/docs/providers-donate-provider.md +73 -95
- package/docs/providers-payment-provider.md +115 -169
- package/docs/providers.md +27 -86
- package/es/locales/en.js +7 -0
- package/es/locales/zh.js +8 -1
- package/es/payment/index.js +3 -0
- package/es/payment/progress-item.d.ts +12 -0
- package/es/payment/progress-item.js +78 -0
- package/es/payment/success.d.ts +4 -1
- package/es/payment/success.js +55 -3
- package/lib/locales/en.js +7 -0
- package/lib/locales/zh.js +8 -1
- package/lib/payment/index.js +3 -0
- package/lib/payment/progress-item.d.ts +12 -0
- package/lib/payment/progress-item.js +107 -0
- package/lib/payment/success.d.ts +4 -1
- package/lib/payment/success.js +59 -3
- package/package.json +7 -7
- package/src/locales/en.tsx +7 -0
- package/src/locales/zh.tsx +8 -1
- package/src/payment/index.tsx +6 -0
- package/src/payment/progress-item.tsx +107 -0
- package/src/payment/success.tsx +88 -3
|
@@ -1,129 +1,112 @@
|
|
|
1
1
|
# useSubscription
|
|
2
2
|
|
|
3
|
-
The `useSubscription` hook provides a
|
|
3
|
+
The `useSubscription` hook provides a simple way to subscribe to real-time events from the payment service using WebSockets. It handles the connection, subscription, and cleanup logic, allowing you to focus on how your application reacts to events like `invoice.paid`.
|
|
4
4
|
|
|
5
|
-
This is essential for creating dynamic user experiences where the UI needs to
|
|
5
|
+
This is essential for creating dynamic user experiences where the UI needs to update instantly in response to backend events without requiring the user to refresh the page.
|
|
6
6
|
|
|
7
7
|
## How It Works
|
|
8
8
|
|
|
9
|
-
The hook abstracts the complexity of managing a WebSocket connection. When
|
|
9
|
+
The hook abstracts the complexity of managing a WebSocket connection. When a component uses `useSubscription`, it establishes a persistent connection to a relay service. It then subscribes to a specific `channel` you provide. The hook automatically namespaces the channel for you, constructing a final channel name in the format `relay:<app-id>:<your-channel>`.
|
|
10
|
+
|
|
11
|
+
When the backend service publishes an event to that channel, the hook's subscription object emits the event, which your component can listen for.
|
|
10
12
|
|
|
11
13
|
```d2
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
14
|
+
direction: down
|
|
15
|
+
|
|
16
|
+
react-component: {
|
|
17
|
+
label: "React Component"
|
|
18
|
+
shape: rectangle
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
use-subscription-hook: {
|
|
22
|
+
label: "useSubscription Hook"
|
|
23
|
+
shape: rectangle
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
websocket-server: {
|
|
27
|
+
label: "WebSocket Server"
|
|
28
|
+
shape: rectangle
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
backend-service: {
|
|
32
|
+
label: "Backend Service"
|
|
33
|
+
shape: rectangle
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
react-component -> use-subscription-hook: "1. Call with channel ID"
|
|
37
|
+
use-subscription-hook -> websocket-server: "2. Connect & Subscribe to namespaced channel"
|
|
38
|
+
backend-service -> websocket-server: "3. Publish event (e.g., 'invoice.paid')"
|
|
39
|
+
websocket-server -> use-subscription-hook: "4. Push event to client"
|
|
40
|
+
use-subscription-hook -> react-component: "5. Emit event to listener"
|
|
41
|
+
react-component -> react-component: "6. Update UI"
|
|
33
42
|
```
|
|
34
43
|
|
|
35
|
-
##
|
|
44
|
+
## Parameters
|
|
36
45
|
|
|
37
|
-
|
|
46
|
+
The hook takes a single string argument.
|
|
38
47
|
|
|
39
|
-
|
|
48
|
+
| Parameter | Type | Description | Required |
|
|
49
|
+
| :-------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------ | :------- |
|
|
50
|
+
| `channel` | `string` | A unique identifier for the event stream you want to listen to. **Important**: This string must not contain separators like `/`, `.`, or `:`. | Yes |
|
|
40
51
|
|
|
41
|
-
|
|
42
|
-
| :-------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
43
|
-
| `channel` | `string` | **Required**. A unique identifier for the subscription channel. It must not contain special characters like `/`, `.`, or `:`. The hook prefixes this with the application ID to create the final channel name (e.g., `relay:appId:channel`). |
|
|
52
|
+
## Return Value
|
|
44
53
|
|
|
45
|
-
|
|
54
|
+
The hook returns a `subscription` object from the underlying `@arcblock/ws` client library. This object may initially be `null` while the connection is being established.
|
|
46
55
|
|
|
47
|
-
|
|
56
|
+
Once the connection is successful, the returned object provides methods to manage event listeners:
|
|
48
57
|
|
|
49
|
-
|
|
58
|
+
- `subscription.on(eventName, handler)`: Attaches an event listener.
|
|
59
|
+
- `subscription.off(eventName, handler)`: Removes an event listener.
|
|
50
60
|
|
|
51
|
-
Here is an example of a component that displays the status of an invoice. It uses `useSubscription` to listen for real-time updates and changes the status from "Pending" to "Paid" when an `invoice.paid` event is received.
|
|
52
61
|
|
|
53
|
-
|
|
54
|
-
import React, { useState, useEffect } from 'react';
|
|
55
|
-
import { PaymentProvider, useSubscription } from '@blocklet/payment-react';
|
|
62
|
+
## Example Usage
|
|
56
63
|
|
|
57
|
-
|
|
58
|
-
// See the PaymentProvider documentation for an example implementation.
|
|
59
|
-
import { useSessionContext } from './session-context';
|
|
64
|
+
Here's an example of a component that tracks the status of an invoice in real-time. When the backend broadcasts an `invoice.paid` event on the invoice's channel, the component's UI updates automatically.
|
|
60
65
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
66
|
+
```tsx Real-time Invoice Status Tracker icon=logos:react
|
|
67
|
+
import { useSubscription } from '@blocklet/payment-react';
|
|
68
|
+
import React, { useState, useEffect } from 'react';
|
|
65
69
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
/**
|
|
71
|
+
* A component that displays an invoice's status and updates it in real-time
|
|
72
|
+
* when a 'invoice.paid' event is received.
|
|
73
|
+
*/
|
|
74
|
+
function InvoiceStatusTracker({ invoiceId }) {
|
|
75
|
+
const [status, setStatus] = useState('pending');
|
|
76
|
+
// Subscribe to a channel dedicated to this invoice
|
|
70
77
|
const subscription = useSubscription(invoiceId);
|
|
71
78
|
|
|
72
79
|
useEffect(() => {
|
|
73
|
-
//
|
|
80
|
+
// The subscription object becomes available after the WebSocket connection is established.
|
|
74
81
|
if (subscription) {
|
|
75
|
-
const
|
|
76
|
-
console.log(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
82
|
+
const handlePaymentSuccess = (eventData) => {
|
|
83
|
+
console.log(`Received 'invoice.paid' event for channel ${invoiceId}:`, eventData);
|
|
84
|
+
// Update the component's state based on the event
|
|
85
|
+
setStatus('paid');
|
|
80
86
|
};
|
|
81
87
|
|
|
82
|
-
//
|
|
83
|
-
|
|
84
|
-
subscription.on('invoice.paid', handleInvoiceUpdate);
|
|
88
|
+
// Attach the listener for the 'invoice.paid' event
|
|
89
|
+
subscription.on('invoice.paid', handlePaymentSuccess);
|
|
85
90
|
|
|
86
|
-
//
|
|
87
|
-
//
|
|
91
|
+
// It's crucial to clean up the event listener when the component unmounts
|
|
92
|
+
// or when the subscription object changes to prevent memory leaks.
|
|
88
93
|
return () => {
|
|
89
|
-
subscription.off('invoice.paid',
|
|
94
|
+
subscription.off('invoice.paid', handlePaymentSuccess);
|
|
90
95
|
};
|
|
91
96
|
}
|
|
92
|
-
|
|
97
|
+
// This effect should re-run if the subscription object itself changes.
|
|
98
|
+
}, [subscription, invoiceId]);
|
|
93
99
|
|
|
94
100
|
return (
|
|
95
101
|
<div>
|
|
96
102
|
<h2>Invoice Status</h2>
|
|
97
|
-
<p>
|
|
103
|
+
<p>ID: {invoiceId}</p>
|
|
98
104
|
<p>Status: <strong>{status.toUpperCase()}</strong></p>
|
|
105
|
+
{status === 'pending' && <p>Waiting for payment confirmation...</p>}
|
|
106
|
+
{status === 'paid' && <p>Payment confirmed! Your invoice is settled.</p>}
|
|
99
107
|
</div>
|
|
100
108
|
);
|
|
101
109
|
}
|
|
102
110
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const { session, connectApi } = useSessionContext();
|
|
106
|
-
|
|
107
|
-
// Render the component only after the session is loaded.
|
|
108
|
-
if (!session) {
|
|
109
|
-
return <div>Loading session...</div>;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return (
|
|
113
|
-
<PaymentProvider session={session} connect={connectApi}>
|
|
114
|
-
<InvoiceStatus invoiceId="invoice_12345" initialStatus="pending" />
|
|
115
|
-
</PaymentProvider>
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export default App;
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
In this example:
|
|
123
|
-
1. The `App` component calls `useSessionContext()` to retrieve the user `session` and `connectApi` client.
|
|
124
|
-
2. It renders the `PaymentProvider`, which provides the necessary context to its children. For details on setting up your session context, please refer to the [PaymentProvider](./providers-payment-provider.md) documentation.
|
|
125
|
-
3. The `InvoiceStatus` component subscribes to a channel named after the `invoiceId`.
|
|
126
|
-
4. An effect is set up to listen for changes to the `subscription` object.
|
|
127
|
-
5. Once the `subscription` object is available, an event handler `handleInvoiceUpdate` is attached to the `invoice.paid` event.
|
|
128
|
-
6. When a matching event is received from the server, the handler updates the component's state, and the UI re-renders to show the "PAID" status.
|
|
129
|
-
7. The `useEffect` cleanup function ensures the event listener is removed to prevent memory leaks.
|
|
111
|
+
export default InvoiceStatusTracker;
|
|
112
|
+
```
|
package/docs/hooks.md
CHANGED
|
@@ -1,84 +1,14 @@
|
|
|
1
1
|
# Hooks
|
|
2
2
|
|
|
3
|
-
The `@blocklet/payment-react` library
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
- To listen for `invoice.paid`, `subscription.updated`, or other critical events without constant polling.
|
|
16
|
-
|
|
17
|
-
**Basic Usage:**
|
|
18
|
-
|
|
19
|
-
```tsx
|
|
20
|
-
import { useSubscription } from '@blocklet/payment-react';
|
|
21
|
-
import { useEffect } from 'react';
|
|
22
|
-
|
|
23
|
-
function RealTimeInvoiceStatus({ invoiceId }) {
|
|
24
|
-
// The channel's value cannot contain separators like /, ., :
|
|
25
|
-
const channel = `invoice_${invoiceId}`;
|
|
26
|
-
const subscription = useSubscription(channel);
|
|
27
|
-
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
if (subscription) {
|
|
30
|
-
subscription.on('invoice.paid', (data) => {
|
|
31
|
-
console.log('Invoice paid!', data);
|
|
32
|
-
// Update UI to show paid status
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}, [subscription]);
|
|
36
|
-
|
|
37
|
-
return <div>Listening for updates on invoice {invoiceId}...</div>;
|
|
38
|
-
}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
➡️ **[Learn more about `useSubscription`](./hooks-use-subscription.md)**
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
## useMobile
|
|
46
|
-
|
|
47
|
-
The `useMobile` hook is a simple utility for detecting the viewport size. It helps determine if the application is being viewed on a mobile device based on Material-UI's breakpoint system, which is useful for creating responsive payment flows.
|
|
48
|
-
|
|
49
|
-
**When to Use:**
|
|
50
|
-
- To conditionally render different layouts for mobile and desktop views.
|
|
51
|
-
- To adjust component props (e.g., `mode='inline'` vs `mode='popup'`) based on screen size.
|
|
52
|
-
|
|
53
|
-
**Basic Usage:**
|
|
54
|
-
|
|
55
|
-
```tsx
|
|
56
|
-
import { PaymentProvider, CheckoutForm, useMobile } from '@blocklet/payment-react';
|
|
57
|
-
// Import your own session context hook
|
|
58
|
-
import { useSessionContext } from '../hooks/session';
|
|
59
|
-
|
|
60
|
-
function ResponsiveCheckout() {
|
|
61
|
-
const { session, connectApi } = useSessionContext();
|
|
62
|
-
const { isMobile } = useMobile();
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<PaymentProvider session={session} connect={connectApi}>
|
|
66
|
-
<CheckoutForm
|
|
67
|
-
id="plink_xxx"
|
|
68
|
-
// Use a different mode on mobile devices
|
|
69
|
-
mode={isMobile ? 'popup' : 'inline'}
|
|
70
|
-
/>
|
|
71
|
-
</PaymentProvider>
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
➡️ **[Learn more about `useMobile`](./hooks-use-mobile.md)**
|
|
77
|
-
|
|
78
|
-
---
|
|
79
|
-
|
|
80
|
-
## Next Steps
|
|
81
|
-
|
|
82
|
-
Now that you have an overview of the available hooks, you can explore the rich set of UI and business logic components to build your payment flows.
|
|
83
|
-
|
|
84
|
-
➡️ **[Explore Components](./components.md)**
|
|
3
|
+
The `@blocklet/payment-react` library provides a set of custom React hooks to encapsulate and simplify common logic, such as handling real-time events or adapting to different screen sizes. These hooks allow you to easily integrate advanced functionalities into your components with minimal boilerplate code.
|
|
4
|
+
|
|
5
|
+
Explore the available hooks to enhance your application's interactivity and responsiveness.
|
|
6
|
+
|
|
7
|
+
<x-cards>
|
|
8
|
+
<x-card data-title="useSubscription" data-icon="lucide:webhook" data-href="/hooks/use-subscription">
|
|
9
|
+
Subscribe to real-time events from the payment service, such as 'invoice.paid', to create dynamic and responsive user experiences.
|
|
10
|
+
</x-card>
|
|
11
|
+
<x-card data-title="useMobile" data-icon="lucide:smartphone" data-href="/hooks/use-mobile">
|
|
12
|
+
A utility hook for detecting if the application is being viewed on a mobile device, helping you build responsive and mobile-friendly UIs.
|
|
13
|
+
</x-card>
|
|
14
|
+
</x-cards>
|
package/docs/overview.md
CHANGED
|
@@ -1,87 +1,80 @@
|
|
|
1
1
|
# Overview
|
|
2
2
|
|
|
3
|
-
`@blocklet/payment-react` is a React component library designed
|
|
4
|
-
|
|
5
|
-
Whether you need a simple checkout form, a complete pricing table, or a view of a customer's invoice history, `@blocklet/payment-react` offers the tools to build it efficiently.
|
|
3
|
+
`@blocklet/payment-react` is a comprehensive React component library designed to streamline the integration of payment flows, subscriptions, and donation systems into your blocklets. Built on top of [Payment Kit](https://www.arcblock.io/docs/arcblock-payment-kit), it provides a suite of pre-built, customizable, and production-ready components to help you build powerful payment experiences with minimal effort.
|
|
6
4
|
|
|
7
5
|
## Key Features
|
|
8
6
|
|
|
9
7
|
<x-cards data-columns="3">
|
|
10
8
|
<x-card data-title="Pre-built UI Components" data-icon="lucide:layout-template">
|
|
11
|
-
Includes a rich set of components like checkout forms, pricing tables, and donation widgets to cover common
|
|
9
|
+
Includes a rich set of components like checkout forms, pricing tables, and donation widgets to cover common payment scenarios out of the box.
|
|
12
10
|
</x-card>
|
|
13
11
|
<x-card data-title="Customizable Themes" data-icon="lucide:palette">
|
|
14
|
-
Gain full control over the look and feel using Material-UI themes, ensuring
|
|
12
|
+
Gain full control over the look and feel of your payment flows using Material-UI themes, ensuring a consistent user experience.
|
|
15
13
|
</x-card>
|
|
16
14
|
<x-card data-title="i18n Support" data-icon="lucide:languages">
|
|
17
|
-
Built-in
|
|
15
|
+
Built-in internationalization support allows you to easily localize component text for a global audience.
|
|
18
16
|
</x-card>
|
|
19
|
-
<x-card data-title="
|
|
20
|
-
|
|
17
|
+
<x-card data-title="Comprehensive Payment Operations" data-icon="lucide:credit-card">
|
|
18
|
+
Easily handle complex payment logic, including subscriptions, refunds, invoice management, and metered billing.
|
|
21
19
|
</x-card>
|
|
22
|
-
<x-card data-title="
|
|
23
|
-
|
|
20
|
+
<x-card data-title="Optimized Performance" data-icon="lucide:package-minus">
|
|
21
|
+
Optimize your application's bundle size and improve performance with built-in support for lazy loading and dynamic component imports.
|
|
24
22
|
</x-card>
|
|
25
23
|
</x-cards>
|
|
26
24
|
|
|
27
25
|
## How It Works
|
|
28
26
|
|
|
29
|
-
The library is
|
|
30
|
-
|
|
31
|
-
This architecture decouples your UI components from the direct handling of API requests, making your code cleaner and easier to maintain.
|
|
27
|
+
The library is architected around a provider-component model. The `PaymentProvider` is the core of the library, creating a context that manages authentication, API communication, and state. All other payment components must be wrapped within this provider to function correctly. This centralizes the payment logic and makes individual components lightweight and focused.
|
|
32
28
|
|
|
33
|
-
```d2
|
|
29
|
+
```d2 High-Level Architecture
|
|
34
30
|
direction: down
|
|
35
31
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
shape: package
|
|
39
|
-
"CheckoutForm"
|
|
40
|
-
"CheckoutDonate"
|
|
41
|
-
"CustomerInvoiceList"
|
|
42
|
-
}
|
|
32
|
+
User: {
|
|
33
|
+
shape: c4-person
|
|
43
34
|
}
|
|
44
35
|
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
}
|
|
36
|
+
Your-Application: {
|
|
37
|
+
label: "Your Application"
|
|
38
|
+
shape: rectangle
|
|
50
39
|
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
PaymentProvider: {
|
|
41
|
+
label: "PaymentProvider"
|
|
42
|
+
shape: rectangle
|
|
53
43
|
|
|
54
|
-
|
|
44
|
+
Payment-Components: {
|
|
45
|
+
label: "Payment Components"
|
|
46
|
+
shape: rectangle
|
|
47
|
+
grid-columns: 2
|
|
55
48
|
|
|
56
|
-
|
|
57
|
-
|
|
49
|
+
CheckoutForm: { label: "CheckoutForm" }
|
|
50
|
+
CheckoutTable: { label: "CheckoutTable" }
|
|
51
|
+
CheckoutDonate: { label: "CheckoutDonate" }
|
|
52
|
+
CustomerInvoiceList: { label: "CustomerInvoiceList" }
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
58
56
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
Payment-Kit-Backend: {
|
|
58
|
+
label: "Payment Kit Backend"
|
|
59
|
+
shape: cylinder
|
|
60
|
+
}
|
|
62
61
|
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
User -> Your-Application.PaymentProvider.Payment-Components: "Interacts with UI"
|
|
63
|
+
Your-Application.PaymentProvider -> Payment-Kit-Backend: "Handles API Communication"
|
|
64
|
+
Payment-Kit-Backend -> Your-Application.PaymentProvider: "Returns Data"
|
|
65
|
+
Your-Application.PaymentProvider.Payment-Components -> User: "Renders UI Updates"
|
|
65
66
|
|
|
66
|
-
return (
|
|
67
|
-
<PaymentProvider session={session} connect={connectApi}>
|
|
68
|
-
<CheckoutForm
|
|
69
|
-
id="plink_xxx" // Payment Link ID
|
|
70
|
-
mode="inline" // Embed directly in your UI
|
|
71
|
-
showCheckoutSummary={true}
|
|
72
|
-
onChange={(state) => console.log('Checkout State:', state)}
|
|
73
|
-
/>
|
|
74
|
-
</PaymentProvider>
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
67
|
```
|
|
78
68
|
|
|
79
|
-
|
|
69
|
+
## What You Can Build
|
|
70
|
+
|
|
71
|
+
- **Subscription Services:** Quickly implement pricing pages and checkout flows for SaaS products using `CheckoutTable`.
|
|
72
|
+
- **E-commerce Checkouts:** Build one-time payment forms for selling goods with `CheckoutForm`.
|
|
73
|
+
- **Donation Systems:** Add flexible donation widgets to support creators or causes with `CheckoutDonate`.
|
|
74
|
+
- **Customer Portals:** Display invoice history and manage payment methods for users with `CustomerInvoiceList` and other history components.
|
|
80
75
|
|
|
81
76
|
## Next Steps
|
|
82
77
|
|
|
83
|
-
|
|
78
|
+
Now that you have an overview of what `@blocklet/payment-react` offers, the best way to learn is by building something.
|
|
84
79
|
|
|
85
|
-
|
|
86
|
-
Install the library and build your first functional payment form.
|
|
87
|
-
</x-card>
|
|
80
|
+
Dive into our [Getting Started](./getting-started.md) guide to install the library and create your first payment form in minutes.
|