@moneydevkit/nextjs 0.7.0-beta.8 → 0.7.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/README.md +16 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -165,7 +165,7 @@ function ProductPage() {
|
|
|
165
165
|
const handleBuyProduct = async (productId) => {
|
|
166
166
|
const result = await createCheckout({
|
|
167
167
|
type: 'PRODUCTS',
|
|
168
|
-
|
|
168
|
+
product: productId,
|
|
169
169
|
successUrl: '/checkout/success',
|
|
170
170
|
})
|
|
171
171
|
|
|
@@ -187,7 +187,21 @@ function ProductPage() {
|
|
|
187
187
|
|
|
188
188
|
### Checkout Types
|
|
189
189
|
- **`type: 'AMOUNT'`** - For donations, tips, or custom amounts. Requires `amount` field.
|
|
190
|
-
- **`type: 'PRODUCTS'`** - For selling products. Requires `
|
|
190
|
+
- **`type: 'PRODUCTS'`** - For selling products. Requires `product` field with a product ID. Amount is calculated from product price.
|
|
191
|
+
|
|
192
|
+
### Pay What You Want (CUSTOM prices)
|
|
193
|
+
Products can have CUSTOM prices that let customers choose their own amount. When a checkout includes a product with a CUSTOM price, the checkout UI automatically shows an amount input field:
|
|
194
|
+
|
|
195
|
+
```jsx
|
|
196
|
+
// Create a checkout for a product with CUSTOM pricing
|
|
197
|
+
const result = await createCheckout({
|
|
198
|
+
type: 'PRODUCTS',
|
|
199
|
+
product: customPriceProductId, // Product configured with CUSTOM price in dashboard
|
|
200
|
+
successUrl: '/checkout/success',
|
|
201
|
+
})
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
The customer enters their desired amount during checkout. For USD, amounts are in dollars (converted to cents internally). For SAT, amounts are in satoshis.
|
|
191
205
|
|
|
192
206
|
## Verify successful payments
|
|
193
207
|
When a checkout completes, use `useCheckoutSuccess()` on the success page
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneydevkit/nextjs",
|
|
3
|
-
"version": "0.7.0
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"title": "@moneydevkit/nextjs",
|
|
5
5
|
"description": "moneydevkit checkout components for Next.js.",
|
|
6
6
|
"repository": {
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@hookform/resolvers": "^5.0.1",
|
|
58
|
-
"@moneydevkit/api-contract": "^0.1.
|
|
59
|
-
"@moneydevkit/core": "0.7.0
|
|
58
|
+
"@moneydevkit/api-contract": "^0.1.17",
|
|
59
|
+
"@moneydevkit/core": "0.7.0",
|
|
60
60
|
"@moneydevkit/lightning-js": "^0.1.60",
|
|
61
61
|
"@orpc/client": "1.3.0",
|
|
62
62
|
"@orpc/contract": "1.3.0",
|