@delopay/sdk 0.31.0 → 0.33.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/dist/{chunk-5C42YTV2.js → chunk-33ZLHH3I.js} +61 -31
- package/dist/chunk-33ZLHH3I.js.map +1 -0
- package/dist/index.cjs +60 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +329 -43
- package/dist/index.d.ts +329 -43
- package/dist/index.js +1 -1
- package/dist/internal.cjs +60 -30
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-5C42YTV2.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1607,6 +1607,11 @@ interface ProfileCreateRequest {
|
|
|
1607
1607
|
* clickjacking defense.
|
|
1608
1608
|
*/
|
|
1609
1609
|
iframe_allowed_origins?: string[] | null;
|
|
1610
|
+
/**
|
|
1611
|
+
* Merchant connector account ID of the billing processor (e.g. Stripe
|
|
1612
|
+
* Billing / PayPal) that owns this profile's native subscriptions.
|
|
1613
|
+
*/
|
|
1614
|
+
billing_processor_id?: string | null;
|
|
1610
1615
|
}
|
|
1611
1616
|
interface ProfileUpdateRequest {
|
|
1612
1617
|
profile_name?: string | null;
|
|
@@ -1622,6 +1627,11 @@ interface ProfileUpdateRequest {
|
|
|
1622
1627
|
* iframe. See {@link ProfileCreateRequest.iframe_allowed_origins}.
|
|
1623
1628
|
*/
|
|
1624
1629
|
iframe_allowed_origins?: string[] | null;
|
|
1630
|
+
/**
|
|
1631
|
+
* Merchant connector account ID of the billing processor (e.g. Stripe
|
|
1632
|
+
* Billing / PayPal) that owns this profile's native subscriptions.
|
|
1633
|
+
*/
|
|
1634
|
+
billing_processor_id?: string | null;
|
|
1625
1635
|
}
|
|
1626
1636
|
interface ProfileResponse {
|
|
1627
1637
|
merchant_id: string;
|
|
@@ -1645,6 +1655,11 @@ interface ProfileResponse {
|
|
|
1645
1655
|
* iframe. See {@link ProfileCreateRequest.iframe_allowed_origins}.
|
|
1646
1656
|
*/
|
|
1647
1657
|
iframe_allowed_origins?: string[] | null;
|
|
1658
|
+
/**
|
|
1659
|
+
* Merchant connector account ID of the billing processor (e.g. Stripe
|
|
1660
|
+
* Billing / PayPal) that owns this profile's native subscriptions.
|
|
1661
|
+
*/
|
|
1662
|
+
billing_processor_id?: string | null;
|
|
1648
1663
|
[key: string]: unknown;
|
|
1649
1664
|
}
|
|
1650
1665
|
type BlocklistAddRequest = {
|
|
@@ -1835,40 +1850,295 @@ interface ThreeDsRuleExecuteRequest {
|
|
|
1835
1850
|
interface ThreeDsRuleResponse {
|
|
1836
1851
|
decision: ThreeDSDecision;
|
|
1837
1852
|
}
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1853
|
+
/** Lifecycle status of a subscription. */
|
|
1854
|
+
type SubscriptionStatus = 'active' | 'created' | 'in_active' | 'pending' | 'trial' | 'paused' | 'unpaid' | 'onetime' | 'cancelled' | 'failed';
|
|
1855
|
+
/** Status of an invoice raised for one subscription billing cycle. */
|
|
1856
|
+
type InvoiceStatus = 'invoice_created' | 'payment_pending' | 'payment_pending_timeout' | 'payment_succeeded' | 'payment_failed' | 'payment_canceled' | 'invoice_paid' | 'manual_review' | 'voided';
|
|
1857
|
+
/** Billing interval unit for a subscription item price. */
|
|
1858
|
+
type SubscriptionPeriodUnit = 'Day' | 'Week' | 'Month' | 'Year';
|
|
1859
|
+
/** How the customer's saved payment method may be used for future payments. */
|
|
1860
|
+
type FutureUsage = 'off_session' | 'on_session';
|
|
1861
|
+
/** Item-type filter for `GET /subscriptions/items`. */
|
|
1862
|
+
type SubscriptionItemType = 'plan' | 'addon';
|
|
1863
|
+
/**
|
|
1864
|
+
* Payment leg attached to a subscription invoice. Present once a charge has
|
|
1865
|
+
* been attempted for the current billing cycle.
|
|
1866
|
+
*/
|
|
1867
|
+
interface SubscriptionPaymentData {
|
|
1868
|
+
payment_id: string;
|
|
1869
|
+
status: IntentStatus;
|
|
1841
1870
|
amount: number;
|
|
1842
1871
|
currency: Currency;
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1872
|
+
profile_id?: string | null;
|
|
1873
|
+
connector?: string | null;
|
|
1874
|
+
payment_method_id?: string | null;
|
|
1875
|
+
return_url?: string | null;
|
|
1876
|
+
/** Next action to drive on the client (redirect, render QR, etc.). */
|
|
1877
|
+
next_action?: Record<string, unknown> | null;
|
|
1878
|
+
payment_experience?: string | null;
|
|
1879
|
+
error_code?: string | null;
|
|
1880
|
+
error_message?: string | null;
|
|
1881
|
+
payment_method_type?: PaymentMethodType | null;
|
|
1882
|
+
client_secret?: string | null;
|
|
1883
|
+
billing?: Address | null;
|
|
1884
|
+
shipping?: Address | null;
|
|
1885
|
+
payment_type?: string | null;
|
|
1886
|
+
payment_token?: string | null;
|
|
1852
1887
|
}
|
|
1853
|
-
|
|
1888
|
+
/** A single invoice raised for one billing cycle of a subscription. */
|
|
1889
|
+
interface SubscriptionInvoice {
|
|
1890
|
+
id: string;
|
|
1854
1891
|
subscription_id: string;
|
|
1855
|
-
|
|
1856
|
-
|
|
1892
|
+
merchant_id: string;
|
|
1893
|
+
profile_id: string;
|
|
1894
|
+
merchant_connector_id: string;
|
|
1895
|
+
payment_intent_id?: string | null;
|
|
1896
|
+
payment_method_id?: string | null;
|
|
1897
|
+
customer_id: string;
|
|
1857
1898
|
amount: number;
|
|
1858
1899
|
currency: Currency;
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1900
|
+
status: InvoiceStatus;
|
|
1901
|
+
/** ID of this invoice on the billing processor (Stripe Billing / PayPal). */
|
|
1902
|
+
billing_processor_invoice_id?: string | null;
|
|
1903
|
+
/** Connector (billing processor) this invoice was raised through, e.g. `paypal`. */
|
|
1904
|
+
provider_name?: Connector | null;
|
|
1905
|
+
}
|
|
1906
|
+
/** A purchasable price option for a subscription item (plan or addon). */
|
|
1907
|
+
interface SubscriptionItemPrice {
|
|
1908
|
+
price_id: string;
|
|
1909
|
+
/** Plan or addon ID this price belongs to. */
|
|
1910
|
+
item_id?: string | null;
|
|
1911
|
+
amount: number;
|
|
1912
|
+
currency: Currency;
|
|
1913
|
+
interval: SubscriptionPeriodUnit;
|
|
1914
|
+
interval_count: number;
|
|
1915
|
+
trial_period?: number | null;
|
|
1916
|
+
trial_period_unit?: SubscriptionPeriodUnit | null;
|
|
1917
|
+
}
|
|
1918
|
+
/** A subscription item (plan or addon) with its available prices. */
|
|
1919
|
+
interface SubscriptionItem {
|
|
1920
|
+
item_id: string;
|
|
1921
|
+
name: string;
|
|
1922
|
+
description?: string | null;
|
|
1923
|
+
/** Available prices for this item. */
|
|
1924
|
+
price_id: SubscriptionItemPrice[];
|
|
1862
1925
|
}
|
|
1926
|
+
/** A single line of a subscription cost estimate. */
|
|
1927
|
+
interface SubscriptionLineItem {
|
|
1928
|
+
item_id: string;
|
|
1929
|
+
item_type: string;
|
|
1930
|
+
description: string;
|
|
1931
|
+
amount: number;
|
|
1932
|
+
currency: Currency;
|
|
1933
|
+
quantity: number;
|
|
1934
|
+
}
|
|
1935
|
+
/** Payment options for `POST /subscriptions/create` (create without confirming). */
|
|
1936
|
+
interface CreateSubscriptionPaymentDetails {
|
|
1937
|
+
/** URL the customer is returned to after completing the purchase. */
|
|
1938
|
+
return_url: string;
|
|
1939
|
+
setup_future_usage?: FutureUsage | null;
|
|
1940
|
+
capture_method?: CaptureMethod | null;
|
|
1941
|
+
authentication_type?: AuthenticationType | null;
|
|
1942
|
+
payment_type?: string | null;
|
|
1943
|
+
}
|
|
1944
|
+
/** Body for `POST /subscriptions/create`. */
|
|
1945
|
+
interface CreateSubscriptionRequest {
|
|
1946
|
+
merchant_reference_id?: string | null;
|
|
1947
|
+
item_price_id: string;
|
|
1948
|
+
plan_id?: string | null;
|
|
1949
|
+
coupon_code?: string | null;
|
|
1950
|
+
customer_id: string;
|
|
1951
|
+
payment_details: CreateSubscriptionPaymentDetails;
|
|
1952
|
+
billing?: Address | null;
|
|
1953
|
+
shipping?: Address | null;
|
|
1954
|
+
}
|
|
1955
|
+
/** Payment options for `POST /subscriptions` (create + confirm in one call). */
|
|
1956
|
+
interface SubscriptionPaymentDetails {
|
|
1957
|
+
payment_method?: PaymentMethod | null;
|
|
1958
|
+
payment_method_type?: PaymentMethodType | null;
|
|
1959
|
+
payment_method_data?: Record<string, unknown> | null;
|
|
1960
|
+
setup_future_usage?: FutureUsage | null;
|
|
1961
|
+
customer_acceptance?: Record<string, unknown> | null;
|
|
1962
|
+
/** URL the customer is returned to after completing the purchase. */
|
|
1963
|
+
return_url?: string | null;
|
|
1964
|
+
capture_method?: CaptureMethod | null;
|
|
1965
|
+
authentication_type?: AuthenticationType | null;
|
|
1966
|
+
payment_type?: string | null;
|
|
1967
|
+
payment_method_id?: string | null;
|
|
1968
|
+
}
|
|
1969
|
+
/** Body for `POST /subscriptions` (create and immediately confirm). */
|
|
1970
|
+
interface CreateAndConfirmSubscriptionRequest {
|
|
1971
|
+
plan_id?: string | null;
|
|
1972
|
+
item_price_id: string;
|
|
1973
|
+
coupon_code?: string | null;
|
|
1974
|
+
customer_id: string;
|
|
1975
|
+
billing?: Address | null;
|
|
1976
|
+
shipping?: Address | null;
|
|
1977
|
+
payment_details: SubscriptionPaymentDetails;
|
|
1978
|
+
merchant_reference_id?: string | null;
|
|
1979
|
+
}
|
|
1980
|
+
/** Payment options for `POST /subscriptions/{id}/confirm`. */
|
|
1981
|
+
interface ConfirmSubscriptionPaymentDetails {
|
|
1982
|
+
shipping?: Address | null;
|
|
1983
|
+
billing?: Address | null;
|
|
1984
|
+
payment_method: PaymentMethod;
|
|
1985
|
+
payment_method_type?: PaymentMethodType | null;
|
|
1986
|
+
payment_method_data?: Record<string, unknown> | null;
|
|
1987
|
+
customer_acceptance?: Record<string, unknown> | null;
|
|
1988
|
+
payment_type?: string | null;
|
|
1989
|
+
payment_token?: string | null;
|
|
1990
|
+
}
|
|
1991
|
+
/** Body for `POST /subscriptions/{id}/confirm`. */
|
|
1992
|
+
interface ConfirmSubscriptionRequest {
|
|
1993
|
+
/** Client secret minted at create time; required for client-side confirm. */
|
|
1994
|
+
client_secret?: string | null;
|
|
1995
|
+
payment_details: ConfirmSubscriptionPaymentDetails;
|
|
1996
|
+
}
|
|
1997
|
+
/** Body for `PUT /subscriptions/{id}/update`. */
|
|
1998
|
+
interface UpdateSubscriptionRequest {
|
|
1999
|
+
plan_id: string;
|
|
2000
|
+
item_price_id: string;
|
|
2001
|
+
}
|
|
2002
|
+
/** Body for `POST /subscriptions/{id}/pause`. */
|
|
2003
|
+
interface PauseSubscriptionRequest {
|
|
2004
|
+
pause_option?: 'immediately' | 'end_of_term' | 'specific_date' | null;
|
|
2005
|
+
/** ISO-8601 timestamp; honoured when `pause_option` is `specific_date`. */
|
|
2006
|
+
pause_at?: string | null;
|
|
2007
|
+
}
|
|
2008
|
+
/** Body for `POST /subscriptions/{id}/resume`. */
|
|
2009
|
+
interface ResumeSubscriptionRequest {
|
|
2010
|
+
resume_option?: 'immediately' | 'specific_date' | null;
|
|
2011
|
+
resume_date?: string | null;
|
|
2012
|
+
charges_handling?: 'invoice_immediately' | 'add_to_unbilled_charges' | null;
|
|
2013
|
+
unpaid_invoices_handling?: 'no_action' | 'schedule_payment_collection' | null;
|
|
2014
|
+
}
|
|
2015
|
+
/** Body for `POST /subscriptions/{id}/cancel`. */
|
|
2016
|
+
interface CancelSubscriptionRequest {
|
|
2017
|
+
cancel_option?: 'immediately' | 'end_of_term' | 'specific_date' | null;
|
|
2018
|
+
cancel_at?: string | null;
|
|
2019
|
+
unbilled_charges_option?: 'invoice' | 'delete' | null;
|
|
2020
|
+
credit_option_for_current_term_charges?: 'none' | 'prorate' | 'full' | null;
|
|
2021
|
+
account_receivables_handling?: 'no_action' | 'schedule_payment_collection' | 'write_off' | null;
|
|
2022
|
+
refundable_credits_handling?: 'no_action' | 'schedule_refund' | null;
|
|
2023
|
+
cancel_reason_code?: string | null;
|
|
2024
|
+
}
|
|
2025
|
+
/** Query for `GET /subscriptions/list`. */
|
|
1863
2026
|
interface SubscriptionListParams {
|
|
1864
2027
|
limit?: number;
|
|
1865
2028
|
offset?: number;
|
|
1866
|
-
customer_id?: string;
|
|
1867
|
-
status?: string;
|
|
1868
2029
|
}
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
2030
|
+
/** Query for `GET /subscriptions/items`. */
|
|
2031
|
+
interface GetSubscriptionItemsParams {
|
|
2032
|
+
client_secret?: string;
|
|
2033
|
+
limit?: number;
|
|
2034
|
+
offset?: number;
|
|
2035
|
+
item_type: SubscriptionItemType;
|
|
2036
|
+
}
|
|
2037
|
+
/** Query for `GET /subscriptions/estimate`. */
|
|
2038
|
+
interface SubscriptionEstimateParams {
|
|
2039
|
+
plan_id?: string;
|
|
2040
|
+
item_price_id: string;
|
|
2041
|
+
coupon_code?: string;
|
|
2042
|
+
}
|
|
2043
|
+
/**
|
|
2044
|
+
* A subscription, as returned by create / retrieve / update / list. The
|
|
2045
|
+
* confirm and create-and-confirm flows return {@link ConfirmSubscriptionResponse}
|
|
2046
|
+
* instead, which additionally carries the billing-processor subscription ID and
|
|
2047
|
+
* the approval `redirect_url`.
|
|
2048
|
+
*/
|
|
2049
|
+
interface SubscriptionResponse {
|
|
2050
|
+
id: string;
|
|
2051
|
+
merchant_reference_id?: string | null;
|
|
2052
|
+
status: SubscriptionStatus;
|
|
2053
|
+
plan_id?: string | null;
|
|
2054
|
+
item_price_id?: string | null;
|
|
2055
|
+
profile_id: string;
|
|
2056
|
+
/** Token (15-min TTL) used by the client SDK to authenticate confirm/session calls. */
|
|
2057
|
+
client_secret?: string | null;
|
|
2058
|
+
merchant_id: string;
|
|
2059
|
+
coupon_code?: string | null;
|
|
2060
|
+
customer_id: string;
|
|
2061
|
+
payment?: SubscriptionPaymentData | null;
|
|
2062
|
+
invoice?: SubscriptionInvoice | null;
|
|
2063
|
+
}
|
|
2064
|
+
/**
|
|
2065
|
+
* Returned by `POST /subscriptions` (create + confirm) and
|
|
2066
|
+
* `POST /subscriptions/{id}/confirm`.
|
|
2067
|
+
*/
|
|
2068
|
+
interface ConfirmSubscriptionResponse {
|
|
2069
|
+
id: string;
|
|
2070
|
+
merchant_reference_id?: string | null;
|
|
2071
|
+
status: SubscriptionStatus;
|
|
2072
|
+
plan_id?: string | null;
|
|
2073
|
+
item_price_id?: string | null;
|
|
2074
|
+
coupon?: string | null;
|
|
2075
|
+
profile_id: string;
|
|
2076
|
+
payment?: SubscriptionPaymentData | null;
|
|
2077
|
+
customer_id?: string | null;
|
|
2078
|
+
invoice?: SubscriptionInvoice | null;
|
|
2079
|
+
/** Subscription ID on the billing processor (Stripe Billing / PayPal). */
|
|
2080
|
+
billing_processor_subscription_id?: string | null;
|
|
2081
|
+
/**
|
|
2082
|
+
* URL the customer must be redirected to in order to approve the
|
|
2083
|
+
* subscription, for billing processors that require buyer approval
|
|
2084
|
+
* (e.g. PayPal `APPROVAL_PENDING`). `null` for processors that activate the
|
|
2085
|
+
* subscription server-side (e.g. Stripe Billing with a saved payment method).
|
|
2086
|
+
*/
|
|
2087
|
+
redirect_url?: string | null;
|
|
2088
|
+
}
|
|
2089
|
+
/** Returned by `POST /subscriptions/{id}/pause`. */
|
|
2090
|
+
interface PauseSubscriptionResponse {
|
|
2091
|
+
id: string;
|
|
2092
|
+
status: SubscriptionStatus;
|
|
2093
|
+
merchant_reference_id?: string | null;
|
|
2094
|
+
profile_id: string;
|
|
2095
|
+
merchant_id: string;
|
|
2096
|
+
customer_id: string;
|
|
2097
|
+
/** ISO-8601 timestamp the subscription was paused at. */
|
|
2098
|
+
paused_at?: string | null;
|
|
2099
|
+
}
|
|
2100
|
+
/** Returned by `POST /subscriptions/{id}/resume`. */
|
|
2101
|
+
interface ResumeSubscriptionResponse {
|
|
2102
|
+
id: string;
|
|
2103
|
+
status: SubscriptionStatus;
|
|
2104
|
+
merchant_reference_id?: string | null;
|
|
2105
|
+
profile_id: string;
|
|
2106
|
+
merchant_id: string;
|
|
2107
|
+
customer_id: string;
|
|
2108
|
+
/** ISO-8601 timestamp of the next billing cycle. */
|
|
2109
|
+
next_billing_at?: string | null;
|
|
2110
|
+
}
|
|
2111
|
+
/** Returned by `POST /subscriptions/{id}/cancel`. */
|
|
2112
|
+
interface CancelSubscriptionResponse {
|
|
2113
|
+
id: string;
|
|
2114
|
+
status: SubscriptionStatus;
|
|
2115
|
+
merchant_reference_id?: string | null;
|
|
2116
|
+
profile_id: string;
|
|
2117
|
+
merchant_id: string;
|
|
2118
|
+
customer_id: string;
|
|
2119
|
+
/** ISO-8601 timestamp the subscription was cancelled at. */
|
|
2120
|
+
cancelled_at?: string | null;
|
|
2121
|
+
}
|
|
2122
|
+
/** A subscription item with its prices, as returned by `GET /subscriptions/items`. */
|
|
2123
|
+
interface GetSubscriptionItemsResponse {
|
|
2124
|
+
item_id: string;
|
|
2125
|
+
name: string;
|
|
2126
|
+
description?: string | null;
|
|
2127
|
+
price_id: SubscriptionItemPrice[];
|
|
2128
|
+
}
|
|
2129
|
+
/** Returned by `GET /subscriptions/estimate`. */
|
|
2130
|
+
interface SubscriptionEstimateResponse {
|
|
2131
|
+
amount: number;
|
|
2132
|
+
currency: Currency;
|
|
2133
|
+
plan_id?: string | null;
|
|
2134
|
+
item_price_id?: string | null;
|
|
2135
|
+
coupon_code?: string | null;
|
|
2136
|
+
customer_id?: string | null;
|
|
2137
|
+
line_items: SubscriptionLineItem[];
|
|
2138
|
+
/** Billing interval unit, when the connector exposes it. */
|
|
2139
|
+
interval?: SubscriptionPeriodUnit | null;
|
|
2140
|
+
/** Number of interval units per cycle, when known. */
|
|
2141
|
+
interval_count?: number | null;
|
|
1872
2142
|
}
|
|
1873
2143
|
interface RegionCreateRequest {
|
|
1874
2144
|
region_name: string;
|
|
@@ -3441,31 +3711,47 @@ declare class Regions {
|
|
|
3441
3711
|
list(): Promise<RegionResponse[]>;
|
|
3442
3712
|
}
|
|
3443
3713
|
|
|
3714
|
+
/**
|
|
3715
|
+
* Subscription endpoints are profile-scoped: the backend requires an
|
|
3716
|
+
* `X-Profile-Id` header to resolve the shop / billing processor (`IR_04`
|
|
3717
|
+
* otherwise). Pass it through the per-call `options.headers`, e.g.
|
|
3718
|
+
* `subscriptions.list(params, { headers: { 'X-Profile-Id': profileId } })`.
|
|
3719
|
+
*/
|
|
3444
3720
|
declare class Subscriptions {
|
|
3445
3721
|
private readonly request;
|
|
3446
3722
|
constructor(request: RequestFn);
|
|
3447
|
-
/**
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3723
|
+
/**
|
|
3724
|
+
* Create and immediately confirm a subscription. `POST /subscriptions`
|
|
3725
|
+
*
|
|
3726
|
+
* For billing processors that require buyer approval (e.g. PayPal), the
|
|
3727
|
+
* response carries a `redirect_url` the customer must be sent to.
|
|
3728
|
+
*/
|
|
3729
|
+
createAndConfirm(params: CreateAndConfirmSubscriptionRequest, options?: RequestExtras): Promise<ConfirmSubscriptionResponse>;
|
|
3730
|
+
/** Create a subscription without confirming it. `POST /subscriptions/create` */
|
|
3731
|
+
create(params: CreateSubscriptionRequest, options?: RequestExtras): Promise<SubscriptionResponse>;
|
|
3451
3732
|
/** Retrieve a subscription by ID. `GET /subscriptions/{subscriptionId}` */
|
|
3452
|
-
retrieve(subscriptionId: string): Promise<SubscriptionResponse>;
|
|
3453
|
-
/**
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3733
|
+
retrieve(subscriptionId: string, options?: RequestExtras): Promise<SubscriptionResponse>;
|
|
3734
|
+
/**
|
|
3735
|
+
* Confirm a previously created subscription. `POST /subscriptions/{subscriptionId}/confirm`
|
|
3736
|
+
*
|
|
3737
|
+
* Like {@link createAndConfirm}, the response may carry a `redirect_url` for
|
|
3738
|
+
* processors that require buyer approval.
|
|
3739
|
+
*/
|
|
3740
|
+
confirm(subscriptionId: string, params: ConfirmSubscriptionRequest, options?: RequestExtras): Promise<ConfirmSubscriptionResponse>;
|
|
3741
|
+
/** Update a subscription's plan/price. `PUT /subscriptions/{subscriptionId}/update` */
|
|
3742
|
+
update(subscriptionId: string, params: UpdateSubscriptionRequest, options?: RequestExtras): Promise<SubscriptionResponse>;
|
|
3743
|
+
/** List subscriptions for the profile. `GET /subscriptions/list` */
|
|
3744
|
+
list(params?: SubscriptionListParams, options?: RequestExtras): Promise<SubscriptionResponse[]>;
|
|
3745
|
+
/** Estimate the cost of a subscription before creating it. `GET /subscriptions/estimate` */
|
|
3746
|
+
getEstimate(params: SubscriptionEstimateParams, options?: RequestExtras): Promise<SubscriptionEstimateResponse>;
|
|
3747
|
+
/** List purchasable subscription items (plans/addons). `GET /subscriptions/items` */
|
|
3748
|
+
getItems(params: GetSubscriptionItemsParams, options?: RequestExtras): Promise<GetSubscriptionItemsResponse[]>;
|
|
3463
3749
|
/** Pause a subscription. `POST /subscriptions/{subscriptionId}/pause` */
|
|
3464
|
-
pause(subscriptionId: string): Promise<
|
|
3465
|
-
/** Resume a subscription. `POST /subscriptions/{subscriptionId}/resume` */
|
|
3466
|
-
resume(subscriptionId: string): Promise<
|
|
3750
|
+
pause(subscriptionId: string, params?: PauseSubscriptionRequest, options?: RequestExtras): Promise<PauseSubscriptionResponse>;
|
|
3751
|
+
/** Resume a paused subscription. `POST /subscriptions/{subscriptionId}/resume` */
|
|
3752
|
+
resume(subscriptionId: string, params?: ResumeSubscriptionRequest, options?: RequestExtras): Promise<ResumeSubscriptionResponse>;
|
|
3467
3753
|
/** Cancel a subscription. `POST /subscriptions/{subscriptionId}/cancel` */
|
|
3468
|
-
cancel(subscriptionId: string): Promise<
|
|
3754
|
+
cancel(subscriptionId: string, params?: CancelSubscriptionRequest, options?: RequestExtras): Promise<CancelSubscriptionResponse>;
|
|
3469
3755
|
}
|
|
3470
3756
|
|
|
3471
3757
|
/**
|
|
@@ -3931,4 +4217,4 @@ declare function parseImportedBranding(raw: unknown): CheckoutBranding;
|
|
|
3931
4217
|
declare function applyBrandingVariables(el: HTMLElement, b: CheckoutBranding): void;
|
|
3932
4218
|
declare function shadowFor(style: SurfaceStyle): string;
|
|
3933
4219
|
|
|
3934
|
-
export { type Address, type AddressDetails, type AllocationListResponse, type AllocationResponse, type AllocationTransferRequest, type AllocationTransferResponse, Analytics, AnalyticsDashboard, type ApiKeyCreateRequest, type ApiKeyCreateResponse, type ApiKeyExpiration, type ApiKeyResponse, type ApiKeyRevokeResponse, type ApiKeyUpdateRequest, type ApplePayVerificationRequest, type ApplePayVerificationResponse, type ApplePayVerifiedDomainsResponse, type AuthResponse, type AuthenticationCreateRequest, type AuthenticationResponse, type AuthenticationStatus, type AuthenticationType, type AutoRechargeConfig, type AutoRechargeUpdateRequest, BRANDING_EXPORT_FORMAT, BRANDING_EXPORT_VERSION, type BillingCompleteSetupRequest, type BillingProfileResponse, type BillingSetupRequest, type BillingSetupResponse, type BlocklistAddRequest, type BlocklistDataKind, type BlocklistResponse, type BrandingExport, type BrandingSource, type BusinessPaymentLinkConfig, CUSTOM_CSS_MAX_LENGTH, type CaptureMethod, type CardDetail, type CardDetailFromLocker, Cards, type ChangePasswordRequest, type CheckoutBranding, type Connector, type ConnectorCreateRequest, type ConnectorListResponse, type ConnectorResponse, type ConnectorType, type ConnectorUpdateRequest, type ConnectorVolumeSplit, type ConnectorWebhookEntry, type ConnectorWebhookEventType, type ConnectorWebhookListResponse, type ConnectorWebhookRegisterRequest, type ConnectorWebhookRegisterResponse, type CornerRadius, type Currency, type CustomerCreateRequest, type CustomerListParams, type CustomerPaymentMethodsListParams, type CustomerPaymentMethodsListResponse, type CustomerResponse, type CustomerUpdateRequest, DEFAULT_BADGES, DEFAULT_BADGES_DARK, DEFAULT_BRANDING, DEFAULT_BRANDING_DARK, type DeleteAccountRequest, Delopay, DelopayAuthenticationError, DelopayError, type DelopayLogger, type DelopayOptions, type DisputeEvidenceRequest, type DisputeListParams, type DisputeResponse, type DisputeStage, type DisputeStatus, type EncodedBranding, type EphemeralKeyCreateRequest, type EphemeralKeyCreateResponse, type EventClass, type EventDeliveryAttemptResponse, type EventDetailResponse, type EventListParams, type EventListResponse, type EventResponse, type EventType, Export, FeatureMatrix, type FeeOwner, type FeeScheduleCreateRequest, type FeeScheduleResponse, type FeeScheduleUpdateRequest, type FeeType, Files, type FontFamily, type FontWeight, Forex, type ForgotPasswordRequest, type FromEmailRequest, type GatewayConnectRequest, type GatewayResponse, type GlobalSearchRequest, type IntentStatus, type InviteUsersRequest, type InviteUsersResponse, type LabelStyle, type LayoutStyle, type LedgerEntry, type LedgerListParams, type LedgerResponse, type LinkedRoutingConfigRetrieveResponse, type ListInvitableRolesParams, type LoginHistoryEntry, type LoginHistoryParams, type LoginHistoryResponse, type LogoShape, type LogoSize, type MandateListParams, type MandateResponse, type MandateRevokedResponse, type MandateStatus, type MandateType, type MerchantAccountCreateRequest, type MerchantAccountResponse, type MerchantAccountType, type MerchantAccountUpdateRequest, type MerchantOverviewResponse, type MerchantOverviewStat, type MerchantRoutingAlgorithm, type NonPillRadius, type ParentGroup, type ParentGroupInfo, type PaymentCancelRequest, type PaymentCaptureRequest, type PaymentConfirmRequest, type PaymentCreateRequest, type PaymentLayout, type PaymentLinkBackgroundImageConfig, type PaymentLinkConfigRequest, type PaymentLinkListParams, type PaymentLinkListResponse, type PaymentLinkResponse, type PaymentLinkTransactionDetails, type PaymentListParams, type PaymentListResponse, type PaymentMethod, type PaymentMethodCreateRequest, type PaymentMethodDeleteResponse, type PaymentMethodListParams, type PaymentMethodResponse, type PaymentMethodType, type PaymentMethodUpdateRequest, type PaymentResponse, type PaymentRetrieveOptions, type PaymentUpdateRequest, type PayoutCreateRequest, type PayoutListParams, type PayoutListResponse, type PayoutResponse, type PayoutStatus, type PayoutType, type PayoutUpdateRequest, type PermissionScope, type PhoneDetails, type PhoneOtpRequest, type PhoneOtpResponse, type PhoneOtpVerifyRequest, type PhoneOtpVerifyResponse, type PollStatus, type PollStatusResponse, type ProfileAcquirerCreateRequest, type ProfileAcquirerResponse, type ProfileAcquirerUpdateRequest, type ProfileCreateRequest, type ProfileDefaultRoutingConfig, type ProfileLogoUploadResponse, type ProfileResponse, type ProfileUpdateRequest, type ProjectCreateRequest, type ProjectResponse, type ProjectStats, type ProjectStatsResponse, type ProjectUpdateRequest, type RecoveryCodesResponse, type RefundCreateRequest, type RefundListParams, type RefundListResponse, type RefundResponse, type RefundStatus, type RefundType, type RefundUpdateRequest, type RegionCreateRequest, type RegionResponse, type RegionUpdateRequest, Regions, type RelayRequest, type RelayResponse, type RelayStatus, type RelayType, type RequestFn, type RequestOptions, type ResetPasswordRequest, type RoutableConnectorChoice, type RoutingActivatePayload, type RoutingConfigCreateRequest, type RoutingConfigResponse, type RoutingDeactivateRequest, type RoutingDictionary, type RoutingDictionaryRecord, Search, type SearchGroupResponse, type SearchIndex, type SearchStatus, type ShopCreateRequest, type ShopResponse, type ShopStats, type ShopUpdateRequest, type SignInRequest, type SignUpRequest, type SignUpWithMerchantIdRequest, type SignUpWithMerchantRequest, type SizeScale, type SpacingScale, type StaticRoutingAlgorithm, type StripeConnectAccountRequest, type StripeConnectAccountResponse, type StripeConnectLinkRequest, type StripeConnectLinkResponse, type
|
|
4220
|
+
export { type Address, type AddressDetails, type AllocationListResponse, type AllocationResponse, type AllocationTransferRequest, type AllocationTransferResponse, Analytics, AnalyticsDashboard, type ApiKeyCreateRequest, type ApiKeyCreateResponse, type ApiKeyExpiration, type ApiKeyResponse, type ApiKeyRevokeResponse, type ApiKeyUpdateRequest, type ApplePayVerificationRequest, type ApplePayVerificationResponse, type ApplePayVerifiedDomainsResponse, type AuthResponse, type AuthenticationCreateRequest, type AuthenticationResponse, type AuthenticationStatus, type AuthenticationType, type AutoRechargeConfig, type AutoRechargeUpdateRequest, BRANDING_EXPORT_FORMAT, BRANDING_EXPORT_VERSION, type BillingCompleteSetupRequest, type BillingProfileResponse, type BillingSetupRequest, type BillingSetupResponse, type BlocklistAddRequest, type BlocklistDataKind, type BlocklistResponse, type BrandingExport, type BrandingSource, type BusinessPaymentLinkConfig, CUSTOM_CSS_MAX_LENGTH, type CancelSubscriptionRequest, type CancelSubscriptionResponse, type CaptureMethod, type CardDetail, type CardDetailFromLocker, Cards, type ChangePasswordRequest, type CheckoutBranding, type ConfirmSubscriptionPaymentDetails, type ConfirmSubscriptionRequest, type ConfirmSubscriptionResponse, type Connector, type ConnectorCreateRequest, type ConnectorListResponse, type ConnectorResponse, type ConnectorType, type ConnectorUpdateRequest, type ConnectorVolumeSplit, type ConnectorWebhookEntry, type ConnectorWebhookEventType, type ConnectorWebhookListResponse, type ConnectorWebhookRegisterRequest, type ConnectorWebhookRegisterResponse, type CornerRadius, type CreateAndConfirmSubscriptionRequest, type CreateSubscriptionPaymentDetails, type CreateSubscriptionRequest, type Currency, type CustomerCreateRequest, type CustomerListParams, type CustomerPaymentMethodsListParams, type CustomerPaymentMethodsListResponse, type CustomerResponse, type CustomerUpdateRequest, DEFAULT_BADGES, DEFAULT_BADGES_DARK, DEFAULT_BRANDING, DEFAULT_BRANDING_DARK, type DeleteAccountRequest, Delopay, DelopayAuthenticationError, DelopayError, type DelopayLogger, type DelopayOptions, type DisputeEvidenceRequest, type DisputeListParams, type DisputeResponse, type DisputeStage, type DisputeStatus, type EncodedBranding, type EphemeralKeyCreateRequest, type EphemeralKeyCreateResponse, type EventClass, type EventDeliveryAttemptResponse, type EventDetailResponse, type EventListParams, type EventListResponse, type EventResponse, type EventType, Export, FeatureMatrix, type FeeOwner, type FeeScheduleCreateRequest, type FeeScheduleResponse, type FeeScheduleUpdateRequest, type FeeType, Files, type FontFamily, type FontWeight, Forex, type ForgotPasswordRequest, type FromEmailRequest, type FutureUsage, type GatewayConnectRequest, type GatewayResponse, type GetSubscriptionItemsParams, type GetSubscriptionItemsResponse, type GlobalSearchRequest, type IntentStatus, type InviteUsersRequest, type InviteUsersResponse, type InvoiceStatus, type LabelStyle, type LayoutStyle, type LedgerEntry, type LedgerListParams, type LedgerResponse, type LinkedRoutingConfigRetrieveResponse, type ListInvitableRolesParams, type LoginHistoryEntry, type LoginHistoryParams, type LoginHistoryResponse, type LogoShape, type LogoSize, type MandateListParams, type MandateResponse, type MandateRevokedResponse, type MandateStatus, type MandateType, type MerchantAccountCreateRequest, type MerchantAccountResponse, type MerchantAccountType, type MerchantAccountUpdateRequest, type MerchantOverviewResponse, type MerchantOverviewStat, type MerchantRoutingAlgorithm, type NonPillRadius, type ParentGroup, type ParentGroupInfo, type PauseSubscriptionRequest, type PauseSubscriptionResponse, type PaymentCancelRequest, type PaymentCaptureRequest, type PaymentConfirmRequest, type PaymentCreateRequest, type PaymentLayout, type PaymentLinkBackgroundImageConfig, type PaymentLinkConfigRequest, type PaymentLinkListParams, type PaymentLinkListResponse, type PaymentLinkResponse, type PaymentLinkTransactionDetails, type PaymentListParams, type PaymentListResponse, type PaymentMethod, type PaymentMethodCreateRequest, type PaymentMethodDeleteResponse, type PaymentMethodListParams, type PaymentMethodResponse, type PaymentMethodType, type PaymentMethodUpdateRequest, type PaymentResponse, type PaymentRetrieveOptions, type PaymentUpdateRequest, type PayoutCreateRequest, type PayoutListParams, type PayoutListResponse, type PayoutResponse, type PayoutStatus, type PayoutType, type PayoutUpdateRequest, type PermissionScope, type PhoneDetails, type PhoneOtpRequest, type PhoneOtpResponse, type PhoneOtpVerifyRequest, type PhoneOtpVerifyResponse, type PollStatus, type PollStatusResponse, type ProfileAcquirerCreateRequest, type ProfileAcquirerResponse, type ProfileAcquirerUpdateRequest, type ProfileCreateRequest, type ProfileDefaultRoutingConfig, type ProfileLogoUploadResponse, type ProfileResponse, type ProfileUpdateRequest, type ProjectCreateRequest, type ProjectResponse, type ProjectStats, type ProjectStatsResponse, type ProjectUpdateRequest, type RecoveryCodesResponse, type RefundCreateRequest, type RefundListParams, type RefundListResponse, type RefundResponse, type RefundStatus, type RefundType, type RefundUpdateRequest, type RegionCreateRequest, type RegionResponse, type RegionUpdateRequest, Regions, type RelayRequest, type RelayResponse, type RelayStatus, type RelayType, type RequestFn, type RequestOptions, type ResetPasswordRequest, type ResumeSubscriptionRequest, type ResumeSubscriptionResponse, type RoutableConnectorChoice, type RoutingActivatePayload, type RoutingConfigCreateRequest, type RoutingConfigResponse, type RoutingDeactivateRequest, type RoutingDictionary, type RoutingDictionaryRecord, Search, type SearchGroupResponse, type SearchIndex, type SearchStatus, type ShopCreateRequest, type ShopResponse, type ShopStats, type ShopUpdateRequest, type SignInRequest, type SignUpRequest, type SignUpWithMerchantIdRequest, type SignUpWithMerchantRequest, type SizeScale, type SpacingScale, type StaticRoutingAlgorithm, type StripeConnectAccountRequest, type StripeConnectAccountResponse, type StripeConnectLinkRequest, type StripeConnectLinkResponse, type SubscriptionEstimateParams, type SubscriptionEstimateResponse, type SubscriptionInvoice, type SubscriptionItem, type SubscriptionItemPrice, type SubscriptionItemType, type SubscriptionLineItem, type SubscriptionListParams, type SubscriptionPaymentData, type SubscriptionPaymentDetails, type SubscriptionPeriodUnit, type SubscriptionResponse, type SubscriptionStatus, Subscriptions, type SummaryPosition, type SurfaceStyle, type SwitchMerchantRequest, type SwitchProfileRequest, type Terminate2faQueryParams, type ThreeDSDecision, type ThreeDsRuleExecuteRequest, type ThreeDsRuleResponse, type TierSummary, type TokenPurpose, type TokenResponse, type TopupRequest, type TopupResponse, type TotpResponse, type TransactionType, type TrustBadge, type UpdateSubscriptionRequest, type UpdateUserDetailsRequest, type UserResponse, type UserSessionEntry, type UserSessionListResponse, type UserSessionRevokeResponse, type VerifyTotpRequest, type WebhookDeliveryAttempt, type WebhookEvent, Webhooks, applyBrandingVariables, buildBrandingExport, buttonPadValue, cloneBranding, decodeBadges, decodeBranding, defaultBranding, encodeBadges, encodeBranding, fontStack, fontWeightValue, inputPadValue, isDarkSurface, isHexColor, logoDimensions, parseImportedBranding, radiusValue, sanitizeCustomCss, shadowFor, surfacePadValue, verticalGapValue };
|
package/dist/index.js
CHANGED
package/dist/internal.cjs
CHANGED
|
@@ -2605,55 +2605,85 @@ var Subscriptions = class {
|
|
|
2605
2605
|
constructor(request) {
|
|
2606
2606
|
this.request = request;
|
|
2607
2607
|
}
|
|
2608
|
-
/**
|
|
2609
|
-
|
|
2610
|
-
|
|
2608
|
+
/**
|
|
2609
|
+
* Create and immediately confirm a subscription. `POST /subscriptions`
|
|
2610
|
+
*
|
|
2611
|
+
* For billing processors that require buyer approval (e.g. PayPal), the
|
|
2612
|
+
* response carries a `redirect_url` the customer must be sent to.
|
|
2613
|
+
*/
|
|
2614
|
+
async createAndConfirm(params, options) {
|
|
2615
|
+
return this.request("POST", "/subscriptions", { body: params, ...options });
|
|
2611
2616
|
}
|
|
2612
|
-
/** Create a subscription
|
|
2613
|
-
async create(params) {
|
|
2614
|
-
return this.request("POST", "/subscriptions/create", { body: params });
|
|
2617
|
+
/** Create a subscription without confirming it. `POST /subscriptions/create` */
|
|
2618
|
+
async create(params, options) {
|
|
2619
|
+
return this.request("POST", "/subscriptions/create", { body: params, ...options });
|
|
2615
2620
|
}
|
|
2616
2621
|
/** Retrieve a subscription by ID. `GET /subscriptions/{subscriptionId}` */
|
|
2617
|
-
async retrieve(subscriptionId) {
|
|
2618
|
-
return this.request("GET", `/subscriptions/${encodeURIComponent(subscriptionId)}
|
|
2622
|
+
async retrieve(subscriptionId, options) {
|
|
2623
|
+
return this.request("GET", `/subscriptions/${encodeURIComponent(subscriptionId)}`, {
|
|
2624
|
+
...options
|
|
2625
|
+
});
|
|
2619
2626
|
}
|
|
2620
|
-
/**
|
|
2621
|
-
|
|
2627
|
+
/**
|
|
2628
|
+
* Confirm a previously created subscription. `POST /subscriptions/{subscriptionId}/confirm`
|
|
2629
|
+
*
|
|
2630
|
+
* Like {@link createAndConfirm}, the response may carry a `redirect_url` for
|
|
2631
|
+
* processors that require buyer approval.
|
|
2632
|
+
*/
|
|
2633
|
+
async confirm(subscriptionId, params, options) {
|
|
2622
2634
|
return this.request("POST", `/subscriptions/${encodeURIComponent(subscriptionId)}/confirm`, {
|
|
2623
|
-
body: params
|
|
2635
|
+
body: params,
|
|
2636
|
+
...options
|
|
2624
2637
|
});
|
|
2625
2638
|
}
|
|
2626
|
-
/** Update a subscription. `PUT /subscriptions/{subscriptionId}/update` */
|
|
2627
|
-
async update(subscriptionId, params) {
|
|
2639
|
+
/** Update a subscription's plan/price. `PUT /subscriptions/{subscriptionId}/update` */
|
|
2640
|
+
async update(subscriptionId, params, options) {
|
|
2628
2641
|
return this.request("PUT", `/subscriptions/${encodeURIComponent(subscriptionId)}/update`, {
|
|
2629
|
-
body: params
|
|
2642
|
+
body: params,
|
|
2643
|
+
...options
|
|
2630
2644
|
});
|
|
2631
2645
|
}
|
|
2632
|
-
/** List subscriptions. `GET /subscriptions/list` */
|
|
2633
|
-
async list(params) {
|
|
2646
|
+
/** List subscriptions for the profile. `GET /subscriptions/list` */
|
|
2647
|
+
async list(params, options) {
|
|
2634
2648
|
return this.request("GET", "/subscriptions/list", {
|
|
2635
|
-
query: params
|
|
2649
|
+
query: params,
|
|
2650
|
+
...options
|
|
2636
2651
|
});
|
|
2637
2652
|
}
|
|
2638
|
-
/**
|
|
2639
|
-
async getEstimate(params) {
|
|
2640
|
-
return this.request("GET", "/subscriptions/estimate", {
|
|
2653
|
+
/** Estimate the cost of a subscription before creating it. `GET /subscriptions/estimate` */
|
|
2654
|
+
async getEstimate(params, options) {
|
|
2655
|
+
return this.request("GET", "/subscriptions/estimate", {
|
|
2656
|
+
query: params,
|
|
2657
|
+
...options
|
|
2658
|
+
});
|
|
2641
2659
|
}
|
|
2642
|
-
/**
|
|
2643
|
-
async getItems(params) {
|
|
2644
|
-
return this.request("GET", "/subscriptions/items", {
|
|
2660
|
+
/** List purchasable subscription items (plans/addons). `GET /subscriptions/items` */
|
|
2661
|
+
async getItems(params, options) {
|
|
2662
|
+
return this.request("GET", "/subscriptions/items", {
|
|
2663
|
+
query: params,
|
|
2664
|
+
...options
|
|
2665
|
+
});
|
|
2645
2666
|
}
|
|
2646
2667
|
/** Pause a subscription. `POST /subscriptions/{subscriptionId}/pause` */
|
|
2647
|
-
async pause(subscriptionId) {
|
|
2648
|
-
return this.request("POST", `/subscriptions/${encodeURIComponent(subscriptionId)}/pause
|
|
2668
|
+
async pause(subscriptionId, params, options) {
|
|
2669
|
+
return this.request("POST", `/subscriptions/${encodeURIComponent(subscriptionId)}/pause`, {
|
|
2670
|
+
body: params,
|
|
2671
|
+
...options
|
|
2672
|
+
});
|
|
2649
2673
|
}
|
|
2650
|
-
/** Resume a subscription. `POST /subscriptions/{subscriptionId}/resume` */
|
|
2651
|
-
async resume(subscriptionId) {
|
|
2652
|
-
return this.request("POST", `/subscriptions/${encodeURIComponent(subscriptionId)}/resume
|
|
2674
|
+
/** Resume a paused subscription. `POST /subscriptions/{subscriptionId}/resume` */
|
|
2675
|
+
async resume(subscriptionId, params, options) {
|
|
2676
|
+
return this.request("POST", `/subscriptions/${encodeURIComponent(subscriptionId)}/resume`, {
|
|
2677
|
+
body: params,
|
|
2678
|
+
...options
|
|
2679
|
+
});
|
|
2653
2680
|
}
|
|
2654
2681
|
/** Cancel a subscription. `POST /subscriptions/{subscriptionId}/cancel` */
|
|
2655
|
-
async cancel(subscriptionId) {
|
|
2656
|
-
return this.request("POST", `/subscriptions/${encodeURIComponent(subscriptionId)}/cancel
|
|
2682
|
+
async cancel(subscriptionId, params, options) {
|
|
2683
|
+
return this.request("POST", `/subscriptions/${encodeURIComponent(subscriptionId)}/cancel`, {
|
|
2684
|
+
body: params,
|
|
2685
|
+
...options
|
|
2686
|
+
});
|
|
2657
2687
|
}
|
|
2658
2688
|
};
|
|
2659
2689
|
|