草庐IT

php - '无法确定请求哪个 URL : Stripe_Charge instance has invalid ID

coder 2024-04-12 原文

我想在站点中实现 Strip 付款流程。我尝试这样做,但它看起来不起作用。我得到的错误是

fatal error :在/home/twassist/public_html/wp-content/themes/inovado/stripe-php-1.7 中出现未捕获的异常“Stripe_InvalidRequestError”和消息“无法确定要请求的 URL:Stripe_Charge 实例具有无效 ID:” .15/lib/Stripe/ApiResource.php:46 堆栈跟踪:#0/home/twassist/public_html/wp-content/themes/inovado/stripe-php-1.7.15/lib/Stripe/ApiResource.php(15) : Stripe_ApiResource->instanceUrl() #1/home/twassist/public_html/wp-content/themes/inovado/stripe-php-1.7.15/lib/Stripe/ApiResource.php(8): Stripe_ApiResource->refresh() # 2/home/twassist/public_html/wp-content/themes/inovado/stripe-php-1.7.15/lib/Stripe/Charge.php(14): Stripe_ApiResource::_scopedRetrieve('Stripe_Charge', NULL, NULL) #3/home/twassist/public_html/wp-content/themes/inovado/functions.php(355): Stripe_Charge::retrieve(NULL) #4/home/twassist/public_html/wp-content/themes/inovado/functions.php( 361): Strip_Code() #5/home/twassist/public_html/wp-settings.php(291): 包含('/home/twassist/...') #6/home/twassist/public_html/wp-config.php( 在/home/twassist/public_html/wp-content/themes/inovado/stripe-php-1.7.15/lib/Stripe/ApiResource.php 第 46 行

有人在这里试过吗http://twassistant.com/hire改变数量。

填写此详细信息 5555 5555 5555 4444 有效期 12/21 姓名:任何 121。

这将进行测试付款。当重定向到代码时,它会给你这个错误。

这是我在 php 文件中尝试的代码。

function Strip_Code()
{
    $stripCode = trim($_GET['stripeToken']);

    if (strlen($stripCode) > 0) {

        require_once  dirname(__FILE__).'/stripe-php-1.7.15/lib/Stripe.php';

        Stripe::setApiKey("sk_test_XXXXXXXXXXXXXXX");

        $resp = Stripe_Charge::retrieve($$stripCode);

        var_dump($resp);
    }
}

Strip_Code();

最佳答案

可能是你打错了(双 $$):

Stripe_Charge::retrieve($$stripCode);

另外,你不应该泄露你的私钥......即使它只是你的测试 key

关于php - '无法确定请求哪个 URL : Stripe_Charge instance has invalid ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15577196/

有关php - '无法确定请求哪个 URL : Stripe_Charge instance has invalid ID的更多相关文章

  1. ruby-on-rails - rails : "missing partial" when calling 'render' in RSpec test - 2

    我正在尝试测试是否存在表单。我是Rails新手。我的new.html.erb_spec.rb文件的内容是:require'spec_helper'describe"messages/new.html.erb"doit"shouldrendertheform"dorender'/messages/new.html.erb'reponse.shouldhave_form_putting_to(@message)with_submit_buttonendendView本身,new.html.erb,有代码:当我运行rspec时,它失败了:1)messages/new.html.erbshou

  2. ruby-on-rails - 由于 "wkhtmltopdf",PDFKIT 显然无法正常工作 - 2

    我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-

  3. ruby-on-rails - 'compass watch' 是如何工作的/它是如何与 rails 一起使用的 - 2

    我在我的项目目录中完成了compasscreate.和compassinitrails。几个问题:我已将我的.sass文件放在public/stylesheets中。这是放置它们的正确位置吗?当我运行compasswatch时,它不会自动编译这些.sass文件。我必须手动指定文件:compasswatchpublic/stylesheets/myfile.sass等。如何让它自动运行?文件ie.css、print.css和screen.css已放在stylesheets/compiled。如何在编译后不让它们重新出现的情况下删除它们?我自己编译的.sass文件编译成compiled/t

  4. ruby-on-rails - 无法使用 Rails 3.2 创建插件? - 2

    我对最新版本的Rails有疑问。我创建了一个新应用程序(railsnewMyProject),但我没有脚本/生成,只有脚本/rails,当我输入ruby./script/railsgeneratepluginmy_plugin"Couldnotfindgeneratorplugin.".你知道如何生成插件模板吗?没有这个命令可以创建插件吗?PS:我正在使用Rails3.2.1和ruby​​1.8.7[universal-darwin11.0] 最佳答案 随着Rails3.2.0的发布,插件生成器已经被移除。查看变更日志here.现在

  5. ruby-on-rails - Rails 3.2.1 中 ActionMailer 中的未定义方法 'default_content_type=' - 2

    我在我的项目中添加了一个系统来重置用户密码并通过电子邮件将密码发送给他,以防他忘记密码。昨天它运行良好(当我实现它时)。当我今天尝试启动服务器时,出现以下错误。=>BootingWEBrick=>Rails3.2.1applicationstartingindevelopmentonhttp://0.0.0.0:3000=>Callwith-dtodetach=>Ctrl-CtoshutdownserverExiting/Users/vinayshenoy/.rvm/gems/ruby-1.9.3-p0/gems/actionmailer-3.2.1/lib/action_mailer

  6. ruby - 无法运行 Rails 2.x 应用程序 - 2

    我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby​​:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r

  7. ruby - 在 jRuby 中使用 'fork' 生成进程的替代方案? - 2

    在MRIRuby中我可以这样做:deftransferinternal_server=self.init_serverpid=forkdointernal_server.runend#Maketheserverprocessrunindependently.Process.detach(pid)internal_client=self.init_client#Dootherstuffwithconnectingtointernal_server...internal_client.post('somedata')ensure#KillserverProcess.kill('KILL',

  8. ruby-on-rails - 无法在centos上安装therubyracer(V8和GCC出错) - 2

    我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e

  9. ruby - 主要 :Object when running build from sublime 的未定义方法 `require_relative' - 2

    我已经从我的命令行中获得了一切,所以我可以运行rubymyfile并且它可以正常工作。但是当我尝试从sublime中运行它时,我得到了undefinedmethod`require_relative'formain:Object有人知道我的sublime设置中缺少什么吗?我正在使用OSX并安装了rvm。 最佳答案 或者,您可以只使用“require”,它应该可以正常工作。我认为“require_relative”仅适用于ruby​​1.9+ 关于ruby-主要:Objectwhenrun

  10. ruby-on-rails - rails : save file from URL and save it to Amazon S3 - 2

    从给定URL下载文件并立即将其上传到AmazonS3的更直接的方法是什么(+将有关文件的一些信息保存到数据库中,例如名称、大小等)?现在,我既不使用Paperclip,也不使用Carrierwave。谢谢 最佳答案 简单明了:require'open-uri'require's3'amazon=S3::Service.new(access_key_id:'KEY',secret_access_key:'KEY')bucket=amazon.buckets.find('image_storage')url='http://www.ex

随机推荐