@skalpgg/sdk 1.15.0 → 2.1.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 CHANGED
@@ -10,6 +10,14 @@ 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
+ ## 2.1.0
14
+
15
+ `paymentProvider` can also be `'GIFT_CARD'`, for an order a Skalp gift card paid in full. `Order` and the order webhooks carry `giftCardAmount`: the part paid with gift cards, in the order currency and the same units as `amount`, `0` without one.
16
+
17
+ ## Upgrading to 2.0
18
+
19
+ 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.
20
+
13
21
  ## Quickstart
14
22
 
15
23
  ```sh
@@ -240,7 +248,7 @@ const charge = await skalp.subscriptions.createUsageCharge(subscription.id, {
240
248
  if (charge.status === 'open') await emailPaymentLink(charge.hostedUrl)
241
249
  ```
242
250
 
243
- The same `idempotencyKey` always returns the same charge, so retry with it after a timeout or a 5xx.
251
+ 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
252
 
245
253
  ## Headless baskets
246
254
 
@@ -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 = "1.15.0";
3
+ export declare const VERSION = "2.1.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 = '1.15.0';
4
+ exports.VERSION = '2.1.0';
5
5
  const SIGNATURE_HEADER = 'skalp-signature';
6
6
  const SIGNATURE_TOLERANCE_SECONDS = 300;
7
7
  const PRODUCT_PAGE = 100;
@@ -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 = 'STRIPE' | 'NOWPAYMENTS' | 'PAYPAL' | 'PAYSSION';
8
+ export type PaymentProvider = 'CARD' | 'CRYPTO' | 'PAYPAL' | 'PAYSAFECARD' | 'GIFT_CARD' | '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>;
@@ -67,6 +67,7 @@ export interface Order {
67
67
  vatRate: number | null;
68
68
  currency: Currency;
69
69
  discountAmount: number;
70
+ giftCardAmount: number;
70
71
  serviceFee: number | null;
71
72
  sellerPaymentFee: number | null;
72
73
  couponCode: string | null;
@@ -1348,7 +1349,7 @@ export type SkalpEvent = Envelope<'order.created' | 'order.updated' | 'order.can
1348
1349
  nextPaymentAttempt?: string | null;
1349
1350
  }> | Envelope<'subscription.canceled', SubscriptionEventData & {
1350
1351
  endedAt: string | null;
1351
- cancelReason: 'requested' | 'payment_failure' | 'dispute' | 'stripe' | 'expired';
1352
+ cancelReason: 'requested' | 'payment_failure' | 'dispute' | 'payment_provider' | 'stripe' | 'expired';
1352
1353
  revokeCommand?: string;
1353
1354
  }> | Envelope<'subscription.refunded', SubscriptionEventData & {
1354
1355
  invoiceId: string;
@@ -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 = "1.15.0";
3
+ export declare const VERSION = "2.1.0";
4
4
  export interface SkalpOptions {
5
5
  apiKey?: string;
6
6
  storeToken?: string;
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const VERSION = '1.15.0';
1
+ export const VERSION = '2.1.0';
2
2
  const SIGNATURE_HEADER = 'skalp-signature';
3
3
  const SIGNATURE_TOLERANCE_SECONDS = 300;
4
4
  const PRODUCT_PAGE = 100;
@@ -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 = 'STRIPE' | 'NOWPAYMENTS' | 'PAYPAL' | 'PAYSSION';
8
+ export type PaymentProvider = 'CARD' | 'CRYPTO' | 'PAYPAL' | 'PAYSAFECARD' | 'GIFT_CARD' | '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>;
@@ -67,6 +67,7 @@ export interface Order {
67
67
  vatRate: number | null;
68
68
  currency: Currency;
69
69
  discountAmount: number;
70
+ giftCardAmount: number;
70
71
  serviceFee: number | null;
71
72
  sellerPaymentFee: number | null;
72
73
  couponCode: string | null;
@@ -1348,7 +1349,7 @@ export type SkalpEvent = Envelope<'order.created' | 'order.updated' | 'order.can
1348
1349
  nextPaymentAttempt?: string | null;
1349
1350
  }> | Envelope<'subscription.canceled', SubscriptionEventData & {
1350
1351
  endedAt: string | null;
1351
- cancelReason: 'requested' | 'payment_failure' | 'dispute' | 'stripe' | 'expired';
1352
+ cancelReason: 'requested' | 'payment_failure' | 'dispute' | 'payment_provider' | 'stripe' | 'expired';
1352
1353
  revokeCommand?: string;
1353
1354
  }> | Envelope<'subscription.refunded', SubscriptionEventData & {
1354
1355
  invoiceId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skalpgg/sdk",
3
- "version": "1.15.0",
3
+ "version": "2.1.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",