@waffo/pancake-ts 0.3.4 → 0.4.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 +15 -0
- package/README.md +8 -4
- package/dist/index.cjs +20 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -54
- package/dist/index.d.ts +47 -54
- package/dist/index.js +20 -15
- package/dist/index.js.map +1 -1
- package/docs/api-reference.md +19 -16
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -211,7 +211,12 @@ declare enum ErrorLayer {
|
|
|
211
211
|
* @see waffo-pancake-user-service/app/lib/utils/jwt.ts IssueSessionTokenRequest
|
|
212
212
|
*/
|
|
213
213
|
interface IssueSessionTokenParams {
|
|
214
|
-
/**
|
|
214
|
+
/**
|
|
215
|
+
* Buyer identity — encoded into the JWT payload for merchant-side buyer
|
|
216
|
+
* identification. Accepts an email or any merchant-provided identifier string.
|
|
217
|
+
* To pre-fill the checkout page's email field, use `buyerEmail` on
|
|
218
|
+
* `checkout.authenticated.create`.
|
|
219
|
+
*/
|
|
215
220
|
buyerIdentity: string;
|
|
216
221
|
/** Store ID (optional when `productId` is provided) */
|
|
217
222
|
storeId?: string;
|
|
@@ -752,8 +757,11 @@ interface RefundTicket {
|
|
|
752
757
|
/**
|
|
753
758
|
* Parameters for anonymous checkout.
|
|
754
759
|
*
|
|
755
|
-
* The buyer
|
|
756
|
-
*
|
|
760
|
+
* The buyer reaches the checkout page without a session token. Merchants may still
|
|
761
|
+
* pre-fill `buyerEmail` and `billingDetail`; omitting them leaves the form blank.
|
|
762
|
+
*
|
|
763
|
+
* Accepts every field of {@link CreateCheckoutSessionParams} — this wrapper simply
|
|
764
|
+
* forwards the params unchanged to `/v1/actions/checkout/create-session`.
|
|
757
765
|
*
|
|
758
766
|
* @example
|
|
759
767
|
* const result = await client.checkout.anonymous.create({
|
|
@@ -762,61 +770,32 @@ interface RefundTicket {
|
|
|
762
770
|
* });
|
|
763
771
|
* // Redirect to result.checkoutUrl
|
|
764
772
|
*/
|
|
765
|
-
|
|
766
|
-
/** Product ID */
|
|
767
|
-
productId: string;
|
|
768
|
-
/** Currency code (ISO 4217) */
|
|
769
|
-
currency: string;
|
|
770
|
-
/** Optional price snapshot override (reads from DB if omitted) */
|
|
771
|
-
priceSnapshot?: PriceInfo;
|
|
772
|
-
/** Trial toggle override (subscription only) */
|
|
773
|
-
withTrial?: boolean;
|
|
774
|
-
/** Redirect URL after successful payment */
|
|
775
|
-
successUrl?: string;
|
|
776
|
-
/** Session expiration in seconds (default: 45 minutes) */
|
|
777
|
-
expiresInSeconds?: number;
|
|
778
|
-
/** Dark mode override (true=dark, false=light, omit=use store default) */
|
|
779
|
-
darkMode?: boolean;
|
|
780
|
-
/** Custom metadata */
|
|
781
|
-
metadata?: Record<string, string>;
|
|
782
|
-
}
|
|
773
|
+
type AnonymousCheckoutParams = CreateCheckoutSessionParams;
|
|
783
774
|
/**
|
|
784
775
|
* Parameters for authenticated checkout.
|
|
785
776
|
*
|
|
786
|
-
*
|
|
787
|
-
*
|
|
777
|
+
* Merges the checkout-session fields ({@link CreateCheckoutSessionParams}) with the
|
|
778
|
+
* extra `buyerIdentity` required by `issue-session-token`. The wrapper splits the
|
|
779
|
+
* input: `buyerIdentity` goes to the token call; everything else (including
|
|
780
|
+
* `buyerEmail`) goes to the create-session call. The two fields are independent.
|
|
788
781
|
*
|
|
789
782
|
* @example
|
|
790
783
|
* const result = await client.checkout.authenticated.create({
|
|
791
784
|
* productId: "PROD_xxx",
|
|
792
785
|
* currency: "USD",
|
|
793
|
-
* buyerIdentity: "
|
|
786
|
+
* buyerIdentity: "user-123", // merchant-side buyer id (goes into JWT)
|
|
787
|
+
* buyerEmail: "customer@example.com", // pre-filled on the checkout page
|
|
794
788
|
* });
|
|
795
789
|
* // Redirect to result.checkoutUrl (includes #token=...)
|
|
796
790
|
*/
|
|
797
|
-
interface AuthenticatedCheckoutParams {
|
|
798
|
-
/**
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
791
|
+
interface AuthenticatedCheckoutParams extends CreateCheckoutSessionParams {
|
|
792
|
+
/**
|
|
793
|
+
* Buyer identity — sent to `issue-session-token` and encoded into the JWT
|
|
794
|
+
* payload for merchant-side buyer identification. Accepts an email or any
|
|
795
|
+
* merchant-provided identifier string. Use `buyerEmail` to pre-fill the
|
|
796
|
+
* checkout page's email input.
|
|
797
|
+
*/
|
|
803
798
|
buyerIdentity: string;
|
|
804
|
-
/** Pre-filled buyer email (defaults to `buyerIdentity` when omitted) */
|
|
805
|
-
buyerEmail?: string;
|
|
806
|
-
/** Pre-filled billing details */
|
|
807
|
-
billingDetail?: BillingDetail;
|
|
808
|
-
/** Optional price snapshot override (reads from DB if omitted) */
|
|
809
|
-
priceSnapshot?: PriceInfo;
|
|
810
|
-
/** Trial toggle override (subscription only) */
|
|
811
|
-
withTrial?: boolean;
|
|
812
|
-
/** Redirect URL after successful payment */
|
|
813
|
-
successUrl?: string;
|
|
814
|
-
/** Session expiration in seconds (default: 45 minutes) */
|
|
815
|
-
expiresInSeconds?: number;
|
|
816
|
-
/** Dark mode override (true=dark, false=light, omit=use store default) */
|
|
817
|
-
darkMode?: boolean;
|
|
818
|
-
/** Custom metadata */
|
|
819
|
-
metadata?: Record<string, string>;
|
|
820
799
|
}
|
|
821
800
|
/**
|
|
822
801
|
* Result of an authenticated checkout creation.
|
|
@@ -1163,7 +1142,8 @@ declare class BuyerGraphQL {
|
|
|
1163
1142
|
/**
|
|
1164
1143
|
* Anonymous checkout — no buyer identity provided.
|
|
1165
1144
|
*
|
|
1166
|
-
* The buyer
|
|
1145
|
+
* The buyer reaches the checkout page without a session token. Merchants may still
|
|
1146
|
+
* pre-fill `buyerEmail` and `billingDetail` on the page by passing them here.
|
|
1167
1147
|
* Internally creates a checkout session and returns the redirect URL.
|
|
1168
1148
|
*/
|
|
1169
1149
|
declare class CheckoutAnonymousResource {
|
|
@@ -1176,11 +1156,20 @@ declare class CheckoutAnonymousResource {
|
|
|
1176
1156
|
* @returns Session ID, checkout URL, and expiration
|
|
1177
1157
|
*
|
|
1178
1158
|
* @example
|
|
1159
|
+
* // Minimal — buyer fills everything on the page
|
|
1179
1160
|
* const result = await client.checkout.anonymous.create({
|
|
1180
1161
|
* productId: "PROD_xxx",
|
|
1181
1162
|
* currency: "USD",
|
|
1182
1163
|
* });
|
|
1183
|
-
*
|
|
1164
|
+
*
|
|
1165
|
+
* @example
|
|
1166
|
+
* // Pre-fill email and billing without issuing a session token
|
|
1167
|
+
* const result = await client.checkout.anonymous.create({
|
|
1168
|
+
* productId: "PROD_xxx",
|
|
1169
|
+
* currency: "USD",
|
|
1170
|
+
* buyerEmail: "customer@example.com",
|
|
1171
|
+
* billingDetail: { country: "US", isBusiness: false, postcode: "10001" },
|
|
1172
|
+
* });
|
|
1184
1173
|
*/
|
|
1185
1174
|
create(params: AnonymousCheckoutParams): Promise<CheckoutSessionResult>;
|
|
1186
1175
|
}
|
|
@@ -1199,10 +1188,12 @@ declare class CheckoutAuthenticatedResource {
|
|
|
1199
1188
|
* Create an authenticated checkout session.
|
|
1200
1189
|
*
|
|
1201
1190
|
* Behavior:
|
|
1202
|
-
* - Issues a session token via `issue-session-token`
|
|
1203
|
-
* - Creates a checkout session via `create-session`
|
|
1204
|
-
* - Appends the token to the checkout URL as a URL fragment
|
|
1205
|
-
*
|
|
1191
|
+
* - Issues a session token via `issue-session-token` (receives `buyerIdentity` + `productId` only)
|
|
1192
|
+
* - Creates a checkout session via `create-session` (receives every other field unchanged)
|
|
1193
|
+
* - Appends the token to the checkout URL as a URL fragment (`#token=...`)
|
|
1194
|
+
*
|
|
1195
|
+
* `buyerIdentity` and `buyerEmail` are independent inputs: identity is for the JWT,
|
|
1196
|
+
* email is for pre-filling the checkout page. The SDK forwards each to its own endpoint.
|
|
1206
1197
|
*
|
|
1207
1198
|
* @param params - Checkout parameters including buyer identity
|
|
1208
1199
|
* @returns Session details with token-appended checkout URL
|
|
@@ -1211,7 +1202,8 @@ declare class CheckoutAuthenticatedResource {
|
|
|
1211
1202
|
* const result = await client.checkout.authenticated.create({
|
|
1212
1203
|
* productId: "PROD_xxx",
|
|
1213
1204
|
* currency: "USD",
|
|
1214
|
-
* buyerIdentity: "
|
|
1205
|
+
* buyerIdentity: "user-123",
|
|
1206
|
+
* buyerEmail: "customer@example.com",
|
|
1215
1207
|
* });
|
|
1216
1208
|
* // Redirect to result.checkoutUrl (includes #token=...)
|
|
1217
1209
|
*/
|
|
@@ -1239,7 +1231,8 @@ declare class CheckoutAuthenticatedResource {
|
|
|
1239
1231
|
* const result = await client.checkout.authenticated.create({
|
|
1240
1232
|
* productId: "PROD_xxx",
|
|
1241
1233
|
* currency: "USD",
|
|
1242
|
-
* buyerIdentity: "
|
|
1234
|
+
* buyerIdentity: "userIdInYourSystem",
|
|
1235
|
+
* buyerEmail: "customer@example.com",
|
|
1243
1236
|
* });
|
|
1244
1237
|
* // result.checkoutUrl includes #token=...
|
|
1245
1238
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -211,7 +211,12 @@ declare enum ErrorLayer {
|
|
|
211
211
|
* @see waffo-pancake-user-service/app/lib/utils/jwt.ts IssueSessionTokenRequest
|
|
212
212
|
*/
|
|
213
213
|
interface IssueSessionTokenParams {
|
|
214
|
-
/**
|
|
214
|
+
/**
|
|
215
|
+
* Buyer identity — encoded into the JWT payload for merchant-side buyer
|
|
216
|
+
* identification. Accepts an email or any merchant-provided identifier string.
|
|
217
|
+
* To pre-fill the checkout page's email field, use `buyerEmail` on
|
|
218
|
+
* `checkout.authenticated.create`.
|
|
219
|
+
*/
|
|
215
220
|
buyerIdentity: string;
|
|
216
221
|
/** Store ID (optional when `productId` is provided) */
|
|
217
222
|
storeId?: string;
|
|
@@ -752,8 +757,11 @@ interface RefundTicket {
|
|
|
752
757
|
/**
|
|
753
758
|
* Parameters for anonymous checkout.
|
|
754
759
|
*
|
|
755
|
-
* The buyer
|
|
756
|
-
*
|
|
760
|
+
* The buyer reaches the checkout page without a session token. Merchants may still
|
|
761
|
+
* pre-fill `buyerEmail` and `billingDetail`; omitting them leaves the form blank.
|
|
762
|
+
*
|
|
763
|
+
* Accepts every field of {@link CreateCheckoutSessionParams} — this wrapper simply
|
|
764
|
+
* forwards the params unchanged to `/v1/actions/checkout/create-session`.
|
|
757
765
|
*
|
|
758
766
|
* @example
|
|
759
767
|
* const result = await client.checkout.anonymous.create({
|
|
@@ -762,61 +770,32 @@ interface RefundTicket {
|
|
|
762
770
|
* });
|
|
763
771
|
* // Redirect to result.checkoutUrl
|
|
764
772
|
*/
|
|
765
|
-
|
|
766
|
-
/** Product ID */
|
|
767
|
-
productId: string;
|
|
768
|
-
/** Currency code (ISO 4217) */
|
|
769
|
-
currency: string;
|
|
770
|
-
/** Optional price snapshot override (reads from DB if omitted) */
|
|
771
|
-
priceSnapshot?: PriceInfo;
|
|
772
|
-
/** Trial toggle override (subscription only) */
|
|
773
|
-
withTrial?: boolean;
|
|
774
|
-
/** Redirect URL after successful payment */
|
|
775
|
-
successUrl?: string;
|
|
776
|
-
/** Session expiration in seconds (default: 45 minutes) */
|
|
777
|
-
expiresInSeconds?: number;
|
|
778
|
-
/** Dark mode override (true=dark, false=light, omit=use store default) */
|
|
779
|
-
darkMode?: boolean;
|
|
780
|
-
/** Custom metadata */
|
|
781
|
-
metadata?: Record<string, string>;
|
|
782
|
-
}
|
|
773
|
+
type AnonymousCheckoutParams = CreateCheckoutSessionParams;
|
|
783
774
|
/**
|
|
784
775
|
* Parameters for authenticated checkout.
|
|
785
776
|
*
|
|
786
|
-
*
|
|
787
|
-
*
|
|
777
|
+
* Merges the checkout-session fields ({@link CreateCheckoutSessionParams}) with the
|
|
778
|
+
* extra `buyerIdentity` required by `issue-session-token`. The wrapper splits the
|
|
779
|
+
* input: `buyerIdentity` goes to the token call; everything else (including
|
|
780
|
+
* `buyerEmail`) goes to the create-session call. The two fields are independent.
|
|
788
781
|
*
|
|
789
782
|
* @example
|
|
790
783
|
* const result = await client.checkout.authenticated.create({
|
|
791
784
|
* productId: "PROD_xxx",
|
|
792
785
|
* currency: "USD",
|
|
793
|
-
* buyerIdentity: "
|
|
786
|
+
* buyerIdentity: "user-123", // merchant-side buyer id (goes into JWT)
|
|
787
|
+
* buyerEmail: "customer@example.com", // pre-filled on the checkout page
|
|
794
788
|
* });
|
|
795
789
|
* // Redirect to result.checkoutUrl (includes #token=...)
|
|
796
790
|
*/
|
|
797
|
-
interface AuthenticatedCheckoutParams {
|
|
798
|
-
/**
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
791
|
+
interface AuthenticatedCheckoutParams extends CreateCheckoutSessionParams {
|
|
792
|
+
/**
|
|
793
|
+
* Buyer identity — sent to `issue-session-token` and encoded into the JWT
|
|
794
|
+
* payload for merchant-side buyer identification. Accepts an email or any
|
|
795
|
+
* merchant-provided identifier string. Use `buyerEmail` to pre-fill the
|
|
796
|
+
* checkout page's email input.
|
|
797
|
+
*/
|
|
803
798
|
buyerIdentity: string;
|
|
804
|
-
/** Pre-filled buyer email (defaults to `buyerIdentity` when omitted) */
|
|
805
|
-
buyerEmail?: string;
|
|
806
|
-
/** Pre-filled billing details */
|
|
807
|
-
billingDetail?: BillingDetail;
|
|
808
|
-
/** Optional price snapshot override (reads from DB if omitted) */
|
|
809
|
-
priceSnapshot?: PriceInfo;
|
|
810
|
-
/** Trial toggle override (subscription only) */
|
|
811
|
-
withTrial?: boolean;
|
|
812
|
-
/** Redirect URL after successful payment */
|
|
813
|
-
successUrl?: string;
|
|
814
|
-
/** Session expiration in seconds (default: 45 minutes) */
|
|
815
|
-
expiresInSeconds?: number;
|
|
816
|
-
/** Dark mode override (true=dark, false=light, omit=use store default) */
|
|
817
|
-
darkMode?: boolean;
|
|
818
|
-
/** Custom metadata */
|
|
819
|
-
metadata?: Record<string, string>;
|
|
820
799
|
}
|
|
821
800
|
/**
|
|
822
801
|
* Result of an authenticated checkout creation.
|
|
@@ -1163,7 +1142,8 @@ declare class BuyerGraphQL {
|
|
|
1163
1142
|
/**
|
|
1164
1143
|
* Anonymous checkout — no buyer identity provided.
|
|
1165
1144
|
*
|
|
1166
|
-
* The buyer
|
|
1145
|
+
* The buyer reaches the checkout page without a session token. Merchants may still
|
|
1146
|
+
* pre-fill `buyerEmail` and `billingDetail` on the page by passing them here.
|
|
1167
1147
|
* Internally creates a checkout session and returns the redirect URL.
|
|
1168
1148
|
*/
|
|
1169
1149
|
declare class CheckoutAnonymousResource {
|
|
@@ -1176,11 +1156,20 @@ declare class CheckoutAnonymousResource {
|
|
|
1176
1156
|
* @returns Session ID, checkout URL, and expiration
|
|
1177
1157
|
*
|
|
1178
1158
|
* @example
|
|
1159
|
+
* // Minimal — buyer fills everything on the page
|
|
1179
1160
|
* const result = await client.checkout.anonymous.create({
|
|
1180
1161
|
* productId: "PROD_xxx",
|
|
1181
1162
|
* currency: "USD",
|
|
1182
1163
|
* });
|
|
1183
|
-
*
|
|
1164
|
+
*
|
|
1165
|
+
* @example
|
|
1166
|
+
* // Pre-fill email and billing without issuing a session token
|
|
1167
|
+
* const result = await client.checkout.anonymous.create({
|
|
1168
|
+
* productId: "PROD_xxx",
|
|
1169
|
+
* currency: "USD",
|
|
1170
|
+
* buyerEmail: "customer@example.com",
|
|
1171
|
+
* billingDetail: { country: "US", isBusiness: false, postcode: "10001" },
|
|
1172
|
+
* });
|
|
1184
1173
|
*/
|
|
1185
1174
|
create(params: AnonymousCheckoutParams): Promise<CheckoutSessionResult>;
|
|
1186
1175
|
}
|
|
@@ -1199,10 +1188,12 @@ declare class CheckoutAuthenticatedResource {
|
|
|
1199
1188
|
* Create an authenticated checkout session.
|
|
1200
1189
|
*
|
|
1201
1190
|
* Behavior:
|
|
1202
|
-
* - Issues a session token via `issue-session-token`
|
|
1203
|
-
* - Creates a checkout session via `create-session`
|
|
1204
|
-
* - Appends the token to the checkout URL as a URL fragment
|
|
1205
|
-
*
|
|
1191
|
+
* - Issues a session token via `issue-session-token` (receives `buyerIdentity` + `productId` only)
|
|
1192
|
+
* - Creates a checkout session via `create-session` (receives every other field unchanged)
|
|
1193
|
+
* - Appends the token to the checkout URL as a URL fragment (`#token=...`)
|
|
1194
|
+
*
|
|
1195
|
+
* `buyerIdentity` and `buyerEmail` are independent inputs: identity is for the JWT,
|
|
1196
|
+
* email is for pre-filling the checkout page. The SDK forwards each to its own endpoint.
|
|
1206
1197
|
*
|
|
1207
1198
|
* @param params - Checkout parameters including buyer identity
|
|
1208
1199
|
* @returns Session details with token-appended checkout URL
|
|
@@ -1211,7 +1202,8 @@ declare class CheckoutAuthenticatedResource {
|
|
|
1211
1202
|
* const result = await client.checkout.authenticated.create({
|
|
1212
1203
|
* productId: "PROD_xxx",
|
|
1213
1204
|
* currency: "USD",
|
|
1214
|
-
* buyerIdentity: "
|
|
1205
|
+
* buyerIdentity: "user-123",
|
|
1206
|
+
* buyerEmail: "customer@example.com",
|
|
1215
1207
|
* });
|
|
1216
1208
|
* // Redirect to result.checkoutUrl (includes #token=...)
|
|
1217
1209
|
*/
|
|
@@ -1239,7 +1231,8 @@ declare class CheckoutAuthenticatedResource {
|
|
|
1239
1231
|
* const result = await client.checkout.authenticated.create({
|
|
1240
1232
|
* productId: "PROD_xxx",
|
|
1241
1233
|
* currency: "USD",
|
|
1242
|
-
* buyerIdentity: "
|
|
1234
|
+
* buyerIdentity: "userIdInYourSystem",
|
|
1235
|
+
* buyerEmail: "customer@example.com",
|
|
1243
1236
|
* });
|
|
1244
1237
|
* // result.checkoutUrl includes #token=...
|
|
1245
1238
|
*/
|
package/dist/index.js
CHANGED
|
@@ -464,11 +464,20 @@ var CheckoutAnonymousResource = class {
|
|
|
464
464
|
* @returns Session ID, checkout URL, and expiration
|
|
465
465
|
*
|
|
466
466
|
* @example
|
|
467
|
+
* // Minimal — buyer fills everything on the page
|
|
467
468
|
* const result = await client.checkout.anonymous.create({
|
|
468
469
|
* productId: "PROD_xxx",
|
|
469
470
|
* currency: "USD",
|
|
470
471
|
* });
|
|
471
|
-
*
|
|
472
|
+
*
|
|
473
|
+
* @example
|
|
474
|
+
* // Pre-fill email and billing without issuing a session token
|
|
475
|
+
* const result = await client.checkout.anonymous.create({
|
|
476
|
+
* productId: "PROD_xxx",
|
|
477
|
+
* currency: "USD",
|
|
478
|
+
* buyerEmail: "customer@example.com",
|
|
479
|
+
* billingDetail: { country: "US", isBusiness: false, postcode: "10001" },
|
|
480
|
+
* });
|
|
472
481
|
*/
|
|
473
482
|
async create(params) {
|
|
474
483
|
validateCheckoutCommon(params);
|
|
@@ -485,10 +494,12 @@ var CheckoutAuthenticatedResource = class {
|
|
|
485
494
|
* Create an authenticated checkout session.
|
|
486
495
|
*
|
|
487
496
|
* Behavior:
|
|
488
|
-
* - Issues a session token via `issue-session-token`
|
|
489
|
-
* - Creates a checkout session via `create-session`
|
|
490
|
-
* - Appends the token to the checkout URL as a URL fragment
|
|
491
|
-
*
|
|
497
|
+
* - Issues a session token via `issue-session-token` (receives `buyerIdentity` + `productId` only)
|
|
498
|
+
* - Creates a checkout session via `create-session` (receives every other field unchanged)
|
|
499
|
+
* - Appends the token to the checkout URL as a URL fragment (`#token=...`)
|
|
500
|
+
*
|
|
501
|
+
* `buyerIdentity` and `buyerEmail` are independent inputs: identity is for the JWT,
|
|
502
|
+
* email is for pre-filling the checkout page. The SDK forwards each to its own endpoint.
|
|
492
503
|
*
|
|
493
504
|
* @param params - Checkout parameters including buyer identity
|
|
494
505
|
* @returns Session details with token-appended checkout URL
|
|
@@ -497,14 +508,15 @@ var CheckoutAuthenticatedResource = class {
|
|
|
497
508
|
* const result = await client.checkout.authenticated.create({
|
|
498
509
|
* productId: "PROD_xxx",
|
|
499
510
|
* currency: "USD",
|
|
500
|
-
* buyerIdentity: "
|
|
511
|
+
* buyerIdentity: "user-123",
|
|
512
|
+
* buyerEmail: "customer@example.com",
|
|
501
513
|
* });
|
|
502
514
|
* // Redirect to result.checkoutUrl (includes #token=...)
|
|
503
515
|
*/
|
|
504
516
|
async create(params) {
|
|
505
517
|
validateCheckoutCommon(params);
|
|
506
518
|
validateRequired("buyerIdentity", params.buyerIdentity);
|
|
507
|
-
const { buyerIdentity,
|
|
519
|
+
const { buyerIdentity, ...sessionParams } = params;
|
|
508
520
|
const [tokenResult, sessionResult] = await Promise.all([
|
|
509
521
|
this.http.post(
|
|
510
522
|
"/v1/actions/auth/issue-session-token",
|
|
@@ -514,14 +526,7 @@ var CheckoutAuthenticatedResource = class {
|
|
|
514
526
|
},
|
|
515
527
|
{ idempotencyWindow: 60 }
|
|
516
528
|
),
|
|
517
|
-
this.http.post(
|
|
518
|
-
"/v1/actions/checkout/create-session",
|
|
519
|
-
{
|
|
520
|
-
...sessionFields,
|
|
521
|
-
buyerEmail: buyerEmail ?? buyerIdentity
|
|
522
|
-
},
|
|
523
|
-
{ idempotencyWindow: 60 }
|
|
524
|
-
)
|
|
529
|
+
this.http.post("/v1/actions/checkout/create-session", sessionParams, { idempotencyWindow: 60 })
|
|
525
530
|
]);
|
|
526
531
|
return {
|
|
527
532
|
sessionId: sessionResult.sessionId,
|