从单独的 Swift Framework/Module 使用 Apple Pay
Use Apple Pay from a separate Swift Framework/Module
我想创建一个能够通过 Apple Pay 付款的框架。在一个普通的应用程序中,我需要创建商家并在 iOS 应用程序中设置 Apple Pay 功能。但是,我的目标不是 iOS 应用程序,而是 Swift 框架!
将使用我的 Swift 框架的项目具有讽刺意味,已经具有 Apple Pay 功能及其自己的商家和权利。但是在应用程序执行的某个场景中,我需要为我自己的商家展示我自己的 Apple Pay 账单屏幕,我必须从我的非主模块,非主包,从一个框架来做这件事。
问题是:我如何为我的框架配置 Apple Pay,以允许同一应用中的 2 个商户能够付款?
或者:如果我要求将集成我的 SDK 的应用程序将我的 merchantId
添加到其 Apple Pay 权利中,以便我使用此 merchantId
创建 PKPaymentRequest
s 怎么办?
How can I configure Apple Pay for my framework in a way that allows 2 merchants in a same app to be able to bill?
这很简单,merchantId 只需要在他们的权利中,他们应该将其传递到框架中。
What if I ask the App that uses the SDK to add my merchant ID to its own Apple Pay configuration so that I use the same Apple Pay merchant ID to create PKPaymentRequest?
他们的代码将无法编译,因为权利中的 merchantId 必须 来自他们自己的开发者帐户。
在您的场景中正确的做法是:
- 请他们为他们的帐户创建一个 merchantId
- 请他们创建证书并将其传递给您
- 使用您的获取系统将证书配置为您自己的证书
- 确保在集成 SDK 中付款时使用此 merchantId
我想创建一个能够通过 Apple Pay 付款的框架。在一个普通的应用程序中,我需要创建商家并在 iOS 应用程序中设置 Apple Pay 功能。但是,我的目标不是 iOS 应用程序,而是 Swift 框架!
将使用我的 Swift 框架的项目具有讽刺意味,已经具有 Apple Pay 功能及其自己的商家和权利。但是在应用程序执行的某个场景中,我需要为我自己的商家展示我自己的 Apple Pay 账单屏幕,我必须从我的非主模块,非主包,从一个框架来做这件事。
问题是:我如何为我的框架配置 Apple Pay,以允许同一应用中的 2 个商户能够付款?
或者:如果我要求将集成我的 SDK 的应用程序将我的 merchantId
添加到其 Apple Pay 权利中,以便我使用此 merchantId
创建 PKPaymentRequest
s 怎么办?
How can I configure Apple Pay for my framework in a way that allows 2 merchants in a same app to be able to bill?
这很简单,merchantId 只需要在他们的权利中,他们应该将其传递到框架中。
What if I ask the App that uses the SDK to add my merchant ID to its own Apple Pay configuration so that I use the same Apple Pay merchant ID to create PKPaymentRequest?
他们的代码将无法编译,因为权利中的 merchantId 必须 来自他们自己的开发者帐户。
在您的场景中正确的做法是:
- 请他们为他们的帐户创建一个 merchantId
- 请他们创建证书并将其传递给您
- 使用您的获取系统将证书配置为您自己的证书
- 确保在集成 SDK 中付款时使用此 merchantId