@rechargeapps/storefront-client 0.11.0 → 0.13.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/auth.js +1 -1
- package/dist/cjs/api/auth.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/auth.js +1 -1
- package/dist/esm/api/auth.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 +92 -14
- package/dist/umd/recharge-client.min.js +7 -7
- package/package.json +1 -1
package/dist/cjs/api/auth.js
CHANGED
|
@@ -18,7 +18,7 @@ async function loginShopifyAppProxy() {
|
|
|
18
18
|
async function loginShopifyApi(customerAccessToken, storefrontAccessToken) {
|
|
19
19
|
const { environment, storeIdentifier } = options.getOptions();
|
|
20
20
|
const rechargeBaseUrl = api.RECHARGE_ADMIN_URL(environment);
|
|
21
|
-
const response = await request.request("post", `${rechargeBaseUrl}/
|
|
21
|
+
const response = await request.request("post", `${rechargeBaseUrl}/shopify_storefront_access`, {
|
|
22
22
|
data: {
|
|
23
23
|
customer_token: customerAccessToken,
|
|
24
24
|
storefront_token: storefrontAccessToken,
|
package/dist/cjs/api/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sources":["../../../src/api/auth.ts"],"sourcesContent":["import { request as baseRequest, shopifyAppProxyRequest } from '../utils/request';\nimport { LoginResponse } from '../types/auth';\nimport { getOptions } from '../utils/options';\nimport { RECHARGE_ADMIN_URL } from '../constants/api';\nimport { Session } from '../types/session';\nimport { RequestHeaders } from '../types';\n\nexport async function loginShopifyAppProxy(): Promise<Session> {\n const { storefrontAccessToken } = getOptions();\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await shopifyAppProxyRequest<LoginResponse>('get', '/access', { headers });\n\n return { apiToken: response.api_token, customerId: response.customer_id };\n}\n\nexport async function loginShopifyApi(\n customerAccessToken: string,\n storefrontAccessToken: string\n): Promise<Session | null> {\n const { environment, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment);\n const response = await baseRequest<LoginResponse>('post', `${rechargeBaseUrl}/
|
|
1
|
+
{"version":3,"file":"auth.js","sources":["../../../src/api/auth.ts"],"sourcesContent":["import { request as baseRequest, shopifyAppProxyRequest } from '../utils/request';\nimport { LoginResponse } from '../types/auth';\nimport { getOptions } from '../utils/options';\nimport { RECHARGE_ADMIN_URL } from '../constants/api';\nimport { Session } from '../types/session';\nimport { RequestHeaders } from '../types';\n\nexport async function loginShopifyAppProxy(): Promise<Session> {\n const { storefrontAccessToken } = getOptions();\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await shopifyAppProxyRequest<LoginResponse>('get', '/access', { headers });\n\n return { apiToken: response.api_token, customerId: response.customer_id };\n}\n\nexport async function loginShopifyApi(\n customerAccessToken: string,\n storefrontAccessToken: string\n): Promise<Session | null> {\n const { environment, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment);\n const response = await baseRequest<LoginResponse>('post', `${rechargeBaseUrl}/shopify_storefront_access`, {\n data: {\n customer_token: customerAccessToken,\n storefront_token: storefrontAccessToken,\n shop_url: storeIdentifier,\n },\n headers: {\n 'X-Recharge-App': 'storefront-client',\n },\n });\n\n return response.api_token ? { apiToken: response.api_token, customerId: response.customer_id } : null;\n}\n"],"names":["getOptions","shopifyAppProxyRequest","RECHARGE_ADMIN_URL","baseRequest"],"mappings":";;;;;;;;AAGO,eAAe,oBAAoB,GAAG;AAC7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
|
5
|
+
var request = require('../utils/request.js');
|
|
6
|
+
|
|
7
|
+
async function getPaymentMethod(session, id) {
|
|
8
|
+
const { payment_method } = await request.rechargeApiRequest("get", `/payment_methods`, {
|
|
9
|
+
id
|
|
10
|
+
}, session);
|
|
11
|
+
return payment_method;
|
|
12
|
+
}
|
|
13
|
+
async function updatePaymentMethod(session, id, updateRequest) {
|
|
14
|
+
const { payment_method } = await request.rechargeApiRequest("put", `/payment_methods`, {
|
|
15
|
+
id,
|
|
16
|
+
data: updateRequest
|
|
17
|
+
}, session);
|
|
18
|
+
return payment_method;
|
|
19
|
+
}
|
|
20
|
+
function listPaymentMethods(session, query) {
|
|
21
|
+
return request.rechargeApiRequest("get", `/payment_methods`, { query }, session);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.getPaymentMethod = getPaymentMethod;
|
|
25
|
+
exports.listPaymentMethods = listPaymentMethods;
|
|
26
|
+
exports.updatePaymentMethod = updatePaymentMethod;
|
|
27
|
+
//# sourceMappingURL=paymentMethod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paymentMethod.js","sources":["../../../src/api/paymentMethod.ts"],"sourcesContent":["import {\n PaymentMethod,\n PaymentMethodListParams,\n PaymentMethodsResponse,\n UpdatePaymentMethodRequest,\n} from '../types/paymentMethod';\nimport { Session } from '../types/session';\nimport { rechargeApiRequest } from '../utils/request';\n\nexport async function getPaymentMethod(session: Session, id: string | number): Promise<PaymentMethod> {\n const { payment_method } = await rechargeApiRequest<{ payment_method: PaymentMethod }>(\n 'get',\n `/payment_methods`,\n {\n id,\n },\n session\n );\n return payment_method;\n}\n\nexport async function updatePaymentMethod(\n session: Session,\n id: string | number,\n updateRequest: UpdatePaymentMethodRequest\n): Promise<PaymentMethod> {\n const { payment_method } = await rechargeApiRequest<{ payment_method: PaymentMethod }>(\n 'put',\n `/payment_methods`,\n {\n id,\n data: updateRequest,\n },\n session\n );\n return payment_method;\n}\n\nexport function listPaymentMethods(session: Session, query?: PaymentMethodListParams): Promise<PaymentMethodsResponse> {\n return rechargeApiRequest<PaymentMethodsResponse>('get', `/payment_methods`, { query }, session);\n}\n"],"names":["rechargeApiRequest"],"mappings":";;;;;;AACO,eAAe,gBAAgB,CAAC,OAAO,EAAE,EAAE,EAAE;AACpD,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,MAAMA,0BAAkB,CAAC,KAAK,EAAE,CAAC,gBAAgB,CAAC,EAAE;AACjF,IAAI,EAAE;AACN,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,cAAc,CAAC;AACxB,CAAC;AACM,eAAe,mBAAmB,CAAC,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE;AACtE,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,MAAMA,0BAAkB,CAAC,KAAK,EAAE,CAAC,gBAAgB,CAAC,EAAE;AACjF,IAAI,EAAE;AACN,IAAI,IAAI,EAAE,aAAa;AACvB,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,cAAc,CAAC;AACxB,CAAC;AACM,SAAS,kBAAkB,CAAC,OAAO,EAAE,KAAK,EAAE;AACnD,EAAE,OAAOA,0BAAkB,CAAC,KAAK,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;AAC3E;;;;;;"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -10,6 +10,7 @@ var bundle = require('./api/bundle.js');
|
|
|
10
10
|
var membership = require('./api/membership.js');
|
|
11
11
|
var onetime = require('./api/onetime.js');
|
|
12
12
|
var order = require('./api/order.js');
|
|
13
|
+
var paymentMethod = require('./api/paymentMethod.js');
|
|
13
14
|
var plan = require('./api/plan.js');
|
|
14
15
|
var subscription = require('./api/subscription.js');
|
|
15
16
|
var customer = require('./api/customer.js');
|
|
@@ -53,6 +54,9 @@ exports.listOnetimes = onetime.listOnetimes;
|
|
|
53
54
|
exports.updateOnetime = onetime.updateOnetime;
|
|
54
55
|
exports.getOrder = order.getOrder;
|
|
55
56
|
exports.listOrders = order.listOrders;
|
|
57
|
+
exports.getPaymentMethod = paymentMethod.getPaymentMethod;
|
|
58
|
+
exports.listPaymentMethods = paymentMethod.listPaymentMethods;
|
|
59
|
+
exports.updatePaymentMethod = paymentMethod.updatePaymentMethod;
|
|
56
60
|
exports.getPlan = plan.getPlan;
|
|
57
61
|
exports.listPlans = plan.listPlans;
|
|
58
62
|
exports.activateSubscription = subscription.activateSubscription;
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/esm/api/auth.js
CHANGED
|
@@ -14,7 +14,7 @@ async function loginShopifyAppProxy() {
|
|
|
14
14
|
async function loginShopifyApi(customerAccessToken, storefrontAccessToken) {
|
|
15
15
|
const { environment, storeIdentifier } = getOptions();
|
|
16
16
|
const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment);
|
|
17
|
-
const response = await request("post", `${rechargeBaseUrl}/
|
|
17
|
+
const response = await request("post", `${rechargeBaseUrl}/shopify_storefront_access`, {
|
|
18
18
|
data: {
|
|
19
19
|
customer_token: customerAccessToken,
|
|
20
20
|
storefront_token: storefrontAccessToken,
|
package/dist/esm/api/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sources":["../../../src/api/auth.ts"],"sourcesContent":["import { request as baseRequest, shopifyAppProxyRequest } from '../utils/request';\nimport { LoginResponse } from '../types/auth';\nimport { getOptions } from '../utils/options';\nimport { RECHARGE_ADMIN_URL } from '../constants/api';\nimport { Session } from '../types/session';\nimport { RequestHeaders } from '../types';\n\nexport async function loginShopifyAppProxy(): Promise<Session> {\n const { storefrontAccessToken } = getOptions();\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await shopifyAppProxyRequest<LoginResponse>('get', '/access', { headers });\n\n return { apiToken: response.api_token, customerId: response.customer_id };\n}\n\nexport async function loginShopifyApi(\n customerAccessToken: string,\n storefrontAccessToken: string\n): Promise<Session | null> {\n const { environment, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment);\n const response = await baseRequest<LoginResponse>('post', `${rechargeBaseUrl}/
|
|
1
|
+
{"version":3,"file":"auth.js","sources":["../../../src/api/auth.ts"],"sourcesContent":["import { request as baseRequest, shopifyAppProxyRequest } from '../utils/request';\nimport { LoginResponse } from '../types/auth';\nimport { getOptions } from '../utils/options';\nimport { RECHARGE_ADMIN_URL } from '../constants/api';\nimport { Session } from '../types/session';\nimport { RequestHeaders } from '../types';\n\nexport async function loginShopifyAppProxy(): Promise<Session> {\n const { storefrontAccessToken } = getOptions();\n const headers: RequestHeaders = {};\n if (storefrontAccessToken) {\n headers['X-Recharge-Storefront-Access-Token'] = storefrontAccessToken;\n }\n const response = await shopifyAppProxyRequest<LoginResponse>('get', '/access', { headers });\n\n return { apiToken: response.api_token, customerId: response.customer_id };\n}\n\nexport async function loginShopifyApi(\n customerAccessToken: string,\n storefrontAccessToken: string\n): Promise<Session | null> {\n const { environment, storeIdentifier } = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(environment);\n const response = await baseRequest<LoginResponse>('post', `${rechargeBaseUrl}/shopify_storefront_access`, {\n data: {\n customer_token: customerAccessToken,\n storefront_token: storefrontAccessToken,\n shop_url: storeIdentifier,\n },\n headers: {\n 'X-Recharge-App': 'storefront-client',\n },\n });\n\n return response.api_token ? { apiToken: response.api_token, customerId: response.customer_id } : null;\n}\n"],"names":["baseRequest"],"mappings":";;;;AAGO,eAAe,oBAAoB,GAAG;AAC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
+
const { payment_method } = await rechargeApiRequest("get", `/payment_methods`, {
|
|
5
|
+
id
|
|
6
|
+
}, session);
|
|
7
|
+
return payment_method;
|
|
8
|
+
}
|
|
9
|
+
async function updatePaymentMethod(session, id, updateRequest) {
|
|
10
|
+
const { payment_method } = await rechargeApiRequest("put", `/payment_methods`, {
|
|
11
|
+
id,
|
|
12
|
+
data: updateRequest
|
|
13
|
+
}, session);
|
|
14
|
+
return payment_method;
|
|
15
|
+
}
|
|
16
|
+
function listPaymentMethods(session, query) {
|
|
17
|
+
return rechargeApiRequest("get", `/payment_methods`, { query }, session);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { getPaymentMethod, listPaymentMethods, updatePaymentMethod };
|
|
21
|
+
//# sourceMappingURL=paymentMethod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paymentMethod.js","sources":["../../../src/api/paymentMethod.ts"],"sourcesContent":["import {\n PaymentMethod,\n PaymentMethodListParams,\n PaymentMethodsResponse,\n UpdatePaymentMethodRequest,\n} from '../types/paymentMethod';\nimport { Session } from '../types/session';\nimport { rechargeApiRequest } from '../utils/request';\n\nexport async function getPaymentMethod(session: Session, id: string | number): Promise<PaymentMethod> {\n const { payment_method } = await rechargeApiRequest<{ payment_method: PaymentMethod }>(\n 'get',\n `/payment_methods`,\n {\n id,\n },\n session\n );\n return payment_method;\n}\n\nexport async function updatePaymentMethod(\n session: Session,\n id: string | number,\n updateRequest: UpdatePaymentMethodRequest\n): Promise<PaymentMethod> {\n const { payment_method } = await rechargeApiRequest<{ payment_method: PaymentMethod }>(\n 'put',\n `/payment_methods`,\n {\n id,\n data: updateRequest,\n },\n session\n );\n return payment_method;\n}\n\nexport function listPaymentMethods(session: Session, query?: PaymentMethodListParams): Promise<PaymentMethodsResponse> {\n return rechargeApiRequest<PaymentMethodsResponse>('get', `/payment_methods`, { query }, session);\n}\n"],"names":[],"mappings":";;AACO,eAAe,gBAAgB,CAAC,OAAO,EAAE,EAAE,EAAE;AACpD,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,kBAAkB,CAAC,KAAK,EAAE,CAAC,gBAAgB,CAAC,EAAE;AACjF,IAAI,EAAE;AACN,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,cAAc,CAAC;AACxB,CAAC;AACM,eAAe,mBAAmB,CAAC,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE;AACtE,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,kBAAkB,CAAC,KAAK,EAAE,CAAC,gBAAgB,CAAC,EAAE;AACjF,IAAI,EAAE;AACN,IAAI,IAAI,EAAE,aAAa;AACvB,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,cAAc,CAAC;AACxB,CAAC;AACM,SAAS,kBAAkB,CAAC,OAAO,EAAE,KAAK,EAAE;AACnD,EAAE,OAAO,kBAAkB,CAAC,KAAK,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;AAC3E;;;;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export { getBundleId, validateBundle } from './api/bundle.js';
|
|
|
6
6
|
export { activateMembership, cancelMembership, getMembership, listMemberships } from './api/membership.js';
|
|
7
7
|
export { createOnetime, deleteOnetime, getOnetime, listOnetimes, updateOnetime } from './api/onetime.js';
|
|
8
8
|
export { getOrder, listOrders } from './api/order.js';
|
|
9
|
+
export { getPaymentMethod, listPaymentMethods, updatePaymentMethod } from './api/paymentMethod.js';
|
|
9
10
|
export { getPlan, listPlans } from './api/plan.js';
|
|
10
11
|
export { activateSubscription, cancelSubscription, createSubscription, getSubscription, listSubscriptions, skipSubscriptionCharge, updateSubscription, updateSubscriptionAddress, updateSubscriptionChargeDate } from './api/subscription.js';
|
|
11
12
|
export { getCustomer, getDeliverySchedule, updateCustomer } from './api/customer.js';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -990,8 +990,8 @@ interface Customer {
|
|
|
990
990
|
/** The date and time when the customer was last updated. */
|
|
991
991
|
updated_at: IsoDateString;
|
|
992
992
|
}
|
|
993
|
-
declare type
|
|
994
|
-
declare type UpdateCustomerRequest = Partial<Pick<Customer,
|
|
993
|
+
declare type CustomerOptionalUpdateProps = 'email' | 'first_name' | 'last_name' | 'external_customer_id';
|
|
994
|
+
declare type UpdateCustomerRequest = Partial<Pick<Customer, CustomerOptionalUpdateProps>>;
|
|
995
995
|
interface CustomerDeliveryScheduleParams {
|
|
996
996
|
delivery_count_future?: number;
|
|
997
997
|
future_internal?: number;
|
|
@@ -1099,15 +1099,15 @@ interface Onetime {
|
|
|
1099
1099
|
/** Presentment currency */
|
|
1100
1100
|
presentment_currency: string | null;
|
|
1101
1101
|
}
|
|
1102
|
-
declare type
|
|
1103
|
-
declare type
|
|
1104
|
-
interface
|
|
1102
|
+
declare type OnetimeRequiredCreateProps = 'address_id' | 'external_variant_id' | 'next_charge_scheduled_at' | 'product_title' | 'quantity';
|
|
1103
|
+
declare type OnetimeOptionalCreateProps = 'external_product_id' | 'properties' | 'sku';
|
|
1104
|
+
interface OnetimeCreateProps {
|
|
1105
1105
|
/** Instructs to add the Onetime to the next charge scheduled under this Address. */
|
|
1106
1106
|
add_to_next_charge?: boolean;
|
|
1107
1107
|
}
|
|
1108
|
-
declare type CreateOnetimeRequest = SubType<Onetime,
|
|
1109
|
-
declare type
|
|
1110
|
-
declare type UpdateOnetimeRequest = Partial<Pick<Onetime,
|
|
1108
|
+
declare type CreateOnetimeRequest = SubType<Onetime, OnetimeRequiredCreateProps, OnetimeOptionalCreateProps> & OnetimeCreateProps;
|
|
1109
|
+
declare type OnetimeOptionalUpdateProps = 'address_id' | 'next_charge_scheduled_at' | 'properties' | 'quantity' | 'external_variant_id' | 'sku';
|
|
1110
|
+
declare type UpdateOnetimeRequest = Partial<Pick<Onetime, OnetimeOptionalUpdateProps>>;
|
|
1111
1111
|
interface OnetimesResponse {
|
|
1112
1112
|
next_cursor: null | string;
|
|
1113
1113
|
previous_cursor: null | string;
|
|
@@ -1132,6 +1132,80 @@ interface InitOptions {
|
|
|
1132
1132
|
storefrontAccessToken?: string;
|
|
1133
1133
|
}
|
|
1134
1134
|
|
|
1135
|
+
interface PaymentDetails {
|
|
1136
|
+
/** Payment_method brand or company powering it. valid for CREDIT_CARD only. */
|
|
1137
|
+
brand?: string;
|
|
1138
|
+
/** Payment_method expiry month. valid for CREDIT_CARD only. */
|
|
1139
|
+
exp_month?: string;
|
|
1140
|
+
/** Payment_method expiry year. valid for CREDIT_CARD only. */
|
|
1141
|
+
exp_year?: string;
|
|
1142
|
+
/** last 4-digits of the identifier. valid for CREDIT_CARD only. */
|
|
1143
|
+
last4?: string;
|
|
1144
|
+
/** email linked to paypal. valid for PAYPAL only. */
|
|
1145
|
+
paypal_email?: string;
|
|
1146
|
+
/** paypal user identifier. valid for PAYPAL only. */
|
|
1147
|
+
paypal_payer_id?: string;
|
|
1148
|
+
/** If a digital wallet. */
|
|
1149
|
+
wallet_type?: string;
|
|
1150
|
+
/** Type of funding for the Payment Method. */
|
|
1151
|
+
funding_type?: string;
|
|
1152
|
+
}
|
|
1153
|
+
declare type PaymentType = 'CREDIT_CARD' | 'PAYPAL' | 'APPLE_PAY' | 'GOOGLE_PAY' | 'SEPA_DEBIT';
|
|
1154
|
+
declare type ProcessorName = 'stripe' | 'braintree' | 'authorize' | 'shopify_payments' | 'mollie';
|
|
1155
|
+
declare type PaymentMethodStatus = 'not_validated' | 'valid' | 'invalid';
|
|
1156
|
+
interface PaymentMethod {
|
|
1157
|
+
/** The unique payment method id for a customer. */
|
|
1158
|
+
id: number;
|
|
1159
|
+
/** An object with the customer’s address information. */
|
|
1160
|
+
billing_address: AssociatedAddress;
|
|
1161
|
+
/** The Recharge customer_id */
|
|
1162
|
+
customer_id: number;
|
|
1163
|
+
/** The time the payment method was created. */
|
|
1164
|
+
created_at: IsoDateString;
|
|
1165
|
+
/** If this is the default payment method for the customer */
|
|
1166
|
+
default: boolean;
|
|
1167
|
+
/** Details about the specific payment method */
|
|
1168
|
+
payment_details: PaymentDetails;
|
|
1169
|
+
/**
|
|
1170
|
+
* The type of payment this is.
|
|
1171
|
+
* If passed, must also be accompanied by one of stripe_customer_token, paypal_customer_token or authorizedotnet_customer_token in processor_payment_method_token.
|
|
1172
|
+
*/
|
|
1173
|
+
payment_type: PaymentType;
|
|
1174
|
+
/** The customer token at the processor. */
|
|
1175
|
+
processor_customer_token: string;
|
|
1176
|
+
/**
|
|
1177
|
+
* This will impact validation on billing_details.
|
|
1178
|
+
* Currently, shopify_payments is in read-only mode and can only be managed by Shopify.
|
|
1179
|
+
*/
|
|
1180
|
+
processor_name: ProcessorName;
|
|
1181
|
+
/** The payment token at the processor. */
|
|
1182
|
+
processor_payment_method_token: string;
|
|
1183
|
+
/** State of the Payment Method. */
|
|
1184
|
+
status: PaymentMethodStatus;
|
|
1185
|
+
/**
|
|
1186
|
+
* The status reason for the payment method.
|
|
1187
|
+
* Often used when invalid to provide background details in invalidity.
|
|
1188
|
+
*/
|
|
1189
|
+
status_reason: string;
|
|
1190
|
+
/** The time the payment method was last updated. */
|
|
1191
|
+
updated_at: IsoDateString;
|
|
1192
|
+
}
|
|
1193
|
+
interface PaymentMethodsResponse {
|
|
1194
|
+
next_cursor: null | string;
|
|
1195
|
+
previous_cursor: null | string;
|
|
1196
|
+
payment_methods: PaymentMethod[];
|
|
1197
|
+
}
|
|
1198
|
+
declare type PaymentMethodOptionalUpdateProps = 'billing_address' | 'default';
|
|
1199
|
+
declare type UpdatePaymentMethodRequest = Partial<Pick<PaymentMethod, PaymentMethodOptionalUpdateProps>>;
|
|
1200
|
+
/** no sorting options for payment_methods, always by id-desc */
|
|
1201
|
+
declare type PaymentMethodSortBy = null;
|
|
1202
|
+
interface PaymentMethodListParams extends ListParams<PaymentMethodSortBy> {
|
|
1203
|
+
customer_id?: string;
|
|
1204
|
+
processor_name?: ProcessorName;
|
|
1205
|
+
address_id?: string;
|
|
1206
|
+
processor_payment_method_token?: string;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1135
1209
|
interface ChannelSettings {
|
|
1136
1210
|
api: {
|
|
1137
1211
|
display: boolean;
|
|
@@ -1289,11 +1363,11 @@ interface SubscriptionListParams extends ListParams<SubscriptionSortBy> {
|
|
|
1289
1363
|
created_at_max?: IsoDateString;
|
|
1290
1364
|
customer_id?: string;
|
|
1291
1365
|
}
|
|
1292
|
-
declare type
|
|
1293
|
-
declare type
|
|
1294
|
-
declare type CreateSubscriptionRequest = SubType<Subscription,
|
|
1295
|
-
declare type
|
|
1296
|
-
declare type UpdateSubscriptionRequest = Partial<Pick<Subscription,
|
|
1366
|
+
declare type SubscriptionRequiredCreateProps = 'address_id' | 'charge_interval_frequency' | 'external_variant_id' | 'next_charge_scheduled_at' | 'order_interval_frequency' | 'order_interval_unit' | 'quantity';
|
|
1367
|
+
declare type SubscriptionOptionalCreateProps = 'expire_after_specific_number_of_charges' | 'order_day_of_month' | 'order_day_of_week' | 'external_product_id' | 'product_title' | 'properties' | 'status';
|
|
1368
|
+
declare type CreateSubscriptionRequest = SubType<Subscription, SubscriptionRequiredCreateProps, SubscriptionOptionalCreateProps>;
|
|
1369
|
+
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';
|
|
1370
|
+
declare type UpdateSubscriptionRequest = Partial<Pick<Subscription, SubscriptionOptionalUpdateProps>>;
|
|
1297
1371
|
interface UpdateSubscriptionParams {
|
|
1298
1372
|
/** 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
1373
|
commit?: boolean;
|
|
@@ -1334,6 +1408,10 @@ declare function deleteOnetime(session: Session, id: string | number): Promise<v
|
|
|
1334
1408
|
declare function getOrder(session: Session, id: string | number): Promise<Order>;
|
|
1335
1409
|
declare function listOrders(session: Session, query?: OrderListParams): Promise<OrdersResponse>;
|
|
1336
1410
|
|
|
1411
|
+
declare function getPaymentMethod(session: Session, id: string | number): Promise<PaymentMethod>;
|
|
1412
|
+
declare function updatePaymentMethod(session: Session, id: string | number, updateRequest: UpdatePaymentMethodRequest): Promise<PaymentMethod>;
|
|
1413
|
+
declare function listPaymentMethods(session: Session, query?: PaymentMethodListParams): Promise<PaymentMethodsResponse>;
|
|
1414
|
+
|
|
1337
1415
|
declare function getPlan(session: Session, id: string | number): Promise<Plan>;
|
|
1338
1416
|
declare function listPlans(session: Session, query?: PlanListParams): Promise<PlansResponse>;
|
|
1339
1417
|
|
|
@@ -1384,4 +1462,4 @@ declare const api: {
|
|
|
1384
1462
|
};
|
|
1385
1463
|
declare function initRecharge(opt?: InitOptions): void;
|
|
1386
1464
|
|
|
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 };
|
|
1465
|
+
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, CustomerOptionalUpdateProps, Delivery, Discount, ExternalId, ExternalTransactionId, FirstOption, 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 };
|