@rechargeapps/storefront-client 0.12.0 → 0.14.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/cjs/api/customer.js +3 -2
- package/dist/cjs/api/customer.js.map +1 -1
- package/dist/cjs/api/membership.js.map +1 -1
- package/dist/cjs/api/paymentMethod.js +27 -0
- package/dist/cjs/api/paymentMethod.js.map +1 -0
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/customer.js +3 -2
- package/dist/esm/api/customer.js.map +1 -1
- package/dist/esm/api/membership.js.map +1 -1
- package/dist/esm/api/paymentMethod.js +21 -0
- package/dist/esm/api/paymentMethod.js.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +220 -122
- package/dist/umd/recharge-client.min.js +7 -7
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -960,6 +960,192 @@ interface CDNBundleSettings {
|
|
|
960
960
|
variants: CDNBundleVariant[];
|
|
961
961
|
}
|
|
962
962
|
|
|
963
|
+
interface PaymentDetails {
|
|
964
|
+
/** Payment_method brand or company powering it. valid for CREDIT_CARD only. */
|
|
965
|
+
brand?: string;
|
|
966
|
+
/** Payment_method expiry month. valid for CREDIT_CARD only. */
|
|
967
|
+
exp_month?: string;
|
|
968
|
+
/** Payment_method expiry year. valid for CREDIT_CARD only. */
|
|
969
|
+
exp_year?: string;
|
|
970
|
+
/** last 4-digits of the identifier. valid for CREDIT_CARD only. */
|
|
971
|
+
last4?: string;
|
|
972
|
+
/** email linked to paypal. valid for PAYPAL only. */
|
|
973
|
+
paypal_email?: string;
|
|
974
|
+
/** paypal user identifier. valid for PAYPAL only. */
|
|
975
|
+
paypal_payer_id?: string;
|
|
976
|
+
/** If a digital wallet. */
|
|
977
|
+
wallet_type?: string;
|
|
978
|
+
/** Type of funding for the Payment Method. */
|
|
979
|
+
funding_type?: string;
|
|
980
|
+
}
|
|
981
|
+
declare type PaymentType = 'CREDIT_CARD' | 'PAYPAL' | 'APPLE_PAY' | 'GOOGLE_PAY' | 'SEPA_DEBIT';
|
|
982
|
+
declare type ProcessorName = 'stripe' | 'braintree' | 'authorize' | 'shopify_payments' | 'mollie';
|
|
983
|
+
declare type PaymentMethodStatus = 'not_validated' | 'valid' | 'invalid';
|
|
984
|
+
interface PaymentMethod {
|
|
985
|
+
/** The unique payment method id for a customer. */
|
|
986
|
+
id: number;
|
|
987
|
+
/** An object with the customer’s address information. */
|
|
988
|
+
billing_address: AssociatedAddress;
|
|
989
|
+
/** The Recharge customer_id */
|
|
990
|
+
customer_id: number;
|
|
991
|
+
/** The time the payment method was created. */
|
|
992
|
+
created_at: IsoDateString;
|
|
993
|
+
/** If this is the default payment method for the customer */
|
|
994
|
+
default: boolean;
|
|
995
|
+
/** Details about the specific payment method */
|
|
996
|
+
payment_details: PaymentDetails;
|
|
997
|
+
/**
|
|
998
|
+
* The type of payment this is.
|
|
999
|
+
* If passed, must also be accompanied by one of stripe_customer_token, paypal_customer_token or authorizedotnet_customer_token in processor_payment_method_token.
|
|
1000
|
+
*/
|
|
1001
|
+
payment_type: PaymentType;
|
|
1002
|
+
/** The customer token at the processor. */
|
|
1003
|
+
processor_customer_token: string;
|
|
1004
|
+
/**
|
|
1005
|
+
* This will impact validation on billing_details.
|
|
1006
|
+
* Currently, shopify_payments is in read-only mode and can only be managed by Shopify.
|
|
1007
|
+
*/
|
|
1008
|
+
processor_name: ProcessorName;
|
|
1009
|
+
/** The payment token at the processor. */
|
|
1010
|
+
processor_payment_method_token: string;
|
|
1011
|
+
/** State of the Payment Method. */
|
|
1012
|
+
status: PaymentMethodStatus;
|
|
1013
|
+
/**
|
|
1014
|
+
* The status reason for the payment method.
|
|
1015
|
+
* Often used when invalid to provide background details in invalidity.
|
|
1016
|
+
*/
|
|
1017
|
+
status_reason: string;
|
|
1018
|
+
/** The time the payment method was last updated. */
|
|
1019
|
+
updated_at: IsoDateString;
|
|
1020
|
+
}
|
|
1021
|
+
interface PaymentMethodsResponse {
|
|
1022
|
+
next_cursor: null | string;
|
|
1023
|
+
previous_cursor: null | string;
|
|
1024
|
+
payment_methods: PaymentMethod[];
|
|
1025
|
+
}
|
|
1026
|
+
declare type PaymentMethodOptionalUpdateProps = 'billing_address' | 'default';
|
|
1027
|
+
declare type UpdatePaymentMethodRequest = Partial<Pick<PaymentMethod, PaymentMethodOptionalUpdateProps>>;
|
|
1028
|
+
/** no sorting options for payment_methods, always by id-desc */
|
|
1029
|
+
declare type PaymentMethodSortBy = null;
|
|
1030
|
+
interface PaymentMethodListParams extends ListParams<PaymentMethodSortBy> {
|
|
1031
|
+
customer_id?: string;
|
|
1032
|
+
processor_name?: ProcessorName;
|
|
1033
|
+
address_id?: string;
|
|
1034
|
+
processor_payment_method_token?: string;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
interface Subscription {
|
|
1038
|
+
/** Unique numeric identifier for the subscription. */
|
|
1039
|
+
id: number;
|
|
1040
|
+
/** Unique numeric identifier for the address the subscription is associated with. */
|
|
1041
|
+
address_id: number;
|
|
1042
|
+
/** Unique numeric identifier for the customer the subscription is tied to. */
|
|
1043
|
+
customer_id: number;
|
|
1044
|
+
/** An object used to contain analytics data such as utm parameters. */
|
|
1045
|
+
analytics_data: AnalyticsData;
|
|
1046
|
+
/** Reason provided for cancellation. */
|
|
1047
|
+
cancellation_reason: string | null;
|
|
1048
|
+
/** Additional comment for cancellation. */
|
|
1049
|
+
cancellation_reason_comments: string | null;
|
|
1050
|
+
/** The time the subscription was cancelled. */
|
|
1051
|
+
cancelled_at: string | null;
|
|
1052
|
+
/**
|
|
1053
|
+
* The number of units (specified in order_interval_unit) between each Charge. For example, order_interval_unit=month and charge_interval_frequency=3, indicate charge every 3 months.
|
|
1054
|
+
* Charges must use the same unit types as orders.
|
|
1055
|
+
* Max: 1000
|
|
1056
|
+
*/
|
|
1057
|
+
charge_interval_frequency: number;
|
|
1058
|
+
/** The time the subscription was created. */
|
|
1059
|
+
created_at: IsoDateString;
|
|
1060
|
+
/** Set the number of charges until subscription expires. */
|
|
1061
|
+
expire_after_specific_number_of_charges: number | null;
|
|
1062
|
+
/** An object containing the product id as it appears in external platforms. */
|
|
1063
|
+
external_product_id: ExternalId;
|
|
1064
|
+
/** An object containing the variant id as it appears in external platforms. */
|
|
1065
|
+
external_variant_id: ExternalId;
|
|
1066
|
+
/** Retrieves true if there is queued charge. Otherwise, retrieves false. */
|
|
1067
|
+
has_queued_charges: boolean;
|
|
1068
|
+
/** Value is set to true if it is a prepaid item. */
|
|
1069
|
+
is_prepaid: boolean;
|
|
1070
|
+
/** Value is set to true if it is not a prepaid item */
|
|
1071
|
+
is_skippable: boolean;
|
|
1072
|
+
/** Value is set to true if it is not a prepaid item and if in Customer portal settings swap is allowed for customers. */
|
|
1073
|
+
is_swappable: boolean;
|
|
1074
|
+
/** Retrieves true if charge has an error max retries reached. Otherwise, retrieves false. */
|
|
1075
|
+
max_retries_reached: boolean;
|
|
1076
|
+
/** Date of the next charge for the subscription. */
|
|
1077
|
+
next_charge_scheduled_at: IsoDateString;
|
|
1078
|
+
/**
|
|
1079
|
+
* The set day of the month order is created. Default is that there isn’t a strict day of the month when the order is created.
|
|
1080
|
+
* This is only applicable to subscriptions with order_interval_unit:“month”.
|
|
1081
|
+
*/
|
|
1082
|
+
order_day_of_month: number | null;
|
|
1083
|
+
/**
|
|
1084
|
+
* The set day of the week order is created. Default is that there isn’t a strict day of the week order is created.
|
|
1085
|
+
* This is only applicable to subscriptions with order_interval_unit = “week”.
|
|
1086
|
+
* Value of 0 equals to Monday, 1 to Tuesday etc.
|
|
1087
|
+
*/
|
|
1088
|
+
order_day_of_week: number | null;
|
|
1089
|
+
/**
|
|
1090
|
+
* The number of units (specified in order_interval_unit) between each order. For example, order_interval_unit=month and order_interval_frequency=3, indicate order every 3 months. Max value: 1000
|
|
1091
|
+
*/
|
|
1092
|
+
order_interval_frequency: number;
|
|
1093
|
+
/** The frequency unit used to determine when a subscription’s order is created. */
|
|
1094
|
+
order_interval_unit: 'day' | 'week' | 'month';
|
|
1095
|
+
/** The presentment currency of the subscription. */
|
|
1096
|
+
presentment_currency: string | null;
|
|
1097
|
+
/** The price of the item before discounts, taxes, or shipping have been applied. */
|
|
1098
|
+
price: string;
|
|
1099
|
+
/** The name of the product in a store’s catalog. */
|
|
1100
|
+
product_title: string | null;
|
|
1101
|
+
/** A list of line item objects, each one containing information about the subscription. Custom key-value pairs can be installed here, they will appear on the connected queued charge and after it is processed on the order itself. */
|
|
1102
|
+
properties: Property[];
|
|
1103
|
+
/** The number of items in the subscription. */
|
|
1104
|
+
quantity: number;
|
|
1105
|
+
/** A unique identifier of the item in the fulfillment. In cases where SKU is blank, it will be dynamically pulled whenever it is used. */
|
|
1106
|
+
sku: string | null;
|
|
1107
|
+
/** Flag that is automatically updated to true when SKU is passed on create or update. When sku_override is true, the SKU on the subscription will be used to generate charges and orders. When sku_override is false, Recharge will dynamically fetch the SKU from the corresponding external platform variant. */
|
|
1108
|
+
sku_override: boolean;
|
|
1109
|
+
/**
|
|
1110
|
+
* The status of the subscription.
|
|
1111
|
+
* expired - This status occurs when the maximum number of charges for a product has been reached.
|
|
1112
|
+
*/
|
|
1113
|
+
status: 'active' | 'cancelled' | 'expired';
|
|
1114
|
+
/** The date time at which the purchase_item record was last updated. */
|
|
1115
|
+
updated_at: IsoDateString;
|
|
1116
|
+
/** The name of the variant in a shop’s catalog. */
|
|
1117
|
+
variant_title: string;
|
|
1118
|
+
}
|
|
1119
|
+
interface SubscriptionsResponse {
|
|
1120
|
+
next_cursor: null | string;
|
|
1121
|
+
previous_cursor: null | string;
|
|
1122
|
+
subscriptions: Subscription[];
|
|
1123
|
+
}
|
|
1124
|
+
declare type SubscriptionSortBy = 'id-asc' | 'id-desc' | 'created_at-asc' | 'created_at-desc' | 'updated_at-asc' | 'updated_at-desc';
|
|
1125
|
+
interface SubscriptionListParams extends ListParams<SubscriptionSortBy> {
|
|
1126
|
+
created_at_min?: IsoDateString;
|
|
1127
|
+
created_at_max?: IsoDateString;
|
|
1128
|
+
customer_id?: string;
|
|
1129
|
+
}
|
|
1130
|
+
declare type SubscriptionRequiredCreateProps = 'address_id' | 'charge_interval_frequency' | 'external_variant_id' | 'next_charge_scheduled_at' | 'order_interval_frequency' | 'order_interval_unit' | 'quantity';
|
|
1131
|
+
declare type SubscriptionOptionalCreateProps = 'expire_after_specific_number_of_charges' | 'order_day_of_month' | 'order_day_of_week' | 'external_product_id' | 'product_title' | 'properties' | 'status';
|
|
1132
|
+
declare type CreateSubscriptionRequest = SubType<Subscription, SubscriptionRequiredCreateProps, SubscriptionOptionalCreateProps>;
|
|
1133
|
+
declare type SubscriptionOptionalUpdateProps = 'charge_interval_frequency' | 'expire_after_specific_number_of_charges' | 'order_day_of_month' | 'order_day_of_week' | 'order_interval_frequency' | 'order_interval_unit' | 'quantity' | 'external_product_id' | 'external_variant_id' | 'properties' | 'sku' | 'sku_override';
|
|
1134
|
+
declare type UpdateSubscriptionRequest = Partial<Pick<Subscription, SubscriptionOptionalUpdateProps>>;
|
|
1135
|
+
interface UpdateSubscriptionParams {
|
|
1136
|
+
/** Controls whether the QUEUED charges linked to the subscription should be regenerated upon subscription update. By default the flag is set to false which will delay charge regeneration 5 seconds. This enables running multiple calls to perform changes and receive responses much faster since the API won’t wait for a charge regeneration to complete. Setting this parameter to true will cause charge regeneration to complete before returning a response. */
|
|
1137
|
+
commit?: boolean;
|
|
1138
|
+
}
|
|
1139
|
+
interface CancelSubscriptionRequest {
|
|
1140
|
+
cancellation_reason: string;
|
|
1141
|
+
cancellation_reason_comments?: string;
|
|
1142
|
+
send_email?: boolean;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
declare type CustomerIncludes = 'addresses' | 'payment_methods' | 'subscriptions';
|
|
1146
|
+
interface GetCustomerOptions {
|
|
1147
|
+
include: CustomerIncludes[];
|
|
1148
|
+
}
|
|
963
1149
|
interface Customer {
|
|
964
1150
|
/** Unique numeric identifier for the Customer. */
|
|
965
1151
|
id: number;
|
|
@@ -989,9 +1175,15 @@ interface Customer {
|
|
|
989
1175
|
subscriptions_total_count: number;
|
|
990
1176
|
/** The date and time when the customer was last updated. */
|
|
991
1177
|
updated_at: IsoDateString;
|
|
1178
|
+
/** Additional information as requested */
|
|
1179
|
+
include?: {
|
|
1180
|
+
addresses?: Address[];
|
|
1181
|
+
payment_methods?: PaymentMethod[];
|
|
1182
|
+
subscriptions?: Subscription[];
|
|
1183
|
+
};
|
|
992
1184
|
}
|
|
993
|
-
declare type
|
|
994
|
-
declare type UpdateCustomerRequest = Partial<Pick<Customer,
|
|
1185
|
+
declare type CustomerOptionalUpdateProps = 'email' | 'first_name' | 'last_name' | 'external_customer_id';
|
|
1186
|
+
declare type UpdateCustomerRequest = Partial<Pick<Customer, CustomerOptionalUpdateProps>>;
|
|
995
1187
|
interface CustomerDeliveryScheduleParams {
|
|
996
1188
|
delivery_count_future?: number;
|
|
997
1189
|
future_internal?: number;
|
|
@@ -1011,7 +1203,9 @@ interface CustomerDeliveryScheduleResponse {
|
|
|
1011
1203
|
deliveries: Delivery[];
|
|
1012
1204
|
}
|
|
1013
1205
|
|
|
1206
|
+
/** @internal */
|
|
1014
1207
|
declare type MembershipStatus = 'active' | 'inactive';
|
|
1208
|
+
/** @internal */
|
|
1015
1209
|
interface Membership {
|
|
1016
1210
|
id: string;
|
|
1017
1211
|
store_id: number;
|
|
@@ -1025,17 +1219,23 @@ interface Membership {
|
|
|
1025
1219
|
subscription_cancelled_at: IsoDateString | null;
|
|
1026
1220
|
image?: string;
|
|
1027
1221
|
}
|
|
1222
|
+
/** @internal */
|
|
1028
1223
|
interface MembershipResponse {
|
|
1029
1224
|
membership: Membership;
|
|
1030
1225
|
}
|
|
1226
|
+
/** @internal */
|
|
1031
1227
|
interface MembershipListResponse {
|
|
1032
1228
|
next_cursor: null | string;
|
|
1033
1229
|
previous_cursor: null | string;
|
|
1034
1230
|
memberships: Membership[];
|
|
1035
1231
|
}
|
|
1232
|
+
/** @internal */
|
|
1036
1233
|
declare type MembershipsSortBy = 'id-asc' | 'id-desc';
|
|
1234
|
+
/** @internal */
|
|
1037
1235
|
declare type membershipIncludes = 'customer' | 'subscriptions';
|
|
1236
|
+
/** @internal */
|
|
1038
1237
|
declare type MembershipIncludes = `${membershipIncludes}` | `${membershipIncludes},${membershipIncludes}`;
|
|
1238
|
+
/** @internal */
|
|
1039
1239
|
interface MembershipListParams extends ListParams<MembershipsSortBy> {
|
|
1040
1240
|
include?: MembershipIncludes;
|
|
1041
1241
|
customer_id?: number;
|
|
@@ -1050,9 +1250,11 @@ interface MembershipListParams extends ListParams<MembershipsSortBy> {
|
|
|
1050
1250
|
include_cancelled?: boolean;
|
|
1051
1251
|
include_deleted?: boolean;
|
|
1052
1252
|
}
|
|
1253
|
+
/** @internal */
|
|
1053
1254
|
interface ActivateMembershipRequest {
|
|
1054
1255
|
expires_at: string | null;
|
|
1055
1256
|
}
|
|
1257
|
+
/** @internal */
|
|
1056
1258
|
interface CancelMembershipRequest {
|
|
1057
1259
|
cancel_immediately: boolean;
|
|
1058
1260
|
cancellation_reason: string;
|
|
@@ -1099,15 +1301,15 @@ interface Onetime {
|
|
|
1099
1301
|
/** Presentment currency */
|
|
1100
1302
|
presentment_currency: string | null;
|
|
1101
1303
|
}
|
|
1102
|
-
declare type
|
|
1103
|
-
declare type
|
|
1104
|
-
interface
|
|
1304
|
+
declare type OnetimeRequiredCreateProps = 'address_id' | 'external_variant_id' | 'next_charge_scheduled_at' | 'product_title' | 'quantity';
|
|
1305
|
+
declare type OnetimeOptionalCreateProps = 'external_product_id' | 'properties' | 'sku';
|
|
1306
|
+
interface OnetimeCreateProps {
|
|
1105
1307
|
/** Instructs to add the Onetime to the next charge scheduled under this Address. */
|
|
1106
1308
|
add_to_next_charge?: boolean;
|
|
1107
1309
|
}
|
|
1108
|
-
declare type CreateOnetimeRequest = SubType<Onetime,
|
|
1109
|
-
declare type
|
|
1110
|
-
declare type UpdateOnetimeRequest = Partial<Pick<Onetime,
|
|
1310
|
+
declare type CreateOnetimeRequest = SubType<Onetime, OnetimeRequiredCreateProps, OnetimeOptionalCreateProps> & OnetimeCreateProps;
|
|
1311
|
+
declare type OnetimeOptionalUpdateProps = 'address_id' | 'next_charge_scheduled_at' | 'properties' | 'quantity' | 'external_variant_id' | 'sku';
|
|
1312
|
+
declare type UpdateOnetimeRequest = Partial<Pick<Onetime, OnetimeOptionalUpdateProps>>;
|
|
1111
1313
|
interface OnetimesResponse {
|
|
1112
1314
|
next_cursor: null | string;
|
|
1113
1315
|
previous_cursor: null | string;
|
|
@@ -1196,114 +1398,6 @@ interface PlanListParams extends ListParams<PlanSortBy> {
|
|
|
1196
1398
|
type?: PlanType;
|
|
1197
1399
|
}
|
|
1198
1400
|
|
|
1199
|
-
interface Subscription {
|
|
1200
|
-
/** Unique numeric identifier for the subscription. */
|
|
1201
|
-
id: number;
|
|
1202
|
-
/** Unique numeric identifier for the address the subscription is associated with. */
|
|
1203
|
-
address_id: number;
|
|
1204
|
-
/** Unique numeric identifier for the customer the subscription is tied to. */
|
|
1205
|
-
customer_id: number;
|
|
1206
|
-
/** An object used to contain analytics data such as utm parameters. */
|
|
1207
|
-
analytics_data: AnalyticsData;
|
|
1208
|
-
/** Reason provided for cancellation. */
|
|
1209
|
-
cancellation_reason: string | null;
|
|
1210
|
-
/** Additional comment for cancellation. */
|
|
1211
|
-
cancellation_reason_comments: string | null;
|
|
1212
|
-
/** The time the subscription was cancelled. */
|
|
1213
|
-
cancelled_at: string | null;
|
|
1214
|
-
/**
|
|
1215
|
-
* The number of units (specified in order_interval_unit) between each Charge. For example, order_interval_unit=month and charge_interval_frequency=3, indicate charge every 3 months.
|
|
1216
|
-
* Charges must use the same unit types as orders.
|
|
1217
|
-
* Max: 1000
|
|
1218
|
-
*/
|
|
1219
|
-
charge_interval_frequency: number;
|
|
1220
|
-
/** The time the subscription was created. */
|
|
1221
|
-
created_at: IsoDateString;
|
|
1222
|
-
/** Set the number of charges until subscription expires. */
|
|
1223
|
-
expire_after_specific_number_of_charges: number | null;
|
|
1224
|
-
/** An object containing the product id as it appears in external platforms. */
|
|
1225
|
-
external_product_id: ExternalId;
|
|
1226
|
-
/** An object containing the variant id as it appears in external platforms. */
|
|
1227
|
-
external_variant_id: ExternalId;
|
|
1228
|
-
/** Retrieves true if there is queued charge. Otherwise, retrieves false. */
|
|
1229
|
-
has_queued_charges: boolean;
|
|
1230
|
-
/** Value is set to true if it is a prepaid item. */
|
|
1231
|
-
is_prepaid: boolean;
|
|
1232
|
-
/** Value is set to true if it is not a prepaid item */
|
|
1233
|
-
is_skippable: boolean;
|
|
1234
|
-
/** Value is set to true if it is not a prepaid item and if in Customer portal settings swap is allowed for customers. */
|
|
1235
|
-
is_swappable: boolean;
|
|
1236
|
-
/** Retrieves true if charge has an error max retries reached. Otherwise, retrieves false. */
|
|
1237
|
-
max_retries_reached: boolean;
|
|
1238
|
-
/** Date of the next charge for the subscription. */
|
|
1239
|
-
next_charge_scheduled_at: IsoDateString;
|
|
1240
|
-
/**
|
|
1241
|
-
* The set day of the month order is created. Default is that there isn’t a strict day of the month when the order is created.
|
|
1242
|
-
* This is only applicable to subscriptions with order_interval_unit:“month”.
|
|
1243
|
-
*/
|
|
1244
|
-
order_day_of_month: number | null;
|
|
1245
|
-
/**
|
|
1246
|
-
* The set day of the week order is created. Default is that there isn’t a strict day of the week order is created.
|
|
1247
|
-
* This is only applicable to subscriptions with order_interval_unit = “week”.
|
|
1248
|
-
* Value of 0 equals to Monday, 1 to Tuesday etc.
|
|
1249
|
-
*/
|
|
1250
|
-
order_day_of_week: number | null;
|
|
1251
|
-
/**
|
|
1252
|
-
* The number of units (specified in order_interval_unit) between each order. For example, order_interval_unit=month and order_interval_frequency=3, indicate order every 3 months. Max value: 1000
|
|
1253
|
-
*/
|
|
1254
|
-
order_interval_frequency: number;
|
|
1255
|
-
/** The frequency unit used to determine when a subscription’s order is created. */
|
|
1256
|
-
order_interval_unit: 'day' | 'week' | 'month';
|
|
1257
|
-
/** The presentment currency of the subscription. */
|
|
1258
|
-
presentment_currency: string | null;
|
|
1259
|
-
/** The price of the item before discounts, taxes, or shipping have been applied. */
|
|
1260
|
-
price: string;
|
|
1261
|
-
/** The name of the product in a store’s catalog. */
|
|
1262
|
-
product_title: string | null;
|
|
1263
|
-
/** A list of line item objects, each one containing information about the subscription. Custom key-value pairs can be installed here, they will appear on the connected queued charge and after it is processed on the order itself. */
|
|
1264
|
-
properties: Property[];
|
|
1265
|
-
/** The number of items in the subscription. */
|
|
1266
|
-
quantity: number;
|
|
1267
|
-
/** A unique identifier of the item in the fulfillment. In cases where SKU is blank, it will be dynamically pulled whenever it is used. */
|
|
1268
|
-
sku: string | null;
|
|
1269
|
-
/** Flag that is automatically updated to true when SKU is passed on create or update. When sku_override is true, the SKU on the subscription will be used to generate charges and orders. When sku_override is false, Recharge will dynamically fetch the SKU from the corresponding external platform variant. */
|
|
1270
|
-
sku_override: boolean;
|
|
1271
|
-
/**
|
|
1272
|
-
* The status of the subscription.
|
|
1273
|
-
* expired - This status occurs when the maximum number of charges for a product has been reached.
|
|
1274
|
-
*/
|
|
1275
|
-
status: 'active' | 'cancelled' | 'expired';
|
|
1276
|
-
/** The date time at which the purchase_item record was last updated. */
|
|
1277
|
-
updated_at: IsoDateString;
|
|
1278
|
-
/** The name of the variant in a shop’s catalog. */
|
|
1279
|
-
variant_title: string;
|
|
1280
|
-
}
|
|
1281
|
-
interface SubscriptionsResponse {
|
|
1282
|
-
next_cursor: null | string;
|
|
1283
|
-
previous_cursor: null | string;
|
|
1284
|
-
subscriptions: Subscription[];
|
|
1285
|
-
}
|
|
1286
|
-
declare type SubscriptionSortBy = 'id-asc' | 'id-desc' | 'created_at-asc' | 'created_at-desc' | 'updated_at-asc' | 'updated_at-desc';
|
|
1287
|
-
interface SubscriptionListParams extends ListParams<SubscriptionSortBy> {
|
|
1288
|
-
created_at_min?: IsoDateString;
|
|
1289
|
-
created_at_max?: IsoDateString;
|
|
1290
|
-
customer_id?: string;
|
|
1291
|
-
}
|
|
1292
|
-
declare type RequiredCreateProps = 'address_id' | 'charge_interval_frequency' | 'external_variant_id' | 'next_charge_scheduled_at' | 'order_interval_frequency' | 'order_interval_unit' | 'quantity';
|
|
1293
|
-
declare type OptionalCreateProps = 'expire_after_specific_number_of_charges' | 'order_day_of_month' | 'order_day_of_week' | 'external_product_id' | 'product_title' | 'properties' | 'status';
|
|
1294
|
-
declare type CreateSubscriptionRequest = SubType<Subscription, RequiredCreateProps, OptionalCreateProps>;
|
|
1295
|
-
declare type OptionalUpdateProps = 'charge_interval_frequency' | 'expire_after_specific_number_of_charges' | 'order_day_of_month' | 'order_day_of_week' | 'order_interval_frequency' | 'order_interval_unit' | 'quantity' | 'external_product_id' | 'external_variant_id' | 'properties' | 'sku' | 'sku_override';
|
|
1296
|
-
declare type UpdateSubscriptionRequest = Partial<Pick<Subscription, OptionalUpdateProps>>;
|
|
1297
|
-
interface UpdateSubscriptionParams {
|
|
1298
|
-
/** Controls whether the QUEUED charges linked to the subscription should be regenerated upon subscription update. By default the flag is set to false which will delay charge regeneration 5 seconds. This enables running multiple calls to perform changes and receive responses much faster since the API won’t wait for a charge regeneration to complete. Setting this parameter to true will cause charge regeneration to complete before returning a response. */
|
|
1299
|
-
commit?: boolean;
|
|
1300
|
-
}
|
|
1301
|
-
interface CancelSubscriptionRequest {
|
|
1302
|
-
cancellation_reason: string;
|
|
1303
|
-
cancellation_reason_comments?: string;
|
|
1304
|
-
send_email?: boolean;
|
|
1305
|
-
}
|
|
1306
|
-
|
|
1307
1401
|
declare function getCDNProduct(externalProductId: string | number): Promise<CDNProduct>;
|
|
1308
1402
|
declare function getCDNStoreSettings(): Promise<CDNStoreSettings>;
|
|
1309
1403
|
declare function getCDNWidgetSettings(): Promise<CDNWidgetSettings>;
|
|
@@ -1316,13 +1410,13 @@ declare function resetCDNCache(): Promise<void>;
|
|
|
1316
1410
|
declare function getBundleId(bundle: Bundle): Promise<string>;
|
|
1317
1411
|
declare function validateBundle(bundle: Bundle): Promise<boolean>;
|
|
1318
1412
|
|
|
1319
|
-
/** Retrieves membership information for passed in id */
|
|
1413
|
+
/** @internal Retrieves membership information for passed in id */
|
|
1320
1414
|
declare function getMembership(session: Session, id: string | number): Promise<Membership>;
|
|
1321
|
-
/** Retrieves a list of memberships */
|
|
1415
|
+
/** @internal Retrieves a list of memberships */
|
|
1322
1416
|
declare function listMemberships(session: Session, query?: MembershipListParams): Promise<MembershipListResponse>;
|
|
1323
|
-
/** Cancels a membership */
|
|
1417
|
+
/** @internal Cancels a membership */
|
|
1324
1418
|
declare function cancelMembership(session: Session, id: string | number, cancelRequest: CancelMembershipRequest): Promise<Membership>;
|
|
1325
|
-
/** Activates a membership */
|
|
1419
|
+
/** @internal Activates a membership */
|
|
1326
1420
|
declare function activateMembership(session: Session, id: string | number, activateRequest: ActivateMembershipRequest): Promise<Membership>;
|
|
1327
1421
|
|
|
1328
1422
|
declare function getOnetime(session: Session, id: string | number): Promise<Onetime>;
|
|
@@ -1334,6 +1428,10 @@ declare function deleteOnetime(session: Session, id: string | number): Promise<v
|
|
|
1334
1428
|
declare function getOrder(session: Session, id: string | number): Promise<Order>;
|
|
1335
1429
|
declare function listOrders(session: Session, query?: OrderListParams): Promise<OrdersResponse>;
|
|
1336
1430
|
|
|
1431
|
+
declare function getPaymentMethod(session: Session, id: string | number): Promise<PaymentMethod>;
|
|
1432
|
+
declare function updatePaymentMethod(session: Session, id: string | number, updateRequest: UpdatePaymentMethodRequest): Promise<PaymentMethod>;
|
|
1433
|
+
declare function listPaymentMethods(session: Session, query?: PaymentMethodListParams): Promise<PaymentMethodsResponse>;
|
|
1434
|
+
|
|
1337
1435
|
declare function getPlan(session: Session, id: string | number): Promise<Plan>;
|
|
1338
1436
|
declare function listPlans(session: Session, query?: PlanListParams): Promise<PlansResponse>;
|
|
1339
1437
|
|
|
@@ -1372,7 +1470,7 @@ declare function cancelSubscription(session: Session, id: string | number, cance
|
|
|
1372
1470
|
declare function activateSubscription(session: Session, id: string | number): Promise<Subscription>;
|
|
1373
1471
|
declare function skipSubscriptionCharge(session: Session, id: number | string, date: IsoDateString): Promise<Charge>;
|
|
1374
1472
|
|
|
1375
|
-
declare function getCustomer(session: Session): Promise<Customer>;
|
|
1473
|
+
declare function getCustomer(session: Session, options?: GetCustomerOptions): Promise<Customer>;
|
|
1376
1474
|
declare function updateCustomer(session: Session, updateRequest: UpdateCustomerRequest): Promise<Customer>;
|
|
1377
1475
|
declare function getDeliverySchedule(session: Session, query?: CustomerDeliveryScheduleParams): Promise<Delivery[]>;
|
|
1378
1476
|
|
|
@@ -1384,4 +1482,4 @@ declare const api: {
|
|
|
1384
1482
|
};
|
|
1385
1483
|
declare function initRecharge(opt?: InitOptions): void;
|
|
1386
1484
|
|
|
1387
|
-
export { ActivateMembershipRequest, Address, AddressListParams, AddressListResponse, AddressResponse, AddressSortBy, AnalyticsData, ApplyDiscountRequest, AssociatedAddress, Bundle, BundleSelection, BundleTranslations, CDNBaseWidgetSettings, CDNBundleLayoutSettings, CDNBundleSettings, CDNBundleStep, CDNBundleStepOption, CDNBundleVariant, CDNBundleVariantOptionSource, CDNBundleVariantSelectionDefault, CDNPrices, CDNProduct, CDNProductAndSettings, CDNProductKeyObject, CDNProductOption, CDNProductOptionValue, CDNProductRaw, CDNProductResource, CDNProductsAndSettings, CDNProductsAndSettingsResource, CDNSellingPlan, CDNSellingPlanAllocations, CDNSellingPlanGroup, CDNStoreSettings, CDNSubscriptionOption, CDNVariant, CDNVariantOptionValue, CDNWidgetSettings, CDNWidgetSettingsRaw, CDNWidgetSettingsResource, CRUDRequestOptions, CancelMembershipRequest, CancelSubscriptionRequest, ChannelSettings, Charge, ChargeListParams, ChargeListResponse, ChargeResponse, ChargeSortBy, ChargeStatus, ColorString, CreateAddressRequest, CreateOnetimeRequest, CreateSubscriptionRequest, Customer, CustomerDeliveryScheduleParams, CustomerDeliveryScheduleResponse, Delivery, Discount, ExternalId, ExternalTransactionId, FirstOption, GetRequestOptions, HTMLString, InitOptions, IntervalUnit, IsoDateString, LineItem, ListParams, LoginResponse, Membership, MembershipListParams, MembershipListResponse, MembershipResponse, MembershipStatus, MembershipsSortBy, MergeAddressesRequest, Method, Onetime, OnetimeListParams, OnetimesResponse, OnetimesSortBy, Order, OrderListParams, OrderSortBy, OrderStatus, OrderType, OrdersResponse, Plan, PlanListParams, PlanSortBy, PlanType, PlansResponse, PriceAdjustmentsType, ProductImage, Property, Request, RequestHeaders, RequestOptions, RequestOptionsHeaders, Session, ShippingLine, SkipFutureChargeAddressRequest, SkipFutureChargeAddressResponse, StorefrontEnvironment, StorefrontOptions, StorefrontPurchaseOption, SubType, Subscription, SubscriptionListParams, SubscriptionPreferences, SubscriptionSortBy, SubscriptionsResponse, TaxLine, Translations, UpdateAddressRequest, UpdateCustomerRequest, UpdateOnetimeRequest, UpdateSubscriptionParams, UpdateSubscriptionRequest, WidgetIconColor, WidgetTemplateType, activateMembership, activateSubscription, api, applyDiscount, cancelMembership, cancelSubscription, createAddress, createOnetime, createSubscription, deleteAddress, deleteOnetime, getAddress, getBundleId, getCDNBundleSettings, getCDNProduct, getCDNProductAndSettings, getCDNProducts, getCDNProductsAndSettings, getCDNStoreSettings, getCDNWidgetSettings, getCharge, getCustomer, getDeliverySchedule, getMembership, getOnetime, getOrder, getPlan, getSubscription, initRecharge, listAddresses, listCharges, listMemberships, listOnetimes, listOrders, listPlans, listSubscriptions, loginShopifyApi, loginShopifyAppProxy, mergeAddresses, removeDiscount, resetCDNCache, skipCharge, skipFutureCharge, skipSubscriptionCharge, unskipCharge, updateAddress, updateCustomer, updateOnetime, updateSubscription, updateSubscriptionAddress, updateSubscriptionChargeDate, validateBundle };
|
|
1485
|
+
export { ActivateMembershipRequest, Address, AddressListParams, AddressListResponse, AddressResponse, AddressSortBy, AnalyticsData, ApplyDiscountRequest, AssociatedAddress, Bundle, BundleSelection, BundleTranslations, CDNBaseWidgetSettings, CDNBundleLayoutSettings, CDNBundleSettings, CDNBundleStep, CDNBundleStepOption, CDNBundleVariant, CDNBundleVariantOptionSource, CDNBundleVariantSelectionDefault, CDNPrices, CDNProduct, CDNProductAndSettings, CDNProductKeyObject, CDNProductOption, CDNProductOptionValue, CDNProductRaw, CDNProductResource, CDNProductsAndSettings, CDNProductsAndSettingsResource, CDNSellingPlan, CDNSellingPlanAllocations, CDNSellingPlanGroup, CDNStoreSettings, CDNSubscriptionOption, CDNVariant, CDNVariantOptionValue, CDNWidgetSettings, CDNWidgetSettingsRaw, CDNWidgetSettingsResource, CRUDRequestOptions, CancelMembershipRequest, CancelSubscriptionRequest, ChannelSettings, Charge, ChargeListParams, ChargeListResponse, ChargeResponse, ChargeSortBy, ChargeStatus, ColorString, CreateAddressRequest, CreateOnetimeRequest, CreateSubscriptionRequest, Customer, CustomerDeliveryScheduleParams, CustomerDeliveryScheduleResponse, CustomerIncludes, CustomerOptionalUpdateProps, Delivery, Discount, ExternalId, ExternalTransactionId, FirstOption, GetCustomerOptions, GetRequestOptions, HTMLString, InitOptions, IntervalUnit, IsoDateString, LineItem, ListParams, LoginResponse, Membership, MembershipIncludes, MembershipListParams, MembershipListResponse, MembershipResponse, MembershipStatus, MembershipsSortBy, MergeAddressesRequest, Method, Onetime, OnetimeCreateProps, OnetimeListParams, OnetimeOptionalCreateProps, OnetimeOptionalUpdateProps, OnetimeRequiredCreateProps, OnetimesResponse, OnetimesSortBy, Order, OrderListParams, OrderSortBy, OrderStatus, OrderType, OrdersResponse, PaymentDetails, PaymentMethod, PaymentMethodListParams, PaymentMethodOptionalUpdateProps, PaymentMethodSortBy, PaymentMethodStatus, PaymentMethodsResponse, PaymentType, Plan, PlanListParams, PlanSortBy, PlanType, PlansResponse, PriceAdjustmentsType, ProcessorName, ProductImage, Property, Request, RequestHeaders, RequestOptions, RequestOptionsHeaders, Session, ShippingLine, SkipFutureChargeAddressRequest, SkipFutureChargeAddressResponse, StorefrontEnvironment, StorefrontOptions, StorefrontPurchaseOption, SubType, Subscription, SubscriptionListParams, SubscriptionOptionalCreateProps, SubscriptionOptionalUpdateProps, SubscriptionPreferences, SubscriptionRequiredCreateProps, SubscriptionSortBy, SubscriptionsResponse, TaxLine, Translations, UpdateAddressRequest, UpdateCustomerRequest, UpdateOnetimeRequest, UpdatePaymentMethodRequest, UpdateSubscriptionParams, UpdateSubscriptionRequest, WidgetIconColor, WidgetTemplateType, activateMembership, activateSubscription, api, applyDiscount, cancelMembership, cancelSubscription, createAddress, createOnetime, createSubscription, deleteAddress, deleteOnetime, getAddress, getBundleId, getCDNBundleSettings, getCDNProduct, getCDNProductAndSettings, getCDNProducts, getCDNProductsAndSettings, getCDNStoreSettings, getCDNWidgetSettings, getCharge, getCustomer, getDeliverySchedule, getMembership, getOnetime, getOrder, getPaymentMethod, getPlan, getSubscription, initRecharge, listAddresses, listCharges, listMemberships, listOnetimes, listOrders, listPaymentMethods, listPlans, listSubscriptions, loginShopifyApi, loginShopifyAppProxy, membershipIncludes, mergeAddresses, removeDiscount, resetCDNCache, skipCharge, skipFutureCharge, skipSubscriptionCharge, unskipCharge, updateAddress, updateCustomer, updateOnetime, updatePaymentMethod, updateSubscription, updateSubscriptionAddress, updateSubscriptionChargeDate, validateBundle };
|