简体   繁体   English

ApplePay 未在使用 Braintree 的 web 应用程序中显示

[英]ApplePay not showing in web application using Braintree

I'm trying to implement Apple Pay into an existing react application that is using Braintree to manage payments.我正在尝试将 Apple Pay 实施到使用 Braintree 管理付款的现有反应应用程序中。 Specifically, the project is using braintree-web-drop-in .具体来说,该项目正在使用Braintree-web-drop-in

The application is already successfully handling payments for both credit cards and paypal, I am just trying to get Apple Pay support added.该应用程序已经成功处理信用卡和 paypal 的付款,我只是想添加 Apple Pay 支持。 I believe there's are a couple of ways to implement Dropin, but currently dropin.create() is what's used on the project.我相信有几种方法可以实现 Dropin,但目前dropin.create()是项目中使用的方法。

According to the documentation (linked above), all that's needed is to provide an applePay property to the create() method's options parameter, which I have done like so:根据文档(上面链接),所需要的只是为create()方法的options参数提供一个applePay属性,我已经这样做了:

createPaymentForm() {
  const total = this.getTotal();
  const displayTotal = total.toFormat('$0.00'); 

  const paypalConfig = config.payPalEnabled && { paypal: { flow: 'vault' } };
  const applePayConfig = config.applePayEnabled && {
    applePay: {
      displayName: 'Test Display Name',
      paymentRequest: {
        total: {
          label: 'Test Fee',
          amount: displayTotal,
        },
        countryCode: 'US',
        currencyCode: 'USD',
        supportedNetworks: ['visa', 'masterCard', 'amex', 'jcb', 'discover'],
        merchantCapabilities: ['supports3DS', 'supportsCredit'],
      }
    },
  };

  dropin.create(
    {
      authorization: this.props.token,
      selector: '#braintree-container',
      paymentOptionPriority: ['card', 'paypal', 'applePay'],
      ...paypalConfig,
      ...applePayConfig,
      card: {
        overrides: {
          styles: {
            // style overrides are here, I didn't change this
          },
        },
      },
    },
    (err, instance) => {
      // callback stuff is here, I didn't change this
    }
  );
}

To the best of my knowledge, I have followed all of the instructions outlined in the documentation: here .据我所知,我已遵循文档中列出的所有说明: 此处 The applePay property definition, as well as a link to Apple's paymentRequest definition, can be found here .可以在此处找到applePay属性定义以及指向 Apple 的paymentRequest定义的链接。

One important note is that while I have created an Apple Sandbox account (docs here ), I have NOT signed into this account yet, because the warning in the docs states that if you log into the account on a production device (ie, my Macbook that I work from, I think?), the account will no longer be a sandbox account and will no longer work.一个重要的注意事项是,虽然我创建了一个 Apple Sandbox 帐户(此处的文档),但我尚未登录此帐户,因为文档中的警告指出,如果您在生产设备上登录该帐户(即我的 Macbook我想我工作的那个?),该帐户将不再是沙盒帐户,也将不再工作。 My understanding is this account is only to be used upon trying to checkout via apple pay.我的理解是这个帐户只能在尝试通过 Apple Pay 结帐时使用。

Having said that, I've followed all other steps outlined in the above linked braintree documentation.话虽如此,我已经按照上面链接的 Braintree 文档中列出的所有其他步骤进行了操作。

Unfortunately, when the dropin component loads on the webpage (I'm using Safari), I'm still only seeing Credit Card and Paypal as the only two available options.不幸的是,当 dropin 组件加载到网页上时(我使用的是 Safari),我仍然只看到 Credit Card 和 Paypal 作为仅有的两个可用选项。

组件中的braintree web drop 呈现丢失的applepay 选项

My question is: What have I done incorrectly to cause the ApplePay option to not appear in the braintree-web-drop-in component?我的问题是:我做错了什么导致 ApplePay 选项不出现在braintree-web-drop-in组件中? Have I missed a step here?我在这里错过了一步吗? I expected to see ApplePay show up as an available option here when I'm using Safari on my Mac.当我在我的 Mac 上使用 Safari 时,我希望看到 ApplePay 在这里显示为可用选项。

I have solved the issue.我已经解决了这个问题。 We were communicating with the client to set up the Braintree sandbox account via their Braintree Sandbox control panel.我们正在与客户沟通以通过他们的 Braintree 沙盒控制面板设置 Braintree 沙盒帐户。

Turns out, the application was not actually connected to their sandbox, but to a totally different sandbox account that another developer created when originally making the issue.事实证明,该应用程序实际上并没有连接到他们的沙箱,而是连接到另一个开发人员最初提出问题时创建的完全不同的沙箱帐户。 Once we realized this, we accessed that developer's account, enabled ApplePay, and ApplePay now shows up in the list of options!一旦我们意识到这一点,我们就访问了该开发者的帐户,启用了 ApplePay,ApplePay 现在出现在选项列表中!

So I'd say that if anyone in the future has a similar issue, make sure that the braintree access keys match the account you THINK they belong to.所以我想说,如果将来有人遇到类似的问题,请确保 Braintree 访问密钥与您认为他们所属的帐户匹配。

修复了显示 Apple Pay 列表中的 Braintree Web 下拉列表

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM