自定义应用

自定义应用是您或开发者专门为您的 Shopify 商店开发的应用(与公共应用不同,公共应用是为很多商店构建的)。使用自定义应用,您可以在 Shopify 后台内添加功能、使用 Shopify API 直接访问商店数据或者使用店面 API 将在线商店扩展至其他平台。

创建自定义应用需要开发知识并且可能具有难度。如果您需要为商店创建自定义应用方面的帮助,那么您可以聘请 Shopify 专家。

如果您希望让合作者账户或员工账户来创建、编辑或删除自定义应用,可以向其授予开发应用权限。合作者账户或员工账户还必须具有相关权限才能设置某些 API 范围。


本页相关主题

  • 从 Shopify 后台启用自定义应用开发

  • 创建和安装自定义应用

  • 获取自定义应用的 API 凭据

  • 更新自定义应用的后台 API 范围

  • 更新自定义应用的店面 API 访问范围

  • 更新自定义应用的设置

  • 卸载自定义应用

  • 删除自定义应用

  • 自定义应用的 API 范围权限

从 Shopify 后台启用自定义应用开发

您需要先启用自定义应用开发,然后才能为商店创建自定义应用。只有店主才能启用自定义应用开发。

步骤:

  1. 在 Shopify 后台中,转到应用

  2. 点击开发应用

  3. 点击允许自定义应用开发

  4. 阅读提供的警告和信息,然后点击允许自定义应用开发


创建和安装自定义应用

启用自定义应用开发后,您可以在 Shopify 后台中创建和安装自定义应用。您需要设置 API 范围,以确定自定义应用可以访问商店的哪些部分。安装应用后,您将收到访问令牌,应用将使用这些访问令牌通过 Shopify API 访问商店信息。

店主以及具有相关权限的合作者和员工可以创建和安装自定义应用。

创建应用

  1. 在 Shopify 后台中,转到应用

  2. 点击开发应用

  3. 点击创建自定义应用

  4. 在模态窗口中,输入应用名称并选择应用开发人员。应用开发人员可以是店主,也可以是具有开发应用权限的任何员工或合作者账户。

  5. 点击创建应用

选择 API 范围

创建自定义应用后,您可以为其分配 API 范围。自定义应用可以具有后台 API 范围和/或店面 API 范围,具体取决于应用的要求。

  1. 点击选择范围

  2. 后台 API 访问范围部分中,选择向应用分配的 API 范围。

    1. 可选:设置要用于 Webhook 订阅的 API 版本。

    2. 可选:您可以设置 Google Cloud Pub/Sub 来处理应用的 Webhook 订阅。在 Google Cloud Pub/Sub 部分中,复制您的 Shopify 服务账户地址,并使用它来配置您的 Google Cloud Pub/Sub 账户。

    3. 可选:您可以设置 Amazon EventBridge 来处理应用的 Webhook 订阅。在 Amazon EventBridge 部分中,点击创建源

  3. 店面 API 访问范围部分中,选择要向应用分配的 API 范围。


  4. 点击保存

安装应用并获取 API 访问令牌

为应用设置 API 范围后,就可以安装应用。安装后,您将获得 API 访问令牌。根据您分配给应用的 API 范围,您将获得后台 API 访问令牌和/或店面 API 访问令牌。

  1. 点击安装应用

  2. 在模态窗口中,点击安装应用

  3. 获取访问令牌:

  • 如果您为应用选择了后台 API 范围,请转到后台 API 访问令牌部分,然后点击显示一次令牌

  • 如果您为应用选择了店面 API 范围,则可以转到店面 API 访问令牌部分并复制令牌。与后台 API 访问令牌不同,店面 API 访问令牌始终显示在此页面上。

显示一次完整访问令牌后,此页面仅显示访问令牌的后 4 位数以供参考。


获取自定义应用的 API 凭据

您可以在应用的 API 凭据页面查看自定义应用的店面访问令牌、API 密钥和 API 加密密钥。您还可以查看后台 API 访问令牌,但在该令牌显示了一次后,您只能查看该令牌的后四位数。

备注:API 加密密钥与共享加密密钥相同。如果开发人员请求提供共享加密密钥,请提供您的 API 加密密钥。请务必仅与信任的开发人员共享您的 API 加密密钥。

  1. 在 Shopify 后台中,转到应用

  2. 点击开发应用

  3. 点击您要获取凭据的应用的名称。

  4. 点击 API 凭据


更新自定义应用的后台 API 范围

如果您是店主或是具有相关权限的合作者或员工,您可以更新自定义应用的范围。

  1. 在 Shopify 后台中,转到应用

  2. 点击开发应用

  3. 点击您要更新的应用的名称。

  4. 点击配置

  5. 后台 API 集成部分中,点击编辑

如果您之前没有分配任何后台 API 范围,请点击配置

  1. 选择要分配给应用的范围。

  2. 可选:设置要用于 Webhook 订阅的 API 版本。

  3. 可选:您可以设置 Google Cloud Pub/Sub 来处理应用的 Webhook 订阅。在 Google Cloud Pub/Sub 部分中,复制您的 Shopify 服务账户地址,并使用它来配置您的 Google Cloud Pub/Sub 账户。

  4. 可选:您可以设置 Amazon EventBridge 来处理应用的 Webhook 订阅。在 Amazon EventBridge 部分中,点击创建源

  5. 点击保存

如果商店中安装了该应用,那么除非至少选择了一个范围,或者为应用分配了店面 API 范围,否则无法点击保存


更新自定义应用的店面 API 访问范围

如果您是店主或是具有相关权限的合作者或员工,您可以更新自定义应用的范围。

  1. 在 Shopify 后台中,转到应用

  2. 点击开发应用

  3. 点击您要更新的应用的名称。

  4. 点击配置

  5. 店面 API 集成部分中,点击编辑

如果您之前没有分配任何店面 API 范围,请点击配置

  1. 选择要分配给应用的范围。

  2. 可选:如果您的应用集成了 iOS Buy SDK,那么您可以在 iOS Buy SDK 部分中进行任何必要的更改。如果已安装应用,那么您只能在此部分中进行更改。

有关详细信息,请参阅 iOS Buy SDK 开发者文档。

  1. 可选:如果您的应用集成了 Android Buy SDK,那么您可以在 Android Buy SDK 部分中进行任何必要的更改。如果已安装应用,那么您只能在此部分中进行更改。

有关详细信息,请参阅 Android Buy SDK 开发人员文档。

  1. 点击保存

如果商店中安装了该应用,那么除非至少选择了一个范围,或者为应用分配了店面 API 范围,否则无法点击保存


更新自定义应用的设置

您可以更新应用的名称、描述以及应用开发者。

如果您将应用开发者设置为员工或合作者账户,然后删除该账户,则默认情况下,店主将成为应用开发者。

  1. 在 Shopify 后台中,转到应用

  2. 点击开发应用

  3. 点击您要更新的应用的名称。

  4. 点击应用设置

  5. 若要更改名称或描述,请输入新的应用名称应用描述

  6. 若要更改与应用关联的应用开发者,请选择应用开发者

  7. 点击保存


卸载自定义应用

卸载自定义应用时,您的后台和店面 API 访问令牌将被撤销,并且您的应用无法访问商店数据。如果您重新安装该应用,您将获得新的访问令牌。

  1. 在 Shopify 后台中,转到应用

  2. 点击开发应用

  3. 点击您要卸载的应用的名称。

  4. 点击卸载应用


删除自定义应用

删除自定义应用后,无法恢复该应用。如果您想暂时禁用商店上的应用而不将其删除,请改为卸载应用。

  1. 在 Shopify 后台中,转到应用

  2. 点击开发应用

  3. 点击应用设置

  4. 点击删除应用


自定义应用的 API 范围权限

只有当账户拥有开发应用权限以及与所设置的 API 范围相关的任何其他员工权限时,合作者账户和员工账户才能为自定义应用设置 API 范围。

您应咨询应用的开发人员,以确定自定义应用需要哪些账户权限和 API 范围才能正常工作。请确保您了解并熟悉您向开发人员授予的权限。

Shopify商户官网原文详情:

Custom apps

A custom app is an app that you or a developer builds exclusively for your Shopify store (unlike a public app, which is built to be used by many stores). You can use custom apps to add features to your Shopify admin, access your store's data directly using Shopify's APIs, or extend your online store to other platforms using the Storefront API.

Creating a custom app requires development knowledge and can be challenging. If you need help creating custom apps for your store, then you can hire a Shopify expert.

If you want a collaborator or staff account to create, edit, or delete custom apps, then you can give them the Develop apps permission. The collaborator or staff account must also have the relevant permissions to set certain API scopes.


On this page

  • Enable custom app development from the Shopify admin

  • Create and install a custom app

  • Get the API credentials for a custom app

  • Update Admin API scopes for a custom app

  • Update Storefront API access scopes for a custom app

  • Update settings for a custom app

  • Uninstall a custom app

  • Delete a custom app

  • API scope permissions for custom apps

Enable custom app development from the Shopify admin

Before you can create a custom app for your store, you need to enable custom app development. Only the store owner can enable custom app development.

Steps:

  1. From your Shopify admin, go to Apps.

  2. Click Develop apps.

  3. Click Allow custom app development.

  4. Read the warning and information provided, and then click Allow custom app development.


Create and install a custom app

After you've enabled custom app development, you can create and install a custom app in your Shopify admin. You need to set API scopes to determine which parts of your store the custom app can access. After the app is installed, you'll receive access tokens that the app uses to access information from your store using Shopify's APIs.

The store owner, and collaborators and staff members with the relevant permissions, can create and install custom apps.

Create the app

  1. From your Shopify admin, go to Apps.

  2. Click Develop apps.

  3. Click Create a custom app.

  4. In the modal window, enter the App name and select an App developer. The app developer can be the store owner, or any staff or collaborator account with the Develop apps permission.

  5. Click Create app.

Select API scopes

After you create a custom app, you can assign API scopes to it. A custom app can have Admin API scopes, Storefront API scopes, or both, depending on the requirements of the app.

  1. Click Select scopes.

  2. In the Admin API access scopes section, select the API scopes that you to assign to the app.

    1. Optional: Set the API version you want to use for webhook subscriptions.

    2. Optional: You can set up Google Cloud Pub/Sub to handle webhook subscriptions for the app. In the Google Cloud Pub/Sub section, copy your Shopify service account address and use it to configure your Google Cloud Pub/Sub account.

    3. Optional: You can set up Amazon EventBridge to handle webhook subscriptions for the app. In the Amazon EventBridge section, click Create source.

  3. In the Storefront API access scopes section, select the API scopes that you want to assign to the app.


  4. Click Save.

Install the app and get the API access tokens

After you've set API scopes for your app, you can install the app. You'll get your API access tokens after you install. Depending on what API scopes you assigned to the app, you'll get an Admin API access token, a Storefront API access token, or both.

  1. Click Install app.

  2. In the modal window, click Install app.

  3. Get the access token:

  • If you selected Admin API scopes for the app, then go to the Admin API access token section and click Reveal token once.



  • If you selected Storefront API scopes for the app, then you can go to the Storefront API access token section and copy your token. Unlike the Admin API access token, the Storefront API access token is always available on this page.

After revealing the full access token once, this page displays only the last 4 digits of the access token for reference.


Get the API credentials for a custom app

You can check the Storefront access token, the API key, and the API secret for a custom app from the app's API credentials page. You can also check the Admin API access token, but after revealing it once, you can only check the last four digits of the token.

  1. From your Shopify admin, go to Apps.

  2. Click Develop apps.

  3. Click the name of the app that you want the credentials for.

  4. Click API credentials.


Update Admin API scopes for a custom app

If you're a store owner, or a collaborator or staff member with the relevant permissions, then you can update the scopes for a custom app.

  1. From your Shopify admin, go to Apps.

  2. Click Develop apps.

  3. Click the name of the app that you want to update.

  4. Click Configuration.

  5. In the Admin API integration section, click Edit.

If you haven't previously assigned any Admin API scopes, then click Configure.

  1. Select the scopes that you want to assign to the app.

  2. Optional: Set the API version you want to use for webhook subscriptions.

  3. Optional: You can set up Google Cloud Pub/Sub to handle webhook subscriptions for the app. In the Google Cloud Pub/Sub section, copy your Shopify service account address and use it to configure your Google Cloud Pub/Sub account.

  4. Optional: You can set up Amazon EventBridge to handle webhook subscriptions for the app. In the Amazon EventBridge section, click Create source.

  5. Click Save.

If the app is installed on the store, then you won't be able to click Save unless at least one scope is selected, or if the app has been assigned Storefront API scopes.


Update Storefront API access scopes for a custom app

If you're a store owner, or a collaborator or staff member with the relevant permissions, then you can update the scopes for a custom app.

  1. From your Shopify admin, go to Apps.

  2. Click Develop apps.

  3. Click the name of the app that you want to update.

  4. Click Configuration.

  5. In the Storefront API integration section, click Edit.

If you haven't previously assigned any Storefront API scopes, then click Configure.

  1. Select the scopes that you want to assign to the app.

  2. Optional: If your app integrates with the iOS Buy SDK, then you can make any necessary changes in the iOS Buy SDK section. You can only make changes in this section if the app has already been installed.

Refer to the iOS Buy SDK developer documentation for more detailed instructions.

  1. Optional: If your app integrates with the Android Buy SDK, then you can make any necessary changes in the Android Buy SDK section. You can only make changes in this section if the app has already been installed.

Refer to the Android Buy SDK developer documentation for more detailed instructions.

  1. Click Save.

If the app is installed on the store, then you won't be able to click Save unless at least one scope is selected, or if the app has been assigned Storefront API scopes.


Update settings for a custom app

You can update the name and description of the app, as well as the app developer.

If you set the app developer to a staff or collaborater account, and later delete that account, then the store owner becomes the app developer by default.

  1. From your Shopify admin, go to Apps.

  2. Click Develop apps.

  3. Click the name of the app that you want to update.

  4. Click App settings.

  5. To change the name or description, enter a new App name or App description.

  6. To change the app developer that's associated with the app, select an App developer.

  7. Click Save.


Uninstall a custom app

When you uninstall a custom app, your Admin and Storefront API access tokens are revoked, and your app can't access store data. If you re-install the app, you'll get new access tokens.

  1. From your Shopify admin, go to Apps.

  2. Click Develop apps.

  3. Click the name of the app that you want to uninstall.

  4. Click Uninstall app.


Delete a custom app

When you delete a custom app, it can't be recovered. If you want to temporarily disable an app on your store without deleting it, uninstall the app instead.

  1. From your Shopify admin, go to Apps.

  2. Click Develop apps.

  3. Click App settings.

  4. Click Delete app.


API scope permissions for custom apps

Collaborator and staff accounts can set API scopes for custom apps only if the account has the Develop apps permission, as well as any other staff permissions related to the API scopes that they set.

You should consult with your app's developer to determine which account permissions and API scopes are required for the custom app to work. Make sure that you understand and are comfortable with the permissions that you give to the developer.


文章内容来源:Shopify商户官方网站

(本文内容根据网络资料整理,出于传递更多信息之目的,不代表连连国际赞同其观点和立场)