简体   繁体   English

条纹:没有这样的标记

[英]Stripe: no such token

I keep getting this error while trying to pay with my stripe integration: 尝试使用条带集成付款时,我一直收到此错误:

Stripe::InvalidRequestError (No such token: tok_19Vh25DGnBus....):

Here's my Ruby on Rails integration: 这是我的Ruby on Rails集成:

config/application.yml (I use Figaro gem to handle environment variables): config / application.yml(我使用Figaro gem来处理环境变量):

STRIPE_SECRET_KEY      :"sk_test_xxxxxxxxxxxxx"                                        
STRIPE_PUB_KEY         :"pk_test_xxxxxxxxxxxxx"

config/initializers/stripe.rb: 配置/初始化/ stripe.rb:

Rails.configuration.stripe = {
    :publishable_key => ENV['STRIPE_PUB_KEY'],
    :secret_key      => ENV['STRIPE_SECRET_KEY']
}

Stripe.api_key = Rails.configuration.stripe[:secret_key]

controllers/api_controller.rb: 控制器/ api_controller.rb:

require 'stripe'

charge = Stripe::Charge.create(    # -> Line of the error
            :amount => price,
            :currency => "gbp",
            :source => token,
            :description => ""
        )

In the front-end side I use angular and the module angularPayments: 在前端,我使用角度和模块angularPayments:

$window.Stripe.setPublishableKey("pk_live_xxxxxxxxxxx");

  $scope.handleStripe = function(status, response){
      $rootScope.loader = true;
      var email = $scope.email;

      $scope.email = "";
      $scope.number = '';
      $scope.expiry = null;
      $scope.cvc =  '';

      if(response.error) {
          $scope.paid= false;
          $scope.message = "The card you have inserted is not valid.";
          $rootScope.loader = false;
      } else {
          var data = {
              'invoice_url' : $stateParams.invoiceUrl,
              'token' : response.id,
              'price': $scope.invoice.price,
              'email': email
          };

          $http.post(URL.url + 'send_payment', data).then(function(res){
              if(res.data.error){
                  $scope.paid= false;
                  $scope.message = res.data.message;
                  $rootScope.loader = false;
              }else{
                  $scope.paid= true;
                  $rootScope.temp_modal = true;
                  $scope.message = res.data.message;
              }
              $rootScope.loader = false;
          });

      }
  };

I checked and all the keys are correct and match the account that I'm using...In test mode everything worked fine...what am I missing? 我检查了所有的密钥都是正确的,并且与我正在使用的帐户相匹配...在测试模式下一切正常...我错过了什么?

我的不好,关键是正确但我没有更新缩小的js文件!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM