@skalpgg/sdk 1.15.0 → 2.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/README.md +5 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/types.d.ts +2 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/types.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,10 @@ npm install @skalpgg/sdk
|
|
|
10
10
|
|
|
11
11
|
Runs on Node 20+, Bun, Deno, Vercel Edge and Cloudflare Workers. No dependencies; ships ESM, CommonJS and types.
|
|
12
12
|
|
|
13
|
+
## Upgrading to 2.0
|
|
14
|
+
|
|
15
|
+
2.0.0 changes payment values in responses and webhooks. `paymentProvider` is now `'CARD' | 'CRYPTO' | 'PAYPAL' | 'PAYSAFECARD'`. A failed payment step throws `SkalpError` with `code` `PAYMENT_PROVIDER_ERROR` or `PAYMENT_PROVIDER_UNAVAILABLE`, and `subscription.canceled` can carry `cancelReason: 'payment_provider'`. `invoiceId` and `disputeId` are opaque ids, the same in responses and webhooks. The types still accept the old values, so code that compares them keeps compiling, but it should check the new ones. The method signatures are unchanged.
|
|
16
|
+
|
|
13
17
|
## Quickstart
|
|
14
18
|
|
|
15
19
|
```sh
|
|
@@ -240,7 +244,7 @@ const charge = await skalp.subscriptions.createUsageCharge(subscription.id, {
|
|
|
240
244
|
if (charge.status === 'open') await emailPaymentLink(charge.hostedUrl)
|
|
241
245
|
```
|
|
242
246
|
|
|
243
|
-
The same `idempotencyKey` always returns the same charge, so retry with it after a timeout or a 5xx.
|
|
247
|
+
The same `idempotencyKey` always returns the same charge, so retry with it after a timeout or a 5xx. A `502 PAYMENT_PROVIDER_ERROR` or `503 PAYMENT_PROVIDER_UNAVAILABLE` keeps the charge, so the same retry is safe.
|
|
244
248
|
|
|
245
249
|
## Headless baskets
|
|
246
250
|
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AccessRule, AddAccessRuleParams, AddSerialsParams, AddSerialsResult, AppealFeedbackParams, ChangeSubscriptionPlanParams, CheckoutSession, CheckoutSessionStatus, CoinCheckout, CoinCheckoutStatus, Coupon, CreateCheckoutParams, CreateCoinCheckoutParams, CreateCouponParams, CreateCustomerParams, CreateMeterParams, CreditBalances, CreditGrantResult, CreditTransactionList, CustomerRef, GrantCreditsParams, ListCreditTransactionsParams, Meter, UsageError, UsageEvent, UsageResult, UsageSummary, UsageSummaryParams, CreateProductGroupParams, CreateProductParams, CreateStoreCategoryParams, CreateSubscriptionCheckoutParams, CreateUsageChargeParams, CreateWebhookParams, CreatedWebhookEndpoint, Customer, CustomerDetails, CustomerLevel, LevelProductRule, LevelProducts, CustomerList, Deleted, Feedback, FeedbackList, HeartbeatParams, Invoice, LicenseKeyInfo, LicenseValidation, LicenseVerification, ListAccessRulesParams, ListCustomersParams, ListFeedbackParams, ListOrdersParams, ListProductsParams, ListQueriesParams, ListSerialsParams, ListSubscriptionsParams, Me, Order, OrderKeysReplaced, OrderList, Product, ProductGroup, ProductStock, ReplaceOrderKeysParams, ReplyParams, SerialList, SkalpEvent, StoreLevels, StoreCategory, StoreCategoryWithCount, Subscription, SubscriptionCheckout, SubscriptionCheckoutStatus, SubscriptionList, SupportQueryDetails, SupportQueryList, ResetLicenseDevicesParams, UpdateCouponParams, UpdateCustomerParams, UpdateSubscriptionParams, UpdateProductGroupParams, UpdateProductParams, UpdateStoreCategoryParams, UsageCharge, ValidateLicenseParams, VerifyLicenseParams, WebhookEndpoint, HeadlessBasket, HeadlessCheckout, HeadlessCheckoutParams } from './types.js';
|
|
2
2
|
export type * from './types.js';
|
|
3
|
-
export declare const VERSION = "
|
|
3
|
+
export declare const VERSION = "2.0.0";
|
|
4
4
|
export interface SkalpOptions {
|
|
5
5
|
apiKey?: string;
|
|
6
6
|
storeToken?: string;
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Skalp = exports.SkalpSignatureError = exports.SkalpConnectionError = exports.SkalpError = exports.VERSION = void 0;
|
|
4
|
-
exports.VERSION = '
|
|
4
|
+
exports.VERSION = '2.0.0';
|
|
5
5
|
const SIGNATURE_HEADER = 'skalp-signature';
|
|
6
6
|
const SIGNATURE_TOLERANCE_SECONDS = 300;
|
|
7
7
|
const PRODUCT_PAGE = 100;
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type ProductType = 'ONE_TIME' | 'RECURRING' | 'COINS';
|
|
|
5
5
|
export type Game = 'fivem' | 'minecraft' | 'rust';
|
|
6
6
|
export type BillingInterval = 'WEEK' | 'MONTH' | 'QUARTER' | 'HALF_YEAR' | 'YEAR';
|
|
7
7
|
export type OrderStatus = 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED' | 'REFUNDED' | 'DISPUTED' | 'CANCELED';
|
|
8
|
-
export type PaymentProvider = '
|
|
8
|
+
export type PaymentProvider = 'CARD' | 'CRYPTO' | 'PAYPAL' | 'PAYSAFECARD' | 'STRIPE' | 'NOWPAYMENTS' | 'PAYSSION';
|
|
9
9
|
export type DeliveryStatus = 'PENDING' | 'PROCESSING' | 'DELIVERED' | 'FAILED';
|
|
10
10
|
export type SubscriptionStatus = 'ACTIVE' | 'CANCELED' | 'PAST_DUE' | 'UNPAID' | 'INCOMPLETE' | 'INCOMPLETE_EXPIRED' | 'TRIALING' | 'PAUSED';
|
|
11
11
|
export type Metadata = Record<string, string>;
|
|
@@ -1348,7 +1348,7 @@ export type SkalpEvent = Envelope<'order.created' | 'order.updated' | 'order.can
|
|
|
1348
1348
|
nextPaymentAttempt?: string | null;
|
|
1349
1349
|
}> | Envelope<'subscription.canceled', SubscriptionEventData & {
|
|
1350
1350
|
endedAt: string | null;
|
|
1351
|
-
cancelReason: 'requested' | 'payment_failure' | 'dispute' | 'stripe' | 'expired';
|
|
1351
|
+
cancelReason: 'requested' | 'payment_failure' | 'dispute' | 'payment_provider' | 'stripe' | 'expired';
|
|
1352
1352
|
revokeCommand?: string;
|
|
1353
1353
|
}> | Envelope<'subscription.refunded', SubscriptionEventData & {
|
|
1354
1354
|
invoiceId: string;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AccessRule, AddAccessRuleParams, AddSerialsParams, AddSerialsResult, AppealFeedbackParams, ChangeSubscriptionPlanParams, CheckoutSession, CheckoutSessionStatus, CoinCheckout, CoinCheckoutStatus, Coupon, CreateCheckoutParams, CreateCoinCheckoutParams, CreateCouponParams, CreateCustomerParams, CreateMeterParams, CreditBalances, CreditGrantResult, CreditTransactionList, CustomerRef, GrantCreditsParams, ListCreditTransactionsParams, Meter, UsageError, UsageEvent, UsageResult, UsageSummary, UsageSummaryParams, CreateProductGroupParams, CreateProductParams, CreateStoreCategoryParams, CreateSubscriptionCheckoutParams, CreateUsageChargeParams, CreateWebhookParams, CreatedWebhookEndpoint, Customer, CustomerDetails, CustomerLevel, LevelProductRule, LevelProducts, CustomerList, Deleted, Feedback, FeedbackList, HeartbeatParams, Invoice, LicenseKeyInfo, LicenseValidation, LicenseVerification, ListAccessRulesParams, ListCustomersParams, ListFeedbackParams, ListOrdersParams, ListProductsParams, ListQueriesParams, ListSerialsParams, ListSubscriptionsParams, Me, Order, OrderKeysReplaced, OrderList, Product, ProductGroup, ProductStock, ReplaceOrderKeysParams, ReplyParams, SerialList, SkalpEvent, StoreLevels, StoreCategory, StoreCategoryWithCount, Subscription, SubscriptionCheckout, SubscriptionCheckoutStatus, SubscriptionList, SupportQueryDetails, SupportQueryList, ResetLicenseDevicesParams, UpdateCouponParams, UpdateCustomerParams, UpdateSubscriptionParams, UpdateProductGroupParams, UpdateProductParams, UpdateStoreCategoryParams, UsageCharge, ValidateLicenseParams, VerifyLicenseParams, WebhookEndpoint, HeadlessBasket, HeadlessCheckout, HeadlessCheckoutParams } from './types.js';
|
|
2
2
|
export type * from './types.js';
|
|
3
|
-
export declare const VERSION = "
|
|
3
|
+
export declare const VERSION = "2.0.0";
|
|
4
4
|
export interface SkalpOptions {
|
|
5
5
|
apiKey?: string;
|
|
6
6
|
storeToken?: string;
|
package/dist/esm/index.js
CHANGED
package/dist/esm/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type ProductType = 'ONE_TIME' | 'RECURRING' | 'COINS';
|
|
|
5
5
|
export type Game = 'fivem' | 'minecraft' | 'rust';
|
|
6
6
|
export type BillingInterval = 'WEEK' | 'MONTH' | 'QUARTER' | 'HALF_YEAR' | 'YEAR';
|
|
7
7
|
export type OrderStatus = 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED' | 'REFUNDED' | 'DISPUTED' | 'CANCELED';
|
|
8
|
-
export type PaymentProvider = '
|
|
8
|
+
export type PaymentProvider = 'CARD' | 'CRYPTO' | 'PAYPAL' | 'PAYSAFECARD' | 'STRIPE' | 'NOWPAYMENTS' | 'PAYSSION';
|
|
9
9
|
export type DeliveryStatus = 'PENDING' | 'PROCESSING' | 'DELIVERED' | 'FAILED';
|
|
10
10
|
export type SubscriptionStatus = 'ACTIVE' | 'CANCELED' | 'PAST_DUE' | 'UNPAID' | 'INCOMPLETE' | 'INCOMPLETE_EXPIRED' | 'TRIALING' | 'PAUSED';
|
|
11
11
|
export type Metadata = Record<string, string>;
|
|
@@ -1348,7 +1348,7 @@ export type SkalpEvent = Envelope<'order.created' | 'order.updated' | 'order.can
|
|
|
1348
1348
|
nextPaymentAttempt?: string | null;
|
|
1349
1349
|
}> | Envelope<'subscription.canceled', SubscriptionEventData & {
|
|
1350
1350
|
endedAt: string | null;
|
|
1351
|
-
cancelReason: 'requested' | 'payment_failure' | 'dispute' | 'stripe' | 'expired';
|
|
1351
|
+
cancelReason: 'requested' | 'payment_failure' | 'dispute' | 'payment_provider' | 'stripe' | 'expired';
|
|
1352
1352
|
revokeCommand?: string;
|
|
1353
1353
|
}> | Envelope<'subscription.refunded', SubscriptionEventData & {
|
|
1354
1354
|
invoiceId: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skalpgg/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Official Skalp SDK for Node.js and edge runtimes: checkout, subscriptions, catalog and key stock, webhooks and license verification.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://skalp.gg/docs/sdk",
|