Stripe error : unable to perform color detection

非 Y 不嫁゛ 提交于 2020-01-23 04:35:10

问题


im currently attempting to integrate Stripe into a little website.

I can see within Firebug, that this get request runs correctly

https://checkout.stripe.com/api/bootstrap?locale=en&key=******************

However another request comes back with a 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=

The JSON response when opening the URL in a browser is

{
"error": {
"type": "invalid_request",
"message": "Unable to perform color detection."
}
}

some posts on the message indicate that it shouldnt be worried about. but I havent been able to find anything really informative on the specific error. Does anyon ehappen to know what is causing this error ?


回答1:


This can happen if the image URL is not publicly accessible, as Stripe has to be able to request the image from their servers. This can happen if you are running a local copy of the application which isn't accessible from the outside world, or if it is behind a VPN or authentication.




回答2:


So I changed the handler to include another paramter of color and it appears to have resolved the issue.

  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`
    }
  });

weird as im not quite sure why it wasnt included in the docs.




回答3:


I got the same error and setting color didn't work for me. I changed the path of the image to the one given in Stripe documentation:

Changed

https://stripe.com/template/img/documentation/checkout/marketplace.png

to

https://stripe.com/img/documentation/checkout/marketplace.png


来源:https://stackoverflow.com/questions/29786783/stripe-error-unable-to-perform-color-detection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!