Skip to content

Commit

Permalink
File src/content/docs/en/sdk/cordova/v4/features/subscriptions.mdx wa…
Browse files Browse the repository at this point in the history
…s translated to zh-CN locale
  • Loading branch information
smartling-github-connector[bot] authored Jan 14, 2025
1 parent 2a29fc6 commit 907208b
Showing 1 changed file with 79 additions and 96 deletions.
175 changes: 79 additions & 96 deletions src/content/docs/zh/sdk/cordova/v4/features/subscriptions.mdx
Original file line number Diff line number Diff line change
@@ -1,46 +1,45 @@
---
title: Send subscription information
description: Use these methods send subscription information to Adjust.
slug: zh/sdk/cordova/v4/features/subscriptions
versions:
- label: v5
value: v5
default: true
- label: v4
value: v4
redirects:
v5: /zh/sdk/cordova/features/subscriptions
title: "发送订阅信息"
description: "使用这些方法向 Adjust 发送订阅信息。"
slug: "en/sdk/cordova/v4/features/subscriptions"
versions:
-
label: "v5"
value: "v5"
default: true
-
label: "v4"
value: "v4"
redirects:
v5: "/en/sdk/cordova/features/subscriptions"
---
<callout type="important">

<Callout type="important">
下列步骤仅会在 Adjust SDK 中设置订阅监测。要启用该功能,请按照[为应用设置订阅监测](https://help.adjust.com/en/article/set-up-subscriptions-for-your-app)中的步骤操作。
</Callout>

下列步骤仅会在 Adjust SDK 中设置订阅监测。要启用该功能,请按照[为应用设置订阅监测](https://help.adjust.com/zh/article/set-up-subscriptions-for-your-app)中的步骤操作
您可以用 Adjust SDK 记录 App Store 和 Play 应用商店的订阅,并验证这些订阅是否有效。用户购买订阅后,创建一个包含细节的 `AdjustAppStoreSubscription``AdjustPlayStoreSubscription` 实例

</Callout>
1\. 实例化订阅对象\{\#instantiate\-a\-subscription\-object\}
------------------------------------------------------------

You can record App Store and Play Store subscriptions and verify their validity with the Adjust SDK. After the user purchases a subscription, create an `AdjustAppStoreSubscription` or `AdjustPlayStoreSubscription` instance containing the details.

## 1\. Instantiate a subscription object \{\#instantiate\-a\-subscription\-object\}

To get started, you need to create a subscription object containing details of the subscription purchase.

<Tabs>
<Tab title="App Store" sync="appstore" icon="PlatformIos"> <CodeBlock title="Method signature">
要开始设置,先创建一个包含订阅购买细节的订阅对象。
<tabs> <tab title="App Store" sync="appstore" icon="PlatformIos"> <codeblock title="方法签名">

```js
constructor(price: string, currency: string, transactionId: string, receipt: string)
```

</CodeBlock>
</CodeBlock>

Create an `AdjustAppStoreSubscription` object with the following properties:
创建一个 `AdjustAppStoreSubscription` 对象,属性如下:

| Parameter | Data type | Description |
| --------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `price` | Number | The price of the subscription |
| `currency` | String | The currency of the subscription. Formatted as the [`currencyCode`](https://developer.apple.com/documentation/foundation/nslocale/1642836-currencycode?language=objc) of the [`priceLocale`](https://developer.apple.com/documentation/storekit/skproduct/1506145-pricelocale?language=objc) object |
| `transactionId` | String | Your ID for the transaction |
| `receipt` | String | The receipt information |
| 参数 | 数据类型 | 描述 |
|-----------------|------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `price` | 数字 | 订阅价格 |
| `currency` | 字符串 | 订阅使用的币种。此信息格式为 [`priceLocale`](https://developer.apple.com/documentation/foundation/nslocale/1642836-currencycode?language=objc) 对象的 [`currencyCode`](https://developer.apple.com/documentation/storekit/skproduct/1506145-pricelocale?language=objc) |
| `transactionId` | 字符串 | 您的交易 ID |
| `receipt` | 字符串 | 收据信息 |

```js
var subscription = new AdjustAppStoreSubscription(
Expand All @@ -51,25 +50,24 @@ var subscription = new AdjustAppStoreSubscription(
);
```

</Tab>
<Tab title="Play Store" sync="playstore" icon="PlatformGooglePlay"> <CodeBlock title="Method signature">
</Tab> <tab title="Play 商店" sync="playstore" icon="PlatformGooglePlay"> <codeblock title="方法签名">

```js
constructor(price: string, currency: string, sku: string, orderId: string, signature: string, purchaseToken: string)
```

</CodeBlock>
</CodeBlock>

Create an `AdjustPlayStoreSubscription` object with the following properties:
创建一个 `AdjustPlayStoreSubscription` 对象,属性如下:

| Parameter | Data type | Description |
| --------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `price` | Number | The price of the subscription |
| `currency` | String | The currency of the subscription |
| `sku` | String | The ID of the product |
| `orderId` | String | Your ID for the transaction |
| `signature` | String | The signature of the purchase data |
| `purchaseToken` | String | The unique token of the transaction. See [Google's documentation](<https://developer.android.com/reference/com/android/billingclient/api/Purchase#getPurchaseToken()>) for more information |
| 参数 | 数据类型 | 描述 |
|-----------------|------|------------------------------------------------------------------------------------------------------------------------------------|
| `price` | 数字 | 订阅价格 |
| `currency` | 字符串 | 订阅使用的币种 |
| `sku` | 字符串 | 产品 ID |
| `orderId` | 字符串 | 您的交易 ID |
| `signature` | 字符串 | 购买数据的签名 |
| `purchaseToken` | 字符串 | 交易唯一识别码。请参考[Google 的文档](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getPurchaseToken()),了解更多信息。 |

```js
var subscription = new AdjustPlayStoreSubscription(
Expand All @@ -82,23 +80,20 @@ var subscription = new AdjustPlayStoreSubscription(
);
```

</Tab>
</Tabs>

### Record the purchase date {#record-the-purchase-date}
</Tab> </Tabs>

You can record the date on which the user purchased a subscription. The SDK returns this data for you to report on.
### 记录购买日期\{\#record\-the\-purchase\-date\}

<Tabs>
<Tab title="App Store" sync="appstore" icon="PlatformIos"> <CodeBlock title="Method signature">
您可以记录用户购买订阅的日期。SDK 会返回该数据用于报告。
<tabs> <tab title="App Store" sync="appstore" icon="PlatformIos"> <codeblock title="方法签名">

```js
setTransactionDate(transactionDate: string): void
```

</CodeBlock>
</CodeBlock>

Call the `setTransactionDate` method on your subscription object to record the timestamp of the subscription.
在您的订阅对象上调用 `setTransactionDate` 方法来记录订阅的时间戳。

```js
var subscription = new AdjustAppStoreSubscription(
Expand All @@ -111,16 +106,15 @@ var subscription = new AdjustAppStoreSubscription(
subscription.setTransactionDate(transactionDate);
```

</Tab>
<Tab title="Play Store" sync="playstore" icon="PlatformGooglePlay"> <CodeBlock title="Method signature">
</Tab> <tab title="Play 商店" sync="playstore" icon="PlatformGooglePlay"> <codeblock title="方法签名">

```js
setPurchaseTime(purchaseTime: string): void
```

</CodeBlock>
</CodeBlock>

Call the `setPurchaseTime` method on your subscription object to record the timestamp of the subscription.
在您的订阅对象上调用 `setPurchaseTime` 方法来记录订阅的时间戳。

```js
var subscription = new AdjustPlayStoreSubscription(
Expand All @@ -134,20 +128,19 @@ var subscription = new AdjustPlayStoreSubscription(
subscription.setPurchaseTime(purchaseTime);
```

</Tab>
</Tabs>
</Tab> </Tabs>

### Record the purchase region \(iOS only\) {#record-the-purchase-region-ios-only}
### 记录购买地区 \(仅限 iOS\)\{\#record\-the\-purchase\-region\-ios\-only\}

<CodeBlock title="Method signature">
<codeblock title="方法签名">

```js
setSalesRegion(salesRegion: string): void
```

</CodeBlock>
</CodeBlock>

You can record the region in which the user purchased a subscription. To do this, call the `setSalesRegion` method on your subscription object and pass the country code as a `string`. This needs to be formatted as the [`countryCode`](https://developer.apple.com/documentation/storekit/storefront/3792000-countrycode) of the [`Storefront`](https://developer.apple.com/documentation/storekit/storefront) object.
您可以记录用户购买订阅的地区。为此,请在订阅对象上调用 `setSalesRegion` 方法并将国家代码作为 `string` 传递。此信息格式需为 [`Storefront`](https://developer.apple.com/documentation/storekit/storefront/3792000-countrycode) 对象的 [`countryCode`](https://developer.apple.com/documentation/storekit/storefront)

```js
var subscription = new AdjustAppStoreSubscription(
Expand All @@ -160,18 +153,16 @@ var subscription = new AdjustAppStoreSubscription(
subscription.setSalesRegion(salesRegion);
```

### Add callback parameters {#add-callback-parameters}
### 添加回传参数\{\#add\-callback\-parameters\}

You can add callback parameters to your subscription object. The SDK appends these parameters to your callback URL. To add callback parameters, call the `addCallbackParameter` method on your subscription object. You can add multiple callback parameters by calling this method multiple times.

<Tabs>
<Tab title="App Store" sync="appstore" icon="PlatformIos"> <CodeBlock title="Method signature">
您可以向订阅对象附加回传参数。SDK 会将这些参数附加至您的回传 URL。要添加回传参数,请在订阅对象上调用 `addCallbackParameter` 方法。多次调用该方法可添加多个回传参数。
<tabs> <tab title="App Store" sync="appstore" icon="PlatformIos"> <codeblock title="方法签名">

```js
addCallbackParameter(key: string, value: string): void
```

</CodeBlock>
</CodeBlock>

```js
var subscription = new AdjustAppStoreSubscription(
Expand All @@ -185,14 +176,13 @@ subscription.addCallbackParameter("key1", "value1");
subscription.addCallbackParameter("key2", "value2");
```

</Tab>
<Tab title="Play Store" sync="playstore" icon="PlatformGooglePlay"> <CodeBlock title="Method signature">
</Tab> <tab title="Play 商店" sync="playstore" icon="PlatformGooglePlay"> <codeblock title="方法签名">

```js
addCallbackParameter(key: string, value: string): void
```

</CodeBlock>
</CodeBlock>

```js
var subscription = new AdjustPlayStoreSubscription(
Expand All @@ -208,21 +198,18 @@ subscription.addCallbackParameter("key1", "value1");
subscription.addCallbackParameter("key2", "value2");
```

</Tab>
</Tabs>

### Add partner parameters {#add-partner-parameters}
</Tab> </Tabs>

You can add partner parameters to your subscription object. The SDK sends these to Adjust's servers when the user purchases a subscription. Adjust's servers forward the information on to your network partner. To add partner parameters, call the `addPartnerParameter` method on your subscription object. You can add multiple partner parameters by calling this method multiple times.
### 添加合作伙伴参数\{\#add\-partner\-parameters\}

<Tabs>
<Tab title="App Store" sync="appstore" icon="PlatformIos"> <CodeBlock title="Method signature">
您可以向订阅对象附加合作伙伴参数。用户购买订阅时,SDK 会将这些参数发送至 Adjust 服务器。Adjust 服务器会将此信息转发至您的合作伙伴。要添加合作伙伴参数,请在您的订阅对象上调用`addPartnerParameter`方法。多次调用该方法可添加多个合作伙伴参数。
<tabs> <tab title="App Store" sync="appstore" icon="PlatformIos"> <codeblock title="方法签名">

```js
addPartnerParameter(key: string, value: string): void
```

</CodeBlock>
</CodeBlock>

```js
var subscription = new AdjustAppStoreSubscription(
Expand All @@ -236,14 +223,13 @@ subscription.addPartnerParameter("key1", "value1");
subscription.addPartnerParameter("key2", "value2");
```

</Tab>
<Tab title="Play Store" sync="playstore" icon="PlatformGooglePlay"> <CodeBlock title="Method signature">
</Tab> <tab title="Play 商店" sync="playstore" icon="PlatformGooglePlay"> <codeblock title="方法签名">

```js
addPartnerParameter(key: string, value: string): void
```

</CodeBlock>
</CodeBlock>

```js
var subscription = new AdjustPlayStoreSubscription(
Expand All @@ -259,23 +245,21 @@ subscription.addPartnerParameter("key1", "value1");
subscription.addPartnerParameter("key2", "value2");
```

</Tab>
</Tabs>
</Tab> </Tabs>

## 2\. Record subscription information \{\#record\-subscription\-information\}
2\. 记录订阅信息\{\#record\-subscription\-information\}
-------------------------------------------------------

Once you have set up your subscription object, you can record it using the Adjust SDK.

<Tabs>
<Tab title="App Store" sync="appstore" icon="PlatformIos"> <CodeBlock title="Method signature">
设置好订阅对象后,您就可以通过 Adjust SDK 对其进行记录了。
<tabs> <tab title="App Store" sync="appstore" icon="PlatformIos"> <codeblock title="方法签名">

```js
trackAppStoreSubscription(subscription: AdjustAppStoreSubscription): void
```

</CodeBlock>
</CodeBlock>

Pass your subscription object to the `trackAppStoreSubscription` method to record the user's subscription purchase.
将订阅对象传送至 `trackAppStoreSubscription` 方法,以记录用户订阅购买。

```js
var subscription = new AdjustAppStoreSubscription(
Expand All @@ -294,16 +278,15 @@ subscription.addPartnerParameter("key2", "value2");
Adjust.trackAppStoreSubscription(subscription);
```

</Tab>
<Tab title="Play Store" sync="playstore" icon="PlatformGooglePlay"> <CodeBlock title="Method signature">
</Tab> <tab title="Play 商店" sync="playstore" icon="PlatformGooglePlay"> <codeblock title="方法签名">

```js
trackPlayStoreSubscription(subscription: AdjustPlayStoreSubscription): void
```

</CodeBlock>
</CodeBlock>

Pass your subscription object to the `trackPlayStoreSubscription` method to record the user's subscription purchase.
将订阅对象传送至 `trackPlayStoreSubscription` 方法,以记录用户订阅购买。

```js
var subscription = new AdjustPlayStoreSubscription(
Expand All @@ -323,5 +306,5 @@ subscription.addPartnerParameter("key2", "value2");
Adjust.trackPlayStoreSubscription(subscription);
```

</Tab>
</Tabs>
</Tab> </Tabs>

0 comments on commit 907208b

Please sign in to comment.