Реагируйте на платеж в Native Square. Что-то пошло не так, код: неожиданно - PullRequest
0 голосов
/ 06 февраля 2020

В настоящее время я добавляю платежный SDK Square In-App (версия 1.3.1) в приложение React Native. Запустив его на iPhone 8 iOS: 13,3

Я в основном скопировал код из Square's do c, вот код:

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,
    );
  }

Это то, что я получил something went wrong. please contact the developer of this application and provide them with this error code unexpected

Я уверен, что данные моей карты верны!

...