@skalpgg/sdk 1.14.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 +6 -2
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/types.d.ts +3 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/types.d.ts +3 -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
|
|
@@ -137,7 +141,7 @@ const { added, skipped, stock } = await skalp.products.addSerials(product.id, {
|
|
|
137
141
|
await skalp.products.submit(product.id)
|
|
138
142
|
```
|
|
139
143
|
|
|
140
|
-
A product starts as a `DRAFT`. `submit` sends it to review, and the review sets `ACTIVE` or `REJECTED`; read the product to see which. `update` accepts only `DRAFT` and `ARCHIVED` as a `status`, and `archive` takes a product off sale without deleting anything. Pass `null` to `update` to clear `comparePrice`, `storeCategoryId`, `dynamicUrl`, `licenseDurationDays` or `trialPrice`. `trialPrice` is what the buyer pays for the trial of a recurring product in a digital store, in the store currency
|
|
144
|
+
A product starts as a `DRAFT`. `submit` sends it to review, and the review sets `ACTIVE` or `REJECTED`; read the product to see which. `update` accepts only `DRAFT` and `ARCHIVED` as a `status`, and `archive` takes a product off sale without deleting anything. Pass `null` to `update` to clear `comparePrice`, `storeCategoryId`, `dynamicUrl`, `licenseDurationDays` or `trialPrice`. `trialPrice` is what the buyer pays for the trial of a recurring product in a digital store, in the store currency, and `null` makes the trial free. Every price is net and VAT goes on top, unless the store sets prices with VAT: then `pricesIncludeVat` is `true` on the product and every buyer pays the price as it is.
|
|
141
145
|
|
|
142
146
|
`price` is in your store currency, and buyers in Poland, the euro area, the US and Brazil pay it converted at the day's rate. To charge a round local price instead, pass `prices: [{ currency: 'PLN', price: 79 }]`: up to three currencies other than the store one, from 5 to 999999 each, not on coin packs. The list replaces the old one, and `[]` removes them.
|
|
143
147
|
|
|
@@ -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>;
|
|
@@ -223,6 +223,7 @@ export interface Product {
|
|
|
223
223
|
price: number;
|
|
224
224
|
comparePrice: number | null;
|
|
225
225
|
currency: Currency;
|
|
226
|
+
pricesIncludeVat: boolean;
|
|
226
227
|
/** Round prices the seller set in other currencies. A buyer whose local currency is listed pays it exactly. */
|
|
227
228
|
prices: Array<ProductPrice>;
|
|
228
229
|
status: ProductStatus;
|
|
@@ -1347,7 +1348,7 @@ export type SkalpEvent = Envelope<'order.created' | 'order.updated' | 'order.can
|
|
|
1347
1348
|
nextPaymentAttempt?: string | null;
|
|
1348
1349
|
}> | Envelope<'subscription.canceled', SubscriptionEventData & {
|
|
1349
1350
|
endedAt: string | null;
|
|
1350
|
-
cancelReason: 'requested' | 'payment_failure' | 'dispute' | 'stripe' | 'expired';
|
|
1351
|
+
cancelReason: 'requested' | 'payment_failure' | 'dispute' | 'payment_provider' | 'stripe' | 'expired';
|
|
1351
1352
|
revokeCommand?: string;
|
|
1352
1353
|
}> | Envelope<'subscription.refunded', SubscriptionEventData & {
|
|
1353
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>;
|
|
@@ -223,6 +223,7 @@ export interface Product {
|
|
|
223
223
|
price: number;
|
|
224
224
|
comparePrice: number | null;
|
|
225
225
|
currency: Currency;
|
|
226
|
+
pricesIncludeVat: boolean;
|
|
226
227
|
/** Round prices the seller set in other currencies. A buyer whose local currency is listed pays it exactly. */
|
|
227
228
|
prices: Array<ProductPrice>;
|
|
228
229
|
status: ProductStatus;
|
|
@@ -1347,7 +1348,7 @@ export type SkalpEvent = Envelope<'order.created' | 'order.updated' | 'order.can
|
|
|
1347
1348
|
nextPaymentAttempt?: string | null;
|
|
1348
1349
|
}> | Envelope<'subscription.canceled', SubscriptionEventData & {
|
|
1349
1350
|
endedAt: string | null;
|
|
1350
|
-
cancelReason: 'requested' | 'payment_failure' | 'dispute' | 'stripe' | 'expired';
|
|
1351
|
+
cancelReason: 'requested' | 'payment_failure' | 'dispute' | 'payment_provider' | 'stripe' | 'expired';
|
|
1351
1352
|
revokeCommand?: string;
|
|
1352
1353
|
}> | Envelope<'subscription.refunded', SubscriptionEventData & {
|
|
1353
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",
|