angular payments返回带有测试数据的无效卡
angular payments returns invalid card with test data
我正试图使用这里的angular payments应用程序在angular js中创建条纹
https://github.com/laurihy/angular-payments
问题是,即使使用测试数据,它似乎也会返回invalidcard错误。
错误如下:
POST https://api.stripe.com/v1/tokens 402 (Payment Required)
Stripe.isDoubleLoaded.c(index):3 Stripe.isDoubleLoaded.e(index):3 Stripe.isDoubleLoaded.a(index):3 Stripe.isDoubleLoaded.Stripe.xhr(index):2 Stripe.a._rawRequest(index):2 Stripe.a.request(index):2 Stripe.token.a.create(index):2 Stripe.card.b.createToken(index):2 Stripe.a._channelListener(index):2 Stripe.isDoubleLoaded.H.Socket.t.concat.incoming(index):2
我正在设置我的可发布密钥,并毫无问题地包含Stripe.js,我知道调用已经完成,因为我在ResponsHandler 中发现了错误
有什么想法可能导致这种情况吗?
这是代码:
形成
<form name="myform" id="signup-form" stripe-handler="saveCustomer">
<div class="form-group">
<label for="card_number">Card Number</label>
<input type="text" class="form-control" size="20" ng-model="number" payments-validate="card" payments-format="card" payments-type-model="type" ng-class="myform.number.$card.type"/>
</div>
<div class="form-row">
<label for="CVC"> CVC</label>
<input type="text" class="form-control" size="4" ng-model="cvc" payments-validate="cvc" payments-format="cvc" payments-type-model="type"/>
</div>
<div class="form-row">
<label for="expiry"> Expiry</label>
<input type="text" class="form-control" size="2" ng-model="expiry" payments-validate="expiry" payments-format="expiry" />
</div>
<div class="text-center">
<span class="glyphicon glyphicon-heart"></span>
<h3>Thanks For Your Money!</h3>
<button type="submit" class="btn">Submit</button>
</div>
这是控制器函数:
// function to process the form
$scope.saveCustomer = function(status, response) {
if (response.error) {
// Show the errors on the form
console.log(response);
console.log(response.error);
} else {
// response contains id and card, which contains additional card details
var token = response.id;
console.log(token);
formData.token = token;
}
}
我的index.html标题包括。。。
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
<script type="text/javascript">
// This identifies your website in the createToken call below
Stripe.setPublishableKey('my-key-here');
// ...
</script>
更糟糕的是,它正在与stripe angluar合作,这是另一个处理stripe的repo——你知道我做错了什么吗?
您可能创建的令牌不正确。我也遇到了同样的问题。对我有效的是这样设置卡片:
Stripe.card.createToken({
"number": '4242424242424242',
"exp_month": 12,
"exp_year": 2016,
"cvc": '123'
}, function(status, response) {
stripeResponseHandler(status, response);
});
相反(请注意卡对象是如何创建两次的——因此我相信会出现"Stripe.isDoubleLoaded"错误):
Stripe.card.createToken({
card: {
"number": '4242424242424242',
"exp_month": 12,
"exp_year": 2016,
"cvc": '123'
}
}, function(status, response) {
stripeResponseHandler
});
相关文章:
- Laravel数据表无效的JSON响应
- 访问Protractor/E2E测试中的$http数据(AngularJS)
- 从要使用Protractor测试的服务器异步加载的动态数据列表的列表
- 如何模拟json数据进行单元测试
- angular payments返回带有测试数据的无效卡
- 测试两个变量是否包含一些数据 JavaScript
- TypeError: 使用 Jquery JSON 获取数据时无效的 'in' 操作数 obj
- 如何测试从promise对象获取数据的控制器
- 在JavaScript中测试一个无效参数w/Chai
- 单元测试指令-无法强制使用假数据
- Img源设置为数据无效
- 单元测试输入参数无效的promise
- Angular E2E 测试数据:ngMockE2E 或测试数据服务器
- 使用templateUrl的angular指令中的单元测试数据绑定
- Mongoose创建测试数据并在没有数据库连接的情况下进行填充
- 使用Nightwatch进行参数化测试(数据驱动测试)
- 使用Faker生成测试数据
- 日期在ISO格式的Chrome中无效-测试日期:2012-11-31
- 如何将测试数据加载到GWT Widget中?
- 获取我的主干视图以加载测试数据