chargebee 2.51.0 → 2.52.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/CHANGELOG.md +27 -0
- package/lib/chargebee.js +1 -1
- package/lib/resources/api_endpoints.js +14 -1
- package/package.json +1 -1
- package/types/core.d.ts +4 -4
- package/types/index.d.ts +2 -0
- package/types/resources/Address.d.ts +2 -194
- package/types/resources/AdvanceInvoiceSchedule.d.ts +5 -67
- package/types/resources/Attribute.d.ts +4 -1
- package/types/resources/BillingConfiguration.d.ts +21 -0
- package/types/resources/Brand.d.ts +12 -0
- package/types/resources/BusinessEntity.d.ts +8 -6
- package/types/resources/BusinessEntityTransfer.d.ts +10 -7
- package/types/resources/Card.d.ts +11 -311
- package/types/resources/Comment.d.ts +7 -124
- package/types/resources/Contact.d.ts +2 -44
- package/types/resources/ContractTerm.d.ts +4 -72
- package/types/resources/Coupon.d.ts +0 -37
- package/types/resources/CouponCode.d.ts +67 -35
- package/types/resources/CouponSet.d.ts +12 -121
- package/types/resources/CreditNote.d.ts +0 -6
- package/types/resources/Currency.d.ts +8 -5
- package/types/resources/Customer.d.ts +90 -89
- package/types/resources/Discount.d.ts +2 -89
- package/types/resources/Download.d.ts +2 -14
- package/types/resources/Entitlement.d.ts +15 -103
- package/types/resources/EntitlementOverride.d.ts +4 -89
- package/types/resources/Estimate.d.ts +2 -10
- package/types/resources/Event.d.ts +23 -108
- package/types/resources/Export.d.ts +116 -432
- package/types/resources/Feature.d.ts +17 -319
- package/types/resources/GatewayErrorDetail.d.ts +6 -48
- package/types/resources/Gift.d.ts +34 -294
- package/types/resources/Hierarchy.d.ts +4 -24
- package/types/resources/ImpactedItem.d.ts +4 -36
- package/types/resources/ImpactedItemPrice.d.ts +5 -2
- package/types/resources/ImpactedSubscription.d.ts +3 -30
- package/types/resources/InAppSubscription.d.ts +13 -355
- package/types/resources/Invoice.d.ts +2 -16
- package/types/resources/InvoiceEstimate.d.ts +1 -1
- package/types/resources/Item.d.ts +0 -7
- package/types/resources/ItemEntitlement.d.ts +15 -155
- package/types/resources/NonSubscription.d.ts +9 -6
- package/types/resources/PaymentIntent.d.ts +9 -255
- package/types/resources/PaymentReferenceNumber.d.ts +3 -20
- package/types/resources/PaymentSource.d.ts +2 -2
- package/types/resources/PaymentVoucher.d.ts +20 -203
- package/types/resources/PortalSession.d.ts +4 -146
- package/types/resources/PromotionalCredit.d.ts +10 -215
- package/types/resources/Purchase.d.ts +3 -1
- package/types/resources/Quote.d.ts +19 -1
- package/types/resources/QuotedRamp.d.ts +11 -16
- package/types/resources/RecordedPurchase.d.ts +2 -0
- package/types/resources/ResourceMigration.d.ts +2 -54
- package/types/resources/SiteMigrationDetail.d.ts +13 -55
- package/types/resources/Subscription.d.ts +11 -9
- package/types/resources/SubscriptionEntitlement.d.ts +6 -106
- package/types/resources/SubscriptionEstimate.d.ts +14 -11
- package/types/resources/TaxWithheld.d.ts +14 -26
- package/types/resources/ThirdPartyPaymentMethod.d.ts +2 -19
- package/types/resources/TimeMachine.d.ts +3 -64
- package/types/resources/Token.d.ts +3 -60
- package/types/resources/Transaction.d.ts +2 -2
- package/types/resources/Usage.d.ts +21 -165
|
@@ -1,321 +1,30 @@
|
|
|
1
1
|
///<reference path='./../core.d.ts'/>
|
|
2
|
+
///<reference path='./../index.d.ts'/>
|
|
2
3
|
declare module 'chargebee' {
|
|
3
4
|
export interface InAppSubscription {
|
|
4
5
|
|
|
5
|
-
/**
|
|
6
|
-
* @description The `id` of the [subscription](subscriptions#subscription_id) for which the receipt was sent.
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
app_id:string;
|
|
8
|
+
|
|
10
9
|
subscription_id:string;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @description The `id` of the [customer](customers#customer_id) object to which the subscription belongs.
|
|
14
10
|
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
11
|
customer_id?:string;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @description The `id` of the plan-item price of the subscription.
|
|
21
12
|
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
13
|
plan_id?:string;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @description The status of the subscription for the store \* paused - When the subscription is paused. \* in_trial - When the subscription is in trial. \* active - When the subscription is active. \* cancelled - When the subscription is cancelled.
|
|
28
14
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
store_status?:'in_trial' | 'paused' | 'active' | 'cancelled';
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @description The `id` of the invoice generated in Chargebee
|
|
15
|
+
store_status?:'in_trial' | 'active' | 'cancelled' | 'paused';
|
|
35
16
|
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
17
|
invoice_id?:string;
|
|
18
|
+
|
|
39
19
|
}
|
|
40
20
|
export namespace InAppSubscription {
|
|
41
21
|
export class InAppSubscriptionResource {
|
|
42
|
-
/**
|
|
43
|
-
* @description Verifies an in-app purchase made by your customer and creates a subscription in Chargebee.
|
|
44
|
-
**Tip**
|
|
45
|
-
|
|
46
|
-
The recommended approach is to call this endpoint from the client-side app directly. However, if you are using this API to replace an existing direct integration with Apple or Google, then you may choose to call this API from the server-side.
|
|
47
|
-
**Note:**
|
|
48
|
-
|
|
49
|
-
if App Store or Play Store products have not been imported to Chargebee and this API is invoked, Chargebee will automatically create plans that correspond to the store product IDs. However, if historical subscriptions are to be imported using the [import receipt](https://apidocs.chargebee.com/docs/api/in_app_subscriptions#import_receipt) API, importing products is mandatory. [Learn more](https://www.chargebee.com/docs/mobile_subscriptions.html).
|
|
50
|
-
|
|
51
|
-
Apple App Store {#app_store}
|
|
52
|
-
----------------------------
|
|
53
|
-
|
|
54
|
-
This section provides details of the Process Purchase Command operation when performed for the Apple App Store. This API processes only the latest in-app transaction on the receipt. Sync historical subscriptions into Chargebee using [bulk import](https://www.chargebee.com/docs/2.0/mobile-app-store-product-iap.html#import-in-app-purchase-receipts) of In-App Purchase receipts.
|
|
55
|
-
**Important**
|
|
56
|
-
|
|
57
|
-
* [Integrate Chargebee](https://www.chargebee.com/docs/mobile-app-store-connect.html#connnect-with-your-chargebee-site) with your Apple App Store account using your shared secret from Apple.
|
|
58
|
-
* It is strongly recommended to use this endpoint to notify Chargebee of **new** purchases only.
|
|
59
|
-
* For updates to existing subscriptions, we recommend that you configure Apple App Store to send server notifications to Chargebee.
|
|
60
|
-
|
|
61
|
-
Chargebee validates the `receipt` with Apple App Store and does the following once validation succeeds:
|
|
62
|
-
|
|
63
|
-
1. Look for [item_family.id](/docs/api/item_families?prod_cat_ver=2#item_family_id) that matches the value Apple-App-Store, and create such a product family if not found.
|
|
64
|
-
2. Look for [item.id](/docs/api/items?prod_cat_ver=2#item_id) that matches `product[id]` and if not found, create such a plan-item under the item family described in the previous step.
|
|
65
|
-
3. Look for [item_price.id](/docs/api/item_prices?prod_cat_ver=2#item_price_id) that matches the concatenation of `product[id]` and `product[currency_code]`, and if not found, create such an item price under the item described in the previous step.
|
|
66
|
-
4. Create/update a subscription:
|
|
67
|
-
* If the receipt is for a new purchase, a new subscription is created for the plan-item price described in the previous step. The subscription has the following details:
|
|
68
|
-
* `id` set to [original_transaction_id](https://developer.apple.com/documentation/appstorereceipts/original_transaction_id?language=objc)
|
|
69
|
-
* `start_date` set to [responseBody.Latest_receipt_info.purchase_date_ms](https://developer.apple.com/documentation/appstorereceipts/responsebody/latest_receipt_info?language=objc)
|
|
70
|
-
* `current_term_end` set to `responseBody.Latest_receipt_info.expires_date_ms`
|
|
71
|
-
* Instead, if the receipt belongs to an existing subscription in Chargebee, it is updated to reflect the current state of the subscription at Apple.
|
|
72
|
-
5. The payment is recorded against the subscription invoice. The associated transaction is updated with the following details:
|
|
73
|
-
* The [transaction.reference_number](/docs/api/transactions?prod_cat_ver=2#transaction_reference_number) is set to the [transaction_id](https://developer.apple.com/documentation/appstorereceipts/transaction_id?language=objc) of the payment.
|
|
74
|
-
* The [transaction.payment_method](/docs/api/transactions#transaction_payment_method) is set to `apple_pay`.
|
|
75
|
-
|
|
76
|
-
Google Play Store {#app_store}
|
|
77
|
-
------------------------------
|
|
78
|
-
|
|
79
|
-
This section provides details of the Process Purchase Command operation when performed for the Google Play Store. This API processes only the latest in-app transaction using the purchase token.
|
|
80
|
-
**Important**
|
|
81
|
-
|
|
82
|
-
* [Integrate Chargebee](https://www.chargebee.com/docs/2.0/mobile-playstore-connect.html#chargebee-configuration) with your Google Play Store account using the service account credentials JSON.
|
|
83
|
-
* It is strongly recommended to use this endpoint to notify Chargebee of **new** purchases only.
|
|
84
|
-
* For updates to existing subscriptions, we recommend that you configure Chargebee to receive Google's server notifications through pub/sub topic. [Learn more](https://developer.android.com/google/play/billing/getting-ready#setup-pubsub).
|
|
85
|
-
|
|
86
|
-
Chargebee validates the purchase **token** with Google Play Store and does the following once validation succeeds:
|
|
87
|
-
|
|
88
|
-
1. Look for [item_family.id](/docs/api/item_families?prod_cat_ver=2#item_family_id) that matches the value `Google-Play-Store`, and create such a product family if not found.
|
|
89
|
-
2. Look for [item.id](/docs/api/items?prod_cat_ver=2#item_id) that matches `product[id]` and if not found, create such a [plan-item](/docs/api/items?prod_cat_ver=2#item_type) under the item family described in the previous step.
|
|
90
|
-
3. Look for [item_price.id](/docs/api/item_prices?prod_cat_ver=2#item_price_id) that matches the concatenation of `product[id]` and [priceCurrencyCode](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions?hl=en#SubscriptionPurchase.FIELDS.price_currency_code), and if not found, create such an item price under the item described in the previous step.
|
|
91
|
-
4. Create/update a subscription:
|
|
92
|
-
* If this token is for a new purchase, a new subscription is created for the plan-item price described in the previous step. The subscription has the following details:
|
|
93
|
-
* `id` set to unique identifier generated by Chargebee and mapped to **token** of the [SubscriptionPurchase](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions?hl=en) object from Google response.
|
|
94
|
-
* `start_date` set to `SubscriptionPurchase.startTimeMillis`.
|
|
95
|
-
* `current_term_end` set to `SubscriptionPurchase.expiryTimeMillis`.
|
|
96
|
-
* Instead, if the token belongs to an existing subscription in Chargebee, it is updated to reflect the current state of the subscription at Google.
|
|
97
|
-
5. The payment is recorded against the subscription invoice. The associated transaction is updated with the following details:
|
|
98
|
-
* The [transaction.reference_number](/docs/api/transactions?prod_cat_ver=2#transaction_reference_number) is set to the [orderId](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions?hl=en#SubscriptionPurchase.FIELDS.order_id) of the payment.
|
|
99
|
-
* The [transaction.payment_method](/docs/api/transactions#transaction_payment_method) is set to `play_store`.
|
|
100
|
-
|
|
101
|
-
Path Parameter {#path_param_pcv2}
|
|
102
|
-
---------------------------------
|
|
103
|
-
|
|
104
|
-
`{in_app_subscription_app_id}`: The handle created by Chargebee for your Apple App Store or Google Play Store app. It can be obtained from the Chargebee web app.
|
|
105
|
-
|
|
106
|
-
The following are instructions to obtain the value of the path parameter for the Apple App Store and Google Play Store.
|
|
107
|
-
|
|
108
|
-
* **Apple App Store** : To obtain the value for `{in_app_subscription_app_id}`, click **View Keys** within the **Sync Overview** page of the web app and use the value of generated **App ID** for this parameter. See detailed steps [here](https://www.chargebee.com/docs/1.0/mobile-app-store-product-iap.html#resource-id).
|
|
109
|
-
* **Google Play Store** : To obtain the value for `{in_app_subscription_app_id}`, click **Set up notifications** within the **Sync Overview** page of the web app and use the value of generated **App ID** for this parameter. See detailed steps [here](https://www.chargebee.com/docs/1.0/mobile-playstore-notifications.html#app-id).
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
*/
|
|
115
|
-
|
|
116
22
|
process_receipt(in_app_subscription_app_id:string, input:ProcessReceiptInputParam):ChargebeeRequest<ProcessReceiptResponse>;
|
|
117
23
|
|
|
118
|
-
/**
|
|
119
|
-
* @description Verifies an Apple App Store or Google Play Store in-app purchase [receipt](https://developer.apple.com/documentation/storekit/original_api_for_in-app_purchase/validating_receipts_with_the_app_store?language=objc#overview) and imports [subscriptions](/docs/api/subscriptions) for all historical purchases made by the customer.
|
|
120
|
-
**Tip**
|
|
121
|
-
An `in_app_subscription` is created for every unique `original_transaction_id`. Apple creates `original_transaction_id` for every create, upgrade, or downgrade of the subscription. A receipt hardly contains more than 100 `original_transaction_id`s. If a receipt contains more than 100 `original_transaction_id`s, Chargebee creates all subscription records but this endpoint returns the first 100 records in the response.
|
|
122
|
-
|
|
123
|
-
CSV upload has a file size [limitation](https://www.chargebee.com/docs/mobile-app-store-product-iap.html#upload-in-app-receipts) that increases the processing time and the number of receipts. This API removes such limitations and allows you to import historical in-app subscription receipts.
|
|
124
|
-
**Note** : This API verifies receipt or token through Apple or Google and then processes them via Chargebee. For bulk imports, limit API calls to **6** per minute (**10** seconds apart) to ensure successful subscription imports.
|
|
125
|
-
|
|
126
|
-
Apple App Store {#app_store}
|
|
127
|
-
----------------------------
|
|
128
|
-
|
|
129
|
-
This section provides details of the Import Receipt operation performed for the Apple App Store. This API processes only the historical in-app transaction receipts.
|
|
130
|
-
**Important**
|
|
131
|
-
|
|
132
|
-
* [Integrate Chargebee](https://www.chargebee.com/docs/mobile-app-store-connect.html#connnect-with-your-chargebee-site) with your Apple App Store account using your shared secret from Apple.
|
|
133
|
-
* It is strongly recommended to use this endpoint to import historical in-app subscriptions only.
|
|
134
|
-
* You must [import Apple App Store products](https://www.chargebee.com/docs/2.0/mobile-app-store-product-iap.html#import-products) using Chargebee's user interface before importing receipts using this API.
|
|
135
|
-
|
|
136
|
-
Chargebee validates the `receipt` with Apple App Store and does the following once validation succeeds:
|
|
137
|
-
|
|
138
|
-
#### Subscriptions {#ir_apple_app_store_pcv2}
|
|
139
|
-
|
|
140
|
-
[Subscriptions](/docs/api/subscriptions) are imported as follows:
|
|
141
|
-
|
|
142
|
-
1. A subscription is imported for every unique value of the [original_transaction_id](https://developer.apple.com/documentation/appstorereceipts/original_transaction_id?language=objc) in the Apple receipt.
|
|
143
|
-
**Note** : This is not done for `original_transaction_id`s for which a subscription already exists in Chargebee.
|
|
144
|
-
2. Each subscription imported has the following attributes set:
|
|
145
|
-
* `id` set to `original_transaction_id`.
|
|
146
|
-
* `start_date` set to the earliest [purchase_date_ms](https://developer.apple.com/documentation/appstorereceipts/responsebody/latest_receipt_info?language=objc).
|
|
147
|
-
* `current_term_start` set to latest [purchase_date_ms](https://developer.apple.com/documentation/appstorereceipts/responsebody/latest_receipt_info?language=objc).
|
|
148
|
-
* `current_term_end` set to [expires_date_ms](https://developer.apple.com/documentation/appstorereceipts/responsebody/latest_receipt_info?language=objc) of the same `Latest_receipt_info` element with the latest `purchase_date_ms`.
|
|
149
|
-
* `item_price_id` set to `product_id`.
|
|
150
|
-
* `status` set to `in_trial` if there is only one element of [Latest_receipt_info](https://developer.apple.com/documentation/appstorereceipts/responsebody/latest_receipt_info?language=objc) with the `original_transaction_id` and the field `is_trial_period` is `true`, then consider the subscription is currently in trial. No invoices are created for this subscription.
|
|
151
|
-
|
|
152
|
-
#### Invoices for the subscription
|
|
153
|
-
|
|
154
|
-
[Invoices](/docs/api/invoices) are imported as follows:
|
|
155
|
-
|
|
156
|
-
1. An invoice is imported to Chargebee for every element of the array [Latest_receipt_info](https://developer.apple.com/documentation/appstorereceipts/responsebody/latest_receipt_info?language=objc) which has [is_trial_period](https://developer.apple.com/documentation/appstorereceipts/is_trial_period?language=objc) as `false`.
|
|
157
|
-
2. Each imported invoice has the `subscription_id` set to `original_transaction_id`.
|
|
158
|
-
|
|
159
|
-
#### Transactions for the invoices
|
|
160
|
-
|
|
161
|
-
A [transaction](/docs/api/transactions) is imported for each invoice with the following details:
|
|
162
|
-
|
|
163
|
-
1. `reference_number` set to the `transaction_id`.
|
|
164
|
-
2. `payment_method` set to `apple_store`.
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
Google Play Store {#app_store}
|
|
169
|
-
------------------------------
|
|
170
|
-
|
|
171
|
-
This section provides details of the Import Receipt operation performed for the Google Play Store. This API is used to process only the historical in-app purchase subscriptions.
|
|
172
|
-
**Important**
|
|
173
|
-
|
|
174
|
-
* [Integrate Chargebee](https://www.chargebee.com/docs/2.0/mobile-playstore-connect.html) with your Google Play Store account using your [service account credentials JSON](https://www.chargebee.com/docs/2.0/mobile-playstore-connect.html#generate-service-account-credentials-json).
|
|
175
|
-
* It is strongly recommended to use this endpoint to import historical in-app subscriptions only.
|
|
176
|
-
* It is recommended to pass only the latest purchase `token`. If any other purchase `token` is passed instead of the latest one, there is a possibility of returning incorrect transaction details. If an expired purchase `token` is passed, then it returns an error.
|
|
177
|
-
* The Google purchase token is [valid for 60 days](https://developer.android.com/google/play/billing/subscriptions#lifecycle) from the subscription purchase date. After the `token` expires, an API request to Google Developers API returns an error.
|
|
178
|
-
|
|
179
|
-
Chargebee validates the purchase `token` with Google Play Store and does the following once validation succeeds:
|
|
180
|
-
|
|
181
|
-
#### Subscriptions {#ir_google_play_store_pcv2}
|
|
182
|
-
|
|
183
|
-
* A [subscription](/docs/api/subscriptions) is imported for every unique purchase token if it is not linked to an existing purchase `token`( `linkedPurchaseToken` field in `SubscriptionsV2.get` API Response).
|
|
184
|
-
|
|
185
|
-
* Each subscription imported has the following attributes set:
|
|
186
|
-
|
|
187
|
-
* `id` set to a unique identifier generated by Chargebee and mapped to the `token` and `latestOrderId` of the `SubscriptionPurchaseV2` object from Google response.
|
|
188
|
-
|
|
189
|
-
* `start_date` set to the earliest `SubscriptionPurchaseV2.startTime`.
|
|
190
|
-
|
|
191
|
-
* `current_term_start` set to latest `SubscriptionPurchaseV2.startTime`.
|
|
192
|
-
|
|
193
|
-
* `current_term_end` set to `expiryTime` of the same `SubscriptionPurchaseV2` element with the latest purchase.
|
|
194
|
-
|
|
195
|
-
* `item_price_id` set to the concatenation of `product[id]` and `priceCurrencyCode` from Google.
|
|
196
|
-
|
|
197
|
-
* `status` set to `in_trial` if the free trial configuration is enabled in Google and the [monetization.subscriptions.basePlans.offers.State](https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.subscriptions.basePlans.offers#State) is `Active` with a [SubscriptionOfferPhase.duration](https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.subscriptions.basePlans.offers#subscriptionofferphase), then consider the subscription is currently in trial. No invoices are created for this subscription.
|
|
198
|
-
|
|
199
|
-
#### Invoices for the subscription
|
|
200
|
-
|
|
201
|
-
Invoices are imported as follows:
|
|
202
|
-
|
|
203
|
-
* An [invoice](/docs/api/invoices "https://apidocs.chargebee.com/docs/api/invoices?prod_cat_ver=2") is imported to Chargebee for every new subscription and renewal of an existing subscription using `latestOrderId`.
|
|
204
|
-
|
|
205
|
-
* Each imported invoice has the `subscription_id` set to a unique identifier generated by Chargebee and mapped to the `token` and `latestOrderId`.
|
|
206
|
-
|
|
207
|
-
#### Transactions for the invoices
|
|
208
|
-
|
|
209
|
-
A [transaction](/docs/api/transactions) is imported for each invoice with the following details:
|
|
210
|
-
|
|
211
|
-
* `transaction.reference_number` is set to the `latestOrderId`.
|
|
212
|
-
|
|
213
|
-
* `transaction.payment_method` is set to `play_store`.
|
|
214
|
-
|
|
215
|
-
Path Parameter {#path_param}
|
|
216
|
-
----------------------------
|
|
217
|
-
|
|
218
|
-
`{in_app_subscription_app_id}`: The handle created by Chargebee for your Apple App Store or Google Play Store app. It can be obtained from the Chargebee web app.
|
|
219
|
-
|
|
220
|
-
The following are instructions to obtain the value of the path parameter for the Apple App Store and Google Play Store.
|
|
221
|
-
|
|
222
|
-
* **Apple App Store** : To obtain the value for `{in_app_subscription_app_id}`, click **View Keys** within the **Sync Overview** page of the web app and use the value of generated **App ID** for this parameter. See detailed steps [here](https://www.chargebee.com/docs/1.0/mobile-app-store-product-iap.html#connection-keys_app-id).
|
|
223
|
-
* **Google Play Store** : To obtain the value for `{in_app_subscription_app_id}`, click **Set up notifications** within the **Sync Overview** page of the web app and use the value of generated **App ID** for this parameter. See detailed steps [here](https://www.chargebee.com/docs/1.0/mobile-playstore-notifications.html#app-id).
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
*/
|
|
229
|
-
|
|
230
24
|
import_receipt(in_app_subscription_app_id:string, input:ImportReceiptInputParam):ChargebeeRequest<ImportReceiptResponse>;
|
|
231
25
|
|
|
232
|
-
|
|
233
|
-
* @description The Import Subscriptions endpoint is a Chargebee API that allows you to import historic In-App Subscriptions without using a valid Apple App Store receipt. This endpoint is useful if you do not have access to the receipt data which is required for the [Import Receipt](https://apidocs.chargebee.com/docs/api/in_app_subscriptions#import_receipt) API.
|
|
234
|
-
|
|
235
|
-
With this API, you can import subscriptions and corresponding invoices for historic In-App purchases. The API returns the [in-app-subscriptions object](https://apidocs.chargebee.com/docs/api/in_app_subscriptions#in_app_subscription_attributes) once the historic subscription is successfully imported into Chargebee.
|
|
236
|
-
**Note** :
|
|
237
|
-
|
|
238
|
-
* Subscriptions cannot be imported from the Google Play Store without a receipt or token. Therefore; Chargebee does not allow you to use this API for the Google Play Store.
|
|
239
|
-
* Enable V1 notifications in the Apple App Store for subscriptions created without receipts. Chargebee depends on receipt data to update subscription statuses. Apple's V2 notifications do not have receipt information; therefore, Chargebee cannot process V2 notifications for subscriptions imported without receipts. Learn more about [++app store notifications++](https://apidocs.chargebee.com/docs/api/in_app_purchase_events?prod_cat_ver=2#app_store_notifications) and [++notification URL configuration++](https://www.chargebee.com/docs/mobile-app-store-product-iap.html#connection-keys_notification-url).
|
|
240
|
-
|
|
241
|
-
### Apple App Store
|
|
242
|
-
|
|
243
|
-
This section provides details of the Import Subscription operation when performed for the Apple App Store. This API creates a historic subscription if the incoming subscription is unknown. For a known subscription, it creates an invoice for the mentioned period.
|
|
244
|
-
**Important**
|
|
245
|
-
|
|
246
|
-
* [Integrate Chargebee](https://www.chargebee.com/docs/mobile-app-store-connect.html#connnect-with-your-chargebee-site) with your Apple App Store account using your shared secret from Apple.
|
|
247
|
-
|
|
248
|
-
* It is strongly recommended to use this endpoint to create a historic In-App subscription only.
|
|
249
|
-
|
|
250
|
-
* You must import App Store products using Chargebee's user interface before importing receipts using this API.
|
|
251
|
-
|
|
252
|
-
Chargebee validates the application ID with Apple App Store and does the following once validation succeeds:
|
|
253
|
-
|
|
254
|
-
#### Subscription
|
|
255
|
-
|
|
256
|
-
1. Import the subscription from the `latest_receipt_info` array from Apple and a new subscription is imported for the item-price.
|
|
257
|
-
**Note:** The subscription is not imported if it already exists in Chargebee but we will import the associated invoice using the subscription\[transaction_id\] in the payload.
|
|
258
|
-
|
|
259
|
-
2. Each subscription imported has the following attribute set:
|
|
260
|
-
|
|
261
|
-
* `id` set to `subscription[id]` . This `subscription[id]` is `original_transaction_id` in the receipts.
|
|
262
|
-
|
|
263
|
-
* `start_date` set to `subscription[start_date]`. You need to provide this information from the oldest `Latest_receipt_info.purchase_date_ms`.
|
|
264
|
-
|
|
265
|
-
* `term_start` set to `subscription[term_start]`. You need to provide this information from the oldest `Latest_receipt_info.purchase_date_ms)`.
|
|
266
|
-
|
|
267
|
-
* `term_end` set to `subscription[term_end]`. You need to provide this information from the oldest `Latest_receipt_info.expires_date_ms`.
|
|
268
|
-
|
|
269
|
-
* `item_price_id` set to `subscription[product_id] + subscription[currency_code].` You need to provide this information from the `Latest_receipt_info.product_id`.
|
|
270
|
-
|
|
271
|
-
* Chargebee records the subscription in a **Trial** state if the `is_trial_period` is `true`.
|
|
272
|
-
|
|
273
|
-
* Chargebee records the subscription in a **Canceled** state if the `term_end` is less than the `System.currentTime()`.
|
|
274
|
-
|
|
275
|
-
#### Invoice for the subscription
|
|
276
|
-
|
|
277
|
-
1. The payment is recorded against the subscription invoice.
|
|
278
|
-
|
|
279
|
-
* Imported invoice has the `subscription_id` set to `original_transaction_id`.
|
|
280
|
-
|
|
281
|
-
**Transactions for the invoice**
|
|
282
|
-
|
|
283
|
-
1. The associated transaction is updated with the following details:
|
|
284
|
-
|
|
285
|
-
* The `transaction.reference_number` is set to the `transaction_id` of the payment.
|
|
286
|
-
|
|
287
|
-
* The `transaction.payment_method` is set to `apple_store`.
|
|
288
|
-
|
|
289
|
-
#### Path Parameter
|
|
290
|
-
|
|
291
|
-
in_app_subscription_app_id
|
|
292
|
-
required, string
|
|
293
|
-
|
|
294
|
-
The handle created by Chargebee for your App Store app. It can be obtained from within the Chargebee web app.
|
|
295
|
-
|
|
296
|
-
To obtain the value of `in_app_subscription_app_id `for the Apple App Store, click **View Keys** within the **Sync Overview** page of the web app, and use the value of generated **App ID** for this parameter. See detailed steps [here](https://www.chargebee.com/docs/mobile-app-store-product-iap.html#connection-keys_app-id).
|
|
297
|
-
|
|
298
|
-
*/
|
|
299
|
-
|
|
300
|
-
import_subscription(in_app_subscription_app_id:string, input?:ImportSubscriptionInputParam):ChargebeeRequest<ImportSubscriptionResponse>;
|
|
26
|
+
import_subscription(in_app_subscription_app_id:string, input:ImportSubscriptionInputParam):ChargebeeRequest<ImportSubscriptionResponse>;
|
|
301
27
|
|
|
302
|
-
/**
|
|
303
|
-
* @description This API verifies the application id `{in_app_subscription_app_id}` and `receipt` then returns the subscription details associated with the purchase.
|
|
304
|
-
|
|
305
|
-
#### Path Parameter
|
|
306
|
-
|
|
307
|
-
in_app_subscription_app_id
|
|
308
|
-
required, string
|
|
309
|
-
|
|
310
|
-
The handle is created by Chargebee for your Apple App Store or Google Play Store app. It can be obtained from the Chargebee web app.
|
|
311
|
-
|
|
312
|
-
The following are instructions to obtain the value of the path parameter for the Apple App Store and Google Play Store.
|
|
313
|
-
|
|
314
|
-
* **Apple App Store** : To obtain the value for `{in_app_subscription_app_id}`, click **View Keys** within the **Sync Overview** page of the web app and use the value of generated **App ID** for this parameter. See detailed steps [here](https://www.chargebee.com/docs/1.0/mobile-app-store-product-iap.html#resource-id).
|
|
315
|
-
* **Google Play Store** : To obtain the value for `{in_app_subscription_app_id}`, click **Set up notifications** within the **Sync Overview** page of the web app and use the value of generated **App ID** for this parameter. See detailed steps [here](https://www.chargebee.com/docs/1.0/mobile-playstore-notifications.html#app-id).
|
|
316
|
-
|
|
317
|
-
*/
|
|
318
|
-
|
|
319
28
|
retrieve_store_subs(in_app_subscription_app_id:string, input:RetrieveStoreSubsInputParam):ChargebeeRequest<RetrieveStoreSubsResponse>;
|
|
320
29
|
}
|
|
321
30
|
export interface ProcessReceiptResponse {
|
|
@@ -323,73 +32,29 @@ The following are instructions to obtain the value of the path parameter for the
|
|
|
323
32
|
}
|
|
324
33
|
export interface ProcessReceiptInputParam {
|
|
325
34
|
|
|
326
|
-
|
|
327
|
-
* @description **Apple App Store** : The Base64 encoded [App Store in-app purchase receipt](https://developer.apple.com/documentation/storekit/original_api_for_in-app_purchase/validating_receipts_with_the_app_store?language=objc#overview) taken from the Apple device after successful creation of the in-app purchase subscription.
|
|
328
|
-
|
|
329
|
-
**Google Play Store** : The purchase `token` taken from the Android device after the successful creation of an in-app purchase subscription.
|
|
330
|
-
|
|
331
|
-
*/
|
|
332
|
-
|
|
333
|
-
receipt:string;
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* @description Parameters for product
|
|
337
|
-
|
|
338
|
-
*/
|
|
339
|
-
|
|
340
|
-
product?:{currency_code:string,id:string,name?:string,period?:string,period_unit?:string,price:number,price_in_decimal?:string};
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* @description Parameters for customer
|
|
344
|
-
|
|
345
|
-
*/
|
|
35
|
+
product:{currency_code:string,id:string,name?:string,period?:string,period_unit?:string,price:number,price_in_decimal?:string};
|
|
346
36
|
|
|
347
37
|
customer?:{email?:string,first_name?:string,id?:string,last_name?:string};
|
|
38
|
+
|
|
39
|
+
receipt:string;
|
|
348
40
|
}
|
|
349
41
|
export interface ImportReceiptResponse {
|
|
350
42
|
in_app_subscriptions:InAppSubscription[];
|
|
351
43
|
}
|
|
352
44
|
export interface ImportReceiptInputParam {
|
|
353
45
|
|
|
354
|
-
|
|
355
|
-
* @description **Apple App Store** : The Base64 encoded [App Store in-app purchase receipt](https://developer.apple.com/documentation/storekit/original_api_for_in-app_purchase/validating_receipts_with_the_app_store?language=objc#overview) taken from the Apple device after successful creation of the in-app purchase subscription.
|
|
356
|
-
|
|
357
|
-
**Google Play Store** : The purchase `token` taken from the Android device after the successful creation of an in-app purchase subscription.
|
|
358
|
-
|
|
359
|
-
*/
|
|
360
|
-
|
|
361
|
-
receipt:string;
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* @description Parameters for product
|
|
365
|
-
|
|
366
|
-
*/
|
|
367
|
-
|
|
368
|
-
product?:{currency_code:string};
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* @description Parameters for customer
|
|
372
|
-
|
|
373
|
-
*/
|
|
46
|
+
product:{currency_code:string};
|
|
374
47
|
|
|
375
48
|
customer?:{email?:string,id?:string};
|
|
49
|
+
|
|
50
|
+
receipt:string;
|
|
376
51
|
}
|
|
377
52
|
export interface ImportSubscriptionResponse {
|
|
378
53
|
in_app_subscription:InAppSubscription;
|
|
379
54
|
}
|
|
380
55
|
export interface ImportSubscriptionInputParam {
|
|
381
56
|
|
|
382
|
-
|
|
383
|
-
* @description Parameters for subscription
|
|
384
|
-
|
|
385
|
-
*/
|
|
386
|
-
|
|
387
|
-
subscription?:{currency_code:string,id:string,is_trial?:boolean,product_id:string,started_at:number,term_end:number,term_start:number,transaction_id:string};
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
* @description Parameters for customer
|
|
391
|
-
|
|
392
|
-
*/
|
|
57
|
+
subscription:{currency_code:string,id:string,is_trial?:boolean,product_id:string,started_at:number,term_end:number,term_start:number,transaction_id:string};
|
|
393
58
|
|
|
394
59
|
customer?:{email?:string,id?:string};
|
|
395
60
|
}
|
|
@@ -398,13 +63,6 @@ The following are instructions to obtain the value of the path parameter for the
|
|
|
398
63
|
}
|
|
399
64
|
export interface RetrieveStoreSubsInputParam {
|
|
400
65
|
|
|
401
|
-
/**
|
|
402
|
-
* @description **Apple App Store** : The Base64 encoded [App Store in-app purchase receipt](https://developer.apple.com/documentation/storekit/original_api_for_in-app_purchase/validating_receipts_with_the_app_store?language=objc#overview) taken from the Apple device after successful creation of the in-app purchase subscription.
|
|
403
|
-
|
|
404
|
-
**Google Play Store** : The purchase `token` taken from the Android device after the successful creation of an in-app purchase subscription.
|
|
405
|
-
|
|
406
|
-
*/
|
|
407
|
-
|
|
408
66
|
receipt:string;
|
|
409
67
|
}
|
|
410
68
|
|
|
@@ -238,7 +238,7 @@ declare module 'chargebee' {
|
|
|
238
238
|
|
|
239
239
|
payment_method?:{additional_information?:object,gateway?:Gateway,gateway_account_id?:string,issuing_country?:string,reference_id?:string,tmp_token?:string,type?:Type};
|
|
240
240
|
|
|
241
|
-
payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_payment_method_id?:string,gw_token?:string,id?:string,payment_method_type?:'card' | 'ideal' | 'sofort' | 'bancontact' | 'google_pay' | 'dotpay' | 'giropay' | 'apple_pay' | 'upi' | 'netbanking_emandates' | 'paypal_express_checkout' | 'direct_debit' | 'boleto' | 'venmo' | 'amazon_payments' | 'pay_to' | 'faster_payments' | 'sepa_instant_transfer' | 'klarna_pay_now' | 'online_banking_poland',reference_id?:string};
|
|
241
|
+
payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_payment_method_id?:string,gw_token?:string,id?:string,payment_method_type?:'card' | 'ideal' | 'sofort' | 'bancontact' | 'google_pay' | 'dotpay' | 'giropay' | 'apple_pay' | 'upi' | 'netbanking_emandates' | 'paypal_express_checkout' | 'direct_debit' | 'boleto' | 'venmo' | 'amazon_payments' | 'pay_to' | 'faster_payments' | 'sepa_instant_transfer' | 'klarna_pay_now' | 'online_banking_poland' | 'payconiq_by_bancontact',reference_id?:string};
|
|
242
242
|
|
|
243
243
|
addons?:{date_from?:number,date_to?:number,id?:string,quantity?:number,quantity_in_decimal?:string,unit_price?:number,unit_price_in_decimal?:string}[];
|
|
244
244
|
|
|
@@ -295,7 +295,7 @@ declare module 'chargebee' {
|
|
|
295
295
|
|
|
296
296
|
payment_method?:{additional_information?:object,gateway?:Gateway,gateway_account_id?:string,issuing_country?:string,reference_id?:string,tmp_token?:string,type?:Type};
|
|
297
297
|
|
|
298
|
-
payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_payment_method_id?:string,gw_token?:string,id?:string,payment_method_type?:'card' | 'ideal' | 'sofort' | 'bancontact' | 'google_pay' | 'dotpay' | 'giropay' | 'apple_pay' | 'upi' | 'netbanking_emandates' | 'paypal_express_checkout' | 'direct_debit' | 'boleto' | 'venmo' | 'amazon_payments' | 'pay_to' | 'faster_payments' | 'sepa_instant_transfer' | 'klarna_pay_now' | 'online_banking_poland',reference_id?:string};
|
|
298
|
+
payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_payment_method_id?:string,gw_token?:string,id?:string,payment_method_type?:'card' | 'ideal' | 'sofort' | 'bancontact' | 'google_pay' | 'dotpay' | 'giropay' | 'apple_pay' | 'upi' | 'netbanking_emandates' | 'paypal_express_checkout' | 'direct_debit' | 'boleto' | 'venmo' | 'amazon_payments' | 'pay_to' | 'faster_payments' | 'sepa_instant_transfer' | 'klarna_pay_now' | 'online_banking_poland' | 'payconiq_by_bancontact',reference_id?:string};
|
|
299
299
|
|
|
300
300
|
item_prices?:{date_from?:number,date_to?:number,item_price_id?:string,quantity?:number,quantity_in_decimal?:string,unit_price?:number,unit_price_in_decimal?:string}[];
|
|
301
301
|
|
|
@@ -602,16 +602,6 @@ declare module 'chargebee' {
|
|
|
602
602
|
|
|
603
603
|
include_deleted?:boolean;
|
|
604
604
|
|
|
605
|
-
hide_zero_line_item?:boolean;
|
|
606
|
-
|
|
607
|
-
show_zero_tax_lines?:boolean;
|
|
608
|
-
|
|
609
|
-
show_exempted_tax_lines?:boolean;
|
|
610
|
-
|
|
611
|
-
include_consolidated_invoices?:boolean;
|
|
612
|
-
|
|
613
|
-
ignore_imported_invoice?:boolean;
|
|
614
|
-
|
|
615
605
|
/**
|
|
616
606
|
* @description The invoice number. Acts as a identifier for invoice and typically generated sequentially.
|
|
617
607
|
|
|
@@ -796,10 +786,6 @@ NOTE: Not to be used if *consolidated invoicing* is enabled.
|
|
|
796
786
|
export interface RetrieveInputParam {
|
|
797
787
|
|
|
798
788
|
line_item?:{customer_id?:{is?:string},subscription_id?:{is?:string}};
|
|
799
|
-
|
|
800
|
-
line_items_limit?:number;
|
|
801
|
-
|
|
802
|
-
line_items_offset?:string;
|
|
803
789
|
}
|
|
804
790
|
export interface PdfResponse {
|
|
805
791
|
download:Download;
|
|
@@ -290,13 +290,6 @@ declare module 'chargebee' {
|
|
|
290
290
|
|
|
291
291
|
usage_calculation?:{in?:string,is?:'sum_of_usages' | 'last_usage' | 'max_usage',is_not?:'sum_of_usages' | 'last_usage' | 'max_usage',not_in?:string};
|
|
292
292
|
|
|
293
|
-
/**
|
|
294
|
-
* @description Indicates Whether a plan is grouped(bundle) or not. If it is grouped, it gives us the type of group.
|
|
295
|
-
|
|
296
|
-
*/
|
|
297
|
-
|
|
298
|
-
item_grouping_category?:{in?:string,is?:'non_bundle' | 'fixed',is_not?:'non_bundle' | 'fixed',not_in?:string};
|
|
299
|
-
|
|
300
293
|
/**
|
|
301
294
|
* @description The subscription channel this object originated from and is maintained in.
|
|
302
295
|
|