use*_*264 18 javascript stripe-payments
我目前正试图将Stripe整合到一个小网站中.
我可以在Firebug中看到,此get请求正确运行
https://checkout.stripe.com/api/bootstrap?locale=en&key=******************
Run Code Online (Sandbox Code Playgroud)
然而,另一个请求返回NetworkError:400 Bad Request
https://checkout.stripe.com/api/color?image_url=https%3A%2F%2Fwww.*******.com%2Fassets%2Fimages%2Flayout-images%2Fstripe-logo.jpg&key=
Run Code Online (Sandbox Code Playgroud)
在浏览器中打开URL时的JSON响应是
{
"error": {
"type": "invalid_request",
"message": "Unable to perform color detection."
}
}
Run Code Online (Sandbox Code Playgroud)
消息上的一些帖子表明它不应该担心.但我还没有找到任何关于具体错误的信息.有没有人知道导致这个错误的原因是什么?
and*_*amm 19
如果图像URL不可公开访问,则会发生这种情况,因为Stripe必须能够从其服务器请求图像.如果您运行的应用程序的本地副本无法从外部访问,或者它位于VPN或身份验证之后,则会发生这种情况.
use*_*264 11
所以我改变了处理程序以包含另一个颜色参数,它似乎解决了这个问题.
var handler = StripeCheckout.configure({
key: '******************',
image: '/assets/images/layout-images/stripe-logo.jpg',
color: 'black',
token: function(token) {
// Use the token to create the charge with a server-side script.
// You can access the token ID with `token.id`
}
});
Run Code Online (Sandbox Code Playgroud)
很奇怪,因为我不太确定为什么它不包含在文档中.