типси-полоса 3d надежно реагирует - PullRequest
3 голосов
/ 15 марта 2019

Я хочу интегрировать Stripe 3d secure в свое собственное приложение.Используя эту библиотеку: https://github.com/tipsi/tipsi-stripe, и при простой оплате это работает хорошо.Но с 3D у меня есть несколько проблем на iOS, а также на Android:iOS: createCardSource: true (в строке 7 происходит сбой приложения). (решено)iOS: застрял перед перенаправлением на защищенную страницуAndroid: откуда я знаю, заплатил ли пользователь или отклонил платеж на удаленной странице? (В строке 27 нет никаких данных в объекте secure3dSourceResponse)

import stripe from "tipsi-stripe";  
paymentRequest = async (mutation, deal) => {
  let paymentRequest;
  try {
    paymentRequest = await stripe.paymentRequestWithCardForm({
      ...options,
      createCardSource: true
    });
  //iOS and Android gets back different objects.
    const threeDSecure = Platform.OS === "android"
      ? paymentRequest.card.three_d_secure
      : paymentRequest.details.three_d_secure;
    if (
      threeDSecure === "recommended"
      || threeDSecure === "required"
    ) {
      let prefix = Platform.OS === "android"
      ? `appName://appName/`
      : `appName://`;
      let secure3dSourceResponse = null;
      try {
        const { dealFeeUSD } = this.state;
        // On iOS the process stucked here, without any error message
        secure3dSourceResponse = await stripe.createSourceWithParams({
          type: "threeDSecure",
          amount: dealFeeUSD || 3000,
          currency: "USD",
          flow: "redirect",
          returnURL: prefix,
          card: paymentRequest.sourceId
        });
        // On android I have no any data in secure3dSourceResponse after Stripe returns from their page.
      } catch (error) {
        console.log('secure3dSourceResponse', secure3dSourceResponse)
      }
    } else {
      if (paymentRequest && paymentRequest.tokenId) {
        this.handlePayDeal(mutation, deal, paymentRequest.tokenId);
      }
    }
  } catch (error) {
    console.log("paymentRequest: " + JSON.stringify(error));
  }
};
...