在实时模式下使用Stripe时,我收到此PHP错误:
没有这样的令牌tok_fgfhn ..测试模式中存在类似的对象,但是使用了实时模式密钥来发出此请求
Stripe测试模式下一切都运行良好,而且我已切换到实时API密钥.
我创建了一个这样的新客户:
$token = $_POST['stripeToken'];
$email = $_POST['email'];
$customer = \Stripe\Customer::create(array(
'email' => $email,
'card' => $token
));
//charge for user ads
$charge = \Stripe\Charge::create(array(
'customer' => $customer->id,
'amount' => $amount,
'currency' => 'eur'
));
Run Code Online (Sandbox Code Playgroud)
我等了好几个小时但是我仍然遇到这个错误.我该如何解决?
我终于想出了如何使用本教程实现Stripes Monthly Billing. http://railscasts.com/episodes/288-billing-with-stripe
到目前为止,用户可以使用Stripe创建和删除其订阅.
但是,用户如何在创建订阅后更改其信用卡信息
这是我的评论和问题代码.请帮助新的rails.:)
CONTROLLER
class SubscriptionsController < ApplicationController
def new
plan = Plan.find(params[:plan_id])
@subscription = plan.subscriptions.build
@subscription.user_id = current_user.id
end
def create
@subscription = Subscription.new(params[:subscription])
if @subscription.save_with_payment
redirect_to @subscription, :notice => "Thank you for subscribing!"
else
render :new
end
end
def update
@subscription = current_user.subscription
if @subscription.save
redirect_to edit_subscription_path, :success => 'Updated Card.'
else
flash.alert = 'Unable to update card.'
render :edit
end
end
end
Run Code Online (Sandbox Code Playgroud)
楷模
class Subscription < ActiveRecord::Base
attr_accessible :plan_id, :user_id, :email, :stripe_customer_token, :last_4_digits, …Run Code Online (Sandbox Code Playgroud) 我在我的网站上使用Stripe Payment处理器.
我已经为Stripe Checkout集成了以下表单.
https://stripe.com/docs/checkout#integration-simple
我想"Remember me everywhere"从表单中删除该选项.
我有一个名为"青铜"的计划,目前每月收费$ x美元?
如何将价格更新为每月$ y并让现有客户每月收入$ y?
有没有比制定收费$ y的新计划更好的方法?
我一直在条带仪表板上收到错误代码400.看起来我不止一次使用相同的条带令牌,这会产生错误.以下是我的代码.
JS:
<script src="https://checkout.stripe.com/checkout.js"></script>
<script>
var handler = StripeCheckout.configure({
key: 'pk_test_******************',
image: '/img/documentation/checkout/marketplace.png',
token: function(token) {
/*$.post("php/charge.php",{stripeToken:token.id},function(data,status){
console.log("Data: "+ data+"\nStatus: "+status);
});*/
alert(token.used);//alerts false
$.post("php/charge.php",{stripeToken:token.id});
alert(token.used);// still alerts false
}
});
$('#myButton').on('click', function(e) {
// Open Checkout with further options
handler.open({
name: 'Demo Site',
description: '2 widgets',
currency: "cad",
amount: 2000
});
e.preventDefault();
});
// Close Checkout on page navigation
$(window).on('popstate', function() {
handler.close();
});
</script>
Run Code Online (Sandbox Code Playgroud)
PHP的:
<?php
require_once('config.php');
$token = $_POST['stripeToken'];
$customer = \Stripe\Customer::create(array(
'email' => 'test@test.com',
'card' => …Run Code Online (Sandbox Code Playgroud) 我们想知道如何在LIVE中为电子商务网站测试条纹?该网站基本上是一个电子商务网站,网上购买的课程,我们如何测试实时交易,而不使用条带实时信用卡?
其他人如何在LIVE中测试?在LIVE中测试的最佳实践是什么?
请分享你的想法!
谢谢,
我知道还有另一个类似于这个问题的问题,但我不认为它得到了很好的回答.
基本上我有一个工作轨道应用程序,用户可以注册我的订阅,输入信用卡信息等.这一切都工作.但我需要处理在此定期订阅期间某个时候用户卡被拒绝的情况.
他们发送的事件类型如下:https://stripe.com/docs/api?lang = ruby #event_types.
我在访问应用中的charge.failed对象时遇到问题.
关于webhooks的文档也在这里:https://stripe.com/docs/webhooks ,任何帮助将不胜感激.
让我首先确认这不是重复(因为那里发布的答案没有解决我的问题).这篇文章基本上是我的确切问题:Capybara无法在Stripe模式中找到表单字段来填充它们.
这是我的水豚规格:
describe 'checkout', type: :feature, js: true do
it 'checks out correctly' do
visit '/'
page.should have_content 'Amount: $20.00'
page.find('#button-two').click_button 'Pay with Card'
Capybara.within_frame 'stripe_checkout_app' do
fill_in 'Email', with: 'example@example.com'
fill_in 'Name', with: 'Nick Cox'
fill_in 'Street', with: '123 Anywhere St.'
fill_in 'ZIP', with: '98117'
fill_in 'City', with: 'Seattle'
click_button 'Payment Info'
fill_in 'Card number', with: '4242424242424242' #test card number
fill_in 'MM/YY', with: '02/22'
fill_in 'CVC', with: '222'
click_button 'Pay'
end
page.should have_content 'Thanks'
end
end
Run Code Online (Sandbox Code Playgroud)
该规范中的文字是我最近的尝试. …
我正在使用Stripe API,我想向客户提供他们的发票历史列表以及相关的收据.
我无法在Stripe API(https://stripe.com/docs/api?lang=php)中的任何地方找到允许我获取客户收据列表的任何地方.有什么我想念的吗?
我试图使用Stripe v3付款.该指南位于https://stripe.com/docs/elements
我不想收集邮政编码.但是我无法弄清楚如何.我的HTML是:
<form>
<label>
<div id="card-element" class="field is-empty"></div>
<span><span>Credit or debit card</span></span>
</label>
<button type="submit">Pay</button>
<div class="outcome">
<div class="error" role="alert"></div>
<div class="success">
Success! Your Stripe token is <span class="token"></span>
</div>
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
而javascript是:
var card = elements.create('card', {
style: {
hidePostalCode: true,
base: {
iconColor: '#666EE8',
color: '#31325F',
lineHeight: '40px',
fontWeight: 300,
fontFamily: '"Helvetica Neue", Helvetica, sans-serif',
fontSize: '15px',
'::placeholder': {
color: '#CFD7E0',
},
},
}
});
card.mount('#card-element');
Run Code Online (Sandbox Code Playgroud)
但它总是要求输入邮政编码:
这里有一个Element标签指南https://stripe.com/docs/stripe.js#element-types.但我看不到我可以在哪里收集卡号,CVC和卡到期,但不是邮政编码......
stripe-payments ×10
javascript ×2
php ×2
ruby ×2
capybara ×1
checkout ×1
credit-card ×1
forms ×1
rest ×1
subscription ×1
webhooks ×1