簡體   English   中英

嘗試通過 braintree-web-drop-in 包測試 Apple Pay 時收到帳戶和 417 錯誤

[英]Receiving account and 417 errors when attempting to test Apple Pay via braintree-web-drop-in package

目前在我的 React 網絡應用程序中使用braintree-web-drop-in進行支付。 目前 Paypal 和信用卡支付都可以正常使用,但我無法使用 ApplePay。

我正在使用沙盒 Braintree 帳戶和沙盒 Apple Tester 帳戶進行測試。 我遵循了Braintree 指南來設置 Apple pay,並且我也遵循了Apple Pay Sandbox 指南 這是我用於 Braintree Dropin 渲染的代碼:

getApplePayRequestObject() {
  const total = this.total;

  return {
    total: {
      label: 'Testing 123',
      amount: total,
    },
    countryCode: 'US',
    currencyCode: 'USD',
  };
}

createPaymentForm() {
  const paypalConfig = config.payPalEnabled && { paypal: { flow: 'vault' } };
  const applePayConfig = config.applePayEnabled && {
    applePay: {
      displayName: 'My App',
      paymentRequest: this.getApplePayRequestObject(),
    },
  };

  dropin.create(
    {
      authorization: this.props.token,
      selector: '#braintree-container',
      paymentOptionPriority: ['card', 'paypal', 'applePay'],
      ...paypalConfig,
      ...applePayConfig,
      card: {
        overrides: {
          styles: {
            input: {
              padding: '0 8px',
            },
          },
        },
      },
    },
    (err, instance) => {
      if (instance) {
        this.instance = instance;
        this.setState({ formLoaded: true });
      } else {
        this.setState({ braintreeError: strings.paymentCantBeProcessed });
        console.error(err || 'Payment form instance could not be initialized');
      }
    }
  );
}

有了這個,我在 safari 中成功呈現了 Apple Pay 按鈕。 正如我所說,這個沙盒 Braintree 帳戶中的 Paypal 和信用卡支付都運行良好。

braintree-web-drop-in apple pay渲染成功

我目前在使用 Apple Pay 時遇到兩個問題。 當我第一次選擇 Apple Pay 時,出現以下錯誤:

Could not find an active card. This may be because you're using a production iCloud
account in a sandbox Apple Pay Session. Log in to a Sandbox iCloud account to test 
this flow, and add a card to your wallet. For additional assistance, visit 
https://help.braintreepayments.com

這沒有意義,因為我通過蘋果開發者控制台專門創建了一個 Sandbox Tester 帳戶,當我在我的 Mac 上登錄/添加卡片到該帳戶時,它甚至在對話框頂部顯示“Sandbox”。

其次,如果我嘗試繼續付款,我會收到417 Expectation Failed錯誤:

{
    "error": {
        "message": "Payment Services Exception merchantId={id1 here} unauthorized to process transactions on behalf of merchantId={id2 here} reason={id2 here} is not a registered merchant in WWDR and isn't properly authorized via Mass Enablement, either"
    },
    "fieldErrors": []
}

谷歌搜索此錯誤並沒有讓我深入了解問題或可能的解決方案。

如何解決這些錯誤並使用braintree-web-drop-in通過 Apple Pay 成功完成付款。

全面披露:我在 PayPal 工作。 如果您有任何其他問題,請聯系支持人員

417 幾乎總是域名注冊問題。 雙重和三次檢查以下內容:

  1. 你必須有蘋果開發者賬號
  2. 您必須在瀏覽器上登錄iTunes Connect 沙盒測試帳戶(您可以按照Apple 沙盒測試指南中列出的步驟創建沙盒測試帳戶

聽起來你已經涵蓋了這兩個,但我還是把它們放在一起只是為了更加確定。

將您的域添加到控制面板時,它必須是完全限定的域名 需要仔細檢查托管在您提供的 URL 上的文件的事項:

  1. 托管的文件必須托管在正確的位置
  2. 您提供的 URL 是公開可用的(無內聯網、無防火牆、無機器人攔截)。 Apple 必須能夠以編程方式檢查此文件是否可從您提供的 URL 下載。
  3. 提供的 URL 是 HTTPS。 HTTP 將不被接受。

如有疑問,您應該能夠在任何設備上公開訪問您提供的 URL,並看到與非常相似的頁面。 如果您沒有看到您注冊的域存在問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM