問題是,js不會按照您的建議觸發。一種解決方案是簡單地在您的index.html文件中包含Stripe checkout.js
,然後觸發Stripe彈出窗口以在您的控制器(或其他地方)打開。
在您的index.html(或等同物)
<script src="https://checkout.stripe.com/checkout.js"></script>
<!-- Angular script(s) -->
在您的控制器(或其它地方)
var handler = StripeCheckout.configure({
key: 'pk_test_6pRNASCoBOKtIshFeQd4XMUh',
image: '/img/documentation/checkout/marketplace.png',
locale: 'auto',
token: function(token) {
// Use the token to create the charge with a server-side script.
// You can access the token ID with `token.id`
}
});
handler.open({
name: 'Stripe.com',
description: '2 widgets',
amount: 2000
});
// handler.close();
這是每次條紋文檔適配於:https://stripe.com/docs/checkout#integration-custom
嘿。你有沒有想過這個?我在Rails應用中遇到同樣的問題。它之前在工作,我不知道爲什麼它停止工作。 – Loubot 2015-02-16 13:45:52