适用于webapp的Cloud Firestore

时间:2018-01-10 09:04:43

标签: javascript webview android-webview stripe-payments google-cloud-firestore

我在Stripe中使用格子进行ACH付款。我想将它用于Android但文档是在javascript.so我在android.So中使用webView当用户在HTML页面中提供他的ACH银行详细信息时,这些值将被转换为标记并需要存储在云firestore中。但问题是值不存储在云firestore中。这是我用于此目的的HTML页面

<button id='linkButton'>Proceed To Pay</button>
<script src="https://www.gstatic.com/firebasejs/4.8.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/4.8.1/firebase.js"></script>
<script src="https://www.gstatic.com/firebasejs/4.8.1/firebase-firestore.js"></script>
<script src="https://www.gstatic.com/firebasejs/4.8.1/firebase-auth.js"></script>
<script>
  // Initialize Firebase
  var config = {
    apiKey: "AIzaSyAhhxfqpoILYEA1Pnt7ciRpRm_hniJ3HUc",
    authDomain: "wallet-d66d9.firebaseapp.com",
    databaseURL: "https://wallet-d66d9.firebaseio.com",
    projectId: "wallet-d66d9",
    storageBucket: "wallet-d66d9.appspot.com",
    messagingSenderId: "1040078578516"
  };
  firebase.initializeApp(config);
</script>
<script src="https://cdn.plaid.com/link/v2/stable/link-initialize.js"></script>

<script>
var linkHandler = Plaid.create({
  env: 'sandbox',
  clientName: 'Stripe/Plaid Test',
  key: '19cf65eeb2a40ac3e397ebb0e76072',
  product: ['auth'],
  selectAccount: true,
  onSuccess: function(public_token, metadata) {
    // Send the public_token and account ID to your app server.
    //var current = firebase.auth().currentUser.uid;
    var db = firebase.firestore();
    var dbRef = db.collection('deyaPayusers').doc("CDF6BVM4TXSOwAt0tVlUQTliBx53").collection('plaid').add({
    pubToken : public_token,
    acctId : metadata.account_id}).then(ref => {
    console.log('Added document with ID: ', ref.id);
});
    console.log('public_token: ' + public_token);
    console.log('account ID: ' + metadata.account_id);
  },
  onExit: function(err, metadata) {
    // The user exited the Link flow.
    if (err != null) {
      // The user encountered a Plaid API error prior to exiting.
    }

当我使用浏览器执行文件时,数据存储在firestore中,但是当我在webView中使用时,它不存储数据。我在HTML页面中遵循相同的Web规则。

1 个答案:

答案 0 :(得分:1)

如果有人想使用webview将格子用于移动设备,那么这是正确的方法,格子图片提供了移动设备中格子集成的示例。这是链接https://github.com/plaid/link跟随它并更改密钥。