我正在尝试使用PhoneGap构建使用Apple Pay Cordova插件。这是我在配置文件中的条目:
<plugin name="cordova-plugin-applepay-stripe" source="npm">
<param name="STRIPE_TEST_PUBLISHABLE_KEY" value="xxxxxxxx" />
<param name="STRIPE_LIVE_PUBLISHABLE_KEY" value="xxxxxxxxx" />
<param name="APPLE_MERCHANT_IDENTIFIER" value="merchant.etc.etc" />
</plugin>
插件安装正确,但是它不起作用,因为我在使用PC时尚未启用Xcode的应用付费权利。
我知道您可以像我在此处完成的Phonegap Build Config.xml文件直接编辑PLIST文件:
<gap:config-file platform="ios" parent="NSPhotoLibraryUsageDescription" overwrite="true">
<string>We are using the Photo Library for PayPal</string>...
所以我的问题是我如何编辑wither.plist文件,以便我可以启用ApplePay并添加我的商户ID?!
我尝试了以下内容:
<config-file platform="ios" target="*-Entitlements.plist" parent="com.apple.developer.in-app-payments">
<array>
<string>merchant.etc.etc/string>
</array>
</config-file>
但这没有奏效。任何帮助,将不胜感激!
出于某种原因,config-file
似乎仅在插件中工作。似乎它应该在您的项目config.xml
中起作用,但不幸的是,它不可能。但是,您可以使用本地插件来管理您的权利以实现或多或少相同的效果。
例如,src/local-plugins/app-entitlements
将其添加到您的config.xml
<plugin name="app-entitlements" spec="src/local-plugins/app-entitlements" />
您只需要src/local-plugins/app-entitlements/plugin.xml
文件:
<?xml version="1.0" encoding="UTF-8"?>
<plugin id="app-entitlements" version="0.0.0" xmlns="http://apache.org/cordova/ns/plugins/1.0">
<name>AppEntitlements</name>
<platform name="ios">
<config-file target="*-Debug.plist" parent="com.apple.developer.in-app-payments">
<array>
<string>YOUR DEBUG MERCHANT ID HERE</string>
</array>
</config-file>
<config-file target="*-Release.plist" parent="com.apple.developer.in-app-payments">
<array>
<string>YOUR RELEASE MERCHANT ID HERE</string>
</array>
</config-file>
</platform>
</plugin>
您当然可以设置其他权利,例如推送通知或您想要的任何内容。
现在,当您进行新的cordova platform add ios
时,应该用这些键创建Entitlements-*.plist
,您应该很好。
请牢记,Xcode中的"功能"选项卡是单独处理的,只是GUI助手。它不会反映这些文件的权利。