c# - Apple Pay web 使用 c#(在 ngrok 上测试)
问题描述
我正在尝试使用ngrok测试我的 Apple 支付应用程序。但是,商家验证失败,我没有获得所需的令牌。Apple 支付按钮在我用于测试的 iPhone 上可见。我已使用此链接创建示例应用程序:https ://github.com/justeat/ApplePayJSSample
我得到了以下信息(如上面的 URL 所示)
- pfx 文件(放置在项目路径中)
- 商家验证 txt 文件(放在 .wellknown 文件夹中)
- 域名在apple pay网站上通过验证
有人可以建议如何测试应用程序吗?或者商户验证失败的可能原因?
requestUri 应该是什么(test 和 Prod 是否不同?),显示名称可以是任何东西还是特定于证书?
JsonDocument merchantSession;
if (!ModelState.IsValid ||
string.IsNullOrWhiteSpace(model?.ValidationUrl) ||
!Uri.TryCreate(model.ValidationUrl, UriKind.Absolute, out Uri requestUri))
{
return BadRequest();
}
// Create the JSON payload to POST to the Apple Pay merchant validation URL.
var request = new MerchantSessionRequest()
{
DisplayName = _options.StoreName,
Initiative = "web",
InitiativeContext = Request.GetTypedHeaders().Host.Value,
MerchantIdentifier = _ApplePayServieBusiness.GetMerchantIdentifier(),
};
merchantSession = await _ApplePayServieBusiness.GetMerchantSessionAsync(requestUri, request, cancellationToken);
更新: 我已将用于 MerchantValidation 的步骤放在以下链接中。但是,我仍然无法在 site.js https://github.com/justeat/ApplePayJSSample/issues/68#issuecomment-795687727中点击 onpaymentauthorized 函数
解决方案
推荐阅读
- rest - Linkedin Ads API What's the format of the `dateRange` request parameter?
- speech-recognition - 是否可以从一个帐户同时执行两个语音到文本流?
- r - 有没有办法生成一个新变量,以 R Studio 中其他两个变量中的不同文本值为条件
- python - 如何使用 Python re.split() 制作 ['key=value', 'k=v', 'k=v'] 的列表(不是字典)?
- vis.js - 如何只保留两个节点之间的边?
- java - 无法使用 java 1.8 更新 docker 容器
- python - 使用 Tableauserverclient python 和源用户名和密码刷新数据源
- javascript - array.splice() 删除错误的元素
- python - 如何在 Python 循环期间从列表中的元素设置值。数独求解器
- r - R:条形图标签的不同颜色