Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 尝试删除卡时出现条带API抛出错误_Ruby_Stripe Payments_Payment Gateway - Fatal编程技术网

Ruby 尝试删除卡时出现条带API抛出错误

Ruby 尝试删除卡时出现条带API抛出错误,ruby,stripe-payments,payment-gateway,Ruby,Stripe Payments,Payment Gateway,我试图使用ruby库从Stripe中删除一张卡,但遇到以下错误 undefined method `delete' for Stripe::Customer:Class 下面是我的代码中导致错误的那一行 customer = Stripe::Customer.delete(@user.stripe_id) Customer类上似乎没有delete方法,但文档说有 下面是Stripe文档中有关删除卡的部分。 正如您所看到的,我的代码与文档中的行相同,而不是客户id的来源 另外,我注意到文档中

我试图使用ruby库从Stripe中删除一张卡,但遇到以下错误

undefined method `delete' for Stripe::Customer:Class
下面是我的代码中导致错误的那一行

customer = Stripe::Customer.delete(@user.stripe_id)
Customer类上似乎没有delete方法,但文档说有

下面是Stripe文档中有关删除卡的部分。

正如您所看到的,我的代码与文档中的行相同,而不是客户id的来源

另外,我注意到文档中有一个错误

customer = Stripe::Customer.delete({CARD_ID})
应该是,

customer = Stripe::Customer.delete({CUSTOMER_ID})
我也尝试过使用卡id来确认,但它会产生同样的错误

如果有人有任何想法,我们将不胜感激

编辑:到目前为止,我一直在使用stripe up,其他方法(如
stripe::Customer.retrieve()
工作正常)


编辑2:我正在使用gem版本1.8.4,它似乎是最新版本。

文档中似乎有两个错误,您是否尝试过这样做:

customer = Stripe::Customer.retrieve({CUSTOMER_ID})
customer.cards.retrieve({CARD_ID}).delete()

我得到一个
***NoMethodError异常:尝试删除cardsFix时,
的未定义方法“delete:
card=customer.cards.retrieve({card\u ID})
<代码>卡片。删除谢谢大家!我在更新的文档中使用了这个版本,它工作了!现在是
card=customer.sources.retrieve({card\u ID})
是的,Stripe仍然不让客户使用,我认为这是不可接受的。事实上,这是可能的,看看这个和这个。不过,到目前为止,我遇到的使用Stripe的网站并不关心实现这个功能。