@solvapay/next 1.0.0-preview.20 → 1.0.0-preview.21
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 +10 -10
- package/dist/index.d.cts +13 -1
- package/dist/index.d.ts +13 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -70,13 +70,13 @@ import { NextRequest, NextResponse } from 'next/server'
|
|
|
70
70
|
import { createPaymentIntent } from '@solvapay/next'
|
|
71
71
|
|
|
72
72
|
export async function POST(request: NextRequest) {
|
|
73
|
-
const { planRef,
|
|
73
|
+
const { planRef, productRef } = await request.json()
|
|
74
74
|
|
|
75
|
-
if (!planRef || !
|
|
75
|
+
if (!planRef || !productRef) {
|
|
76
76
|
return NextResponse.json({ error: 'Missing required parameters' }, { status: 400 })
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
const result = await createPaymentIntent(request, { planRef,
|
|
79
|
+
const result = await createPaymentIntent(request, { planRef, productRef })
|
|
80
80
|
return result instanceof NextResponse ? result : NextResponse.json(result)
|
|
81
81
|
}
|
|
82
82
|
```
|
|
@@ -90,13 +90,13 @@ import { NextRequest, NextResponse } from 'next/server'
|
|
|
90
90
|
import { processPayment } from '@solvapay/next'
|
|
91
91
|
|
|
92
92
|
export async function POST(request: NextRequest) {
|
|
93
|
-
const { paymentIntentId,
|
|
93
|
+
const { paymentIntentId, productRef, planRef } = await request.json()
|
|
94
94
|
|
|
95
|
-
if (!paymentIntentId || !
|
|
95
|
+
if (!paymentIntentId || !productRef) {
|
|
96
96
|
return NextResponse.json({ error: 'Missing required parameters' }, { status: 400 })
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
const result = await processPayment(request, { paymentIntentId,
|
|
99
|
+
const result = await processPayment(request, { paymentIntentId, productRef, planRef })
|
|
100
100
|
return result instanceof NextResponse ? result : NextResponse.json(result)
|
|
101
101
|
}
|
|
102
102
|
```
|
|
@@ -144,13 +144,13 @@ import { NextRequest, NextResponse } from 'next/server'
|
|
|
144
144
|
import { createCheckoutSession } from '@solvapay/next'
|
|
145
145
|
|
|
146
146
|
export async function POST(request: NextRequest) {
|
|
147
|
-
const {
|
|
147
|
+
const { productRef, planRef } = await request.json()
|
|
148
148
|
|
|
149
|
-
if (!
|
|
150
|
-
return NextResponse.json({ error: 'Missing
|
|
149
|
+
if (!productRef) {
|
|
150
|
+
return NextResponse.json({ error: 'Missing productRef' }, { status: 400 })
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
const result = await createCheckoutSession(request, {
|
|
153
|
+
const result = await createCheckoutSession(request, { productRef, planRef })
|
|
154
154
|
return result instanceof NextResponse ? result : NextResponse.json(result)
|
|
155
155
|
}
|
|
156
156
|
```
|
package/dist/index.d.cts
CHANGED
|
@@ -38,10 +38,22 @@ interface PurchaseCheckResult {
|
|
|
38
38
|
name?: string;
|
|
39
39
|
purchases: Array<{
|
|
40
40
|
reference: string;
|
|
41
|
-
|
|
41
|
+
productName?: string;
|
|
42
42
|
productReference?: string;
|
|
43
43
|
status?: string;
|
|
44
44
|
startDate?: string;
|
|
45
|
+
planSnapshot?: {
|
|
46
|
+
meterId?: string;
|
|
47
|
+
limit?: number;
|
|
48
|
+
freeUnits?: number;
|
|
49
|
+
};
|
|
50
|
+
usage?: {
|
|
51
|
+
used?: number;
|
|
52
|
+
overageUnits?: number;
|
|
53
|
+
overageCost?: number;
|
|
54
|
+
periodStart?: string;
|
|
55
|
+
periodEnd?: string;
|
|
56
|
+
};
|
|
45
57
|
[key: string]: unknown;
|
|
46
58
|
}>;
|
|
47
59
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -38,10 +38,22 @@ interface PurchaseCheckResult {
|
|
|
38
38
|
name?: string;
|
|
39
39
|
purchases: Array<{
|
|
40
40
|
reference: string;
|
|
41
|
-
|
|
41
|
+
productName?: string;
|
|
42
42
|
productReference?: string;
|
|
43
43
|
status?: string;
|
|
44
44
|
startDate?: string;
|
|
45
|
+
planSnapshot?: {
|
|
46
|
+
meterId?: string;
|
|
47
|
+
limit?: number;
|
|
48
|
+
freeUnits?: number;
|
|
49
|
+
};
|
|
50
|
+
usage?: {
|
|
51
|
+
used?: number;
|
|
52
|
+
overageUnits?: number;
|
|
53
|
+
overageCost?: number;
|
|
54
|
+
periodStart?: string;
|
|
55
|
+
periodEnd?: string;
|
|
56
|
+
};
|
|
45
57
|
[key: string]: unknown;
|
|
46
58
|
}>;
|
|
47
59
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solvapay/next",
|
|
3
|
-
"version": "1.0.0-preview.
|
|
3
|
+
"version": "1.0.0-preview.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
},
|
|
30
30
|
"sideEffects": false,
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@solvapay/auth": "1.0.0-preview.
|
|
33
|
-
"@solvapay/
|
|
34
|
-
"@solvapay/
|
|
32
|
+
"@solvapay/auth": "1.0.0-preview.21",
|
|
33
|
+
"@solvapay/server": "1.0.0-preview.21",
|
|
34
|
+
"@solvapay/core": "1.0.0-preview.21"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"next": ">=13.0.0"
|