所以我嘗試使用我的離子應用程序上的條紋簽出框。在移動設備上看起來不錯。我使用自定義集成。有一個在我看來,一個按鈕:離子使用條紋簽出,第二次啓動條紋返回錯誤
<button class="button button-small button-flat button-balanced" ng-click="payStripe(selectedTask.total)">Pay</button>
當點擊,它觸發payStripe功能在我的控制器如下:
$scope.payStripe = function(amount) {
var chargeAmount = amount * 100;
console.log ("Pass in amount: " + chargeAmount);
var handler = StripeCheckout.configure({
key: '[stripe key]',
token: function(token) {
$http({
url: "http://localhost:3000/api/charge",
method: "POST",
data: {
stripeToken: token.id,
amount: chargeAmount,
}
}).success(function(data, status, headers, config) {
console.log("Status code: " + status);
}).error(function(data, status, headers, config) {
console.log("Status code: " + status);
});
}
});
// Open Checkout with further options
handler.open({
name: 'hughdesign.net',
description: '2 widgets',
amount: chargeAmount
});
}
我也包括在我的index.html。我在iOs模擬器上運行它。一切工作都很好,收費成功。我的服務器返回204後,Stripe Checkout在我的應用程序中彈出。我想通過單擊按鈕再次打開它,它現在拋出錯誤:
Error: Unable to communicate with Checkout. Please contact [email protected] if the problem persists.
[email protected]://checkout.stripe.com/checkout.js:1:48617
https://checkout.stripe.com/checkout.js:1:15530
https://checkout.stripe.com/checkout.js:1:47580
[email protected]://checkout.stripe.com/checkout.js:1:47850
[email protected]://checkout.stripe.com/checkout.js:1:47521
https://checkout.stripe.com/checkout.js:1:15530
[email protected]://checkout.stripe.com/checkout.js:2:52386
https://checkout.stripe.com/checkout.js:2:16468
[email protected]://checkout.stripe.com/checkout.js:2:34640
而這恰好包含此鍵(所有觸發相同的功能)我的所有其他意見。爲什麼它只能工作一次,然後停止工作?第一次結帳時,該應用程序確實與結帳進行了溝通......請幫助!謝謝!!
#條紋的IRC頻道的開發人員之一建議不要在cordova應用程序中使用Checkout.js:「10:24 AM <•koopajah>我們在嘗試支持Cordova應用程序時遇到了很多問題(一般情況下爲webviews),因此我們不我們建議你通過Stripe.js建立你自己的表單,而不是「 – Fadi