React Native Square 应用内支付,出现问题,代码:unexpected

问题描述 投票:0回答:1

我目前正在将 Square 应用内支付 SDK(版本 1.3.1)添加到 React Native 应用程序中。在 iPhone 8 iOS 上运行:13.3

我基本上是从 Square 的文档中复制了代码,这里是代码:

async componentDidMount(){
    this._loadCreditCardInfo()

    await SQIPCore.setSquareApplicationId('MY_SANDBOX_APP_ID')
    if (Platform.OS === 'ios') {
        await SQIPCardEntry.setIOSCardEntryTheme({
          saveButtonFont: {
            size: 25,
          },
          saveButtonTitle: 'Add 💳 ',
          keyboardAppearance: 'Light',
          saveButtonTextColor: {
            r: 255,
            g: 0,
            b: 125,
            a: 0.5,
          },
        });
      }
}

onCardEntryComplete() {
    // Update UI to notify user that the payment flow is completed
  }

  async onCardNonceRequestSuccess(cardDetails) {
    try {

      console.log(cardDetails);
      await SQIPCardEntry.completeCardEntry(
        this.onCardEntryComplete(),
      );
    } catch (ex) {
      // payment failed to complete due to error
      // notify card entry to show processing error
      await SQIPCardEntry.showCardNonceProcessingError(ex.message);
    }
  }

  onCardEntryCancel() {
    // Handle the cancel callback
  }
  async onStartCardEntry() {
    const cardEntryConfig = {
      collectPostalCode: true,
    };
    await SQIPCardEntry.startCardEntryFlow(
      cardEntryConfig,
      this.onCardNonceRequestSuccess,
      this.onCardEntryCancel,
    );
  }

这就是我得到的

我很确定我的卡信息是正确的!

javascript react-native payment sandbox square
1个回答
0
投票

错误解决了吗?我也有一样的

© www.soinside.com 2019 - 2024. All rights reserved.