我使用https://stripe.com/docs/api?lang=php#list_charges获取列出所有费用但在此处指定
count可选 - 默认值是对要返回的对象数的限制.计数可以介于1到100个项目之间.
我有成千上万的条目,现在我怎么能得到所有.虽然如果我将count设置为100,它会返回110条记录.
我正在使用 Stripe API 进行测试,但无法让这个基本的“市场”场景发挥作用。该场景是买家从卖家处购买,应用程序需要付费。
我的设置:
# Seller has already connected their account to the application
# through "Stripe Connect Standalone". Below will attempt to charge a customer.
import stripe
# application's sk from stripe
stripe.api_key = "sk...."
# Build customer
customer = stripe.Customer.create(
email = customer.email,
card = token_from_stripe_checkout
)
# Now do a charge
charge = stripe.Charge.create(
amount = 2000,
currency = "usd",
customer = customer.id,
application_fee = 500,
stripe_account = seller.stripe_user_id # which is something like: acct_xxxxxxxxx
) …Run Code Online (Sandbox Code Playgroud) 在Laravel 5.1with Cashier中~5.0,我曾经像这样获得该用户的Stipe客户详细信息:
$customer = $user->subscription()->getStripeCustomer();
在5.3使用Cashier 更新到Laravel之后~7.0,我将控制器中的上述行更改为:
$customer = $user->subscription('main')->getStripeCustomer();
自更新以来,我现在收到错误:
BadMethodCallException in Builder.php line 2440:
Call to undefined method Illuminate\Database\Query\Builder::getStripeCustomer()
Run Code Online (Sandbox Code Playgroud)
我怎样才能得到条纹的客户详细信息Laravel 5.3与Cashier ~7.0?
laravel stripe-payments laravel-5 laravel-cashier laravel-5.3
我正在使用 Node.js Stripe 包,我想向客户添加一个新订阅,该订阅将在 30 秒后到期。这是我的代码:
var toCreate = {
customer: 'customer_id',
items: [{
plan: 'plan_id'
}],
coupon: 'coupon_code',
}
stripe.customers.create({xyz: 'This will give an error with the server time in the header'}).then(success => {},
error => {
var seconds = 30;
toCreate.trial_end = new Date(error.raw.headers.date).getTime() + (seconds * 1000);
console.log('End time', toCreate.trial_end);
return stripe.subscriptions.create(toCreate).then(successful => {
console.log(successful)
}, error => {
console.log(error)
})
})
Run Code Online (Sandbox Code Playgroud)
该代码故意创建错误以获取准确的服务器时间,然后进行实际stripe.subscriptions.create调用。
当我打电话时stripe.subscriptions.create,Stripe 给了我这个错误:
时间戳无效:不能超过未来五年
在这种情况下,我的代码给它的时间戳是1535104976000. 它包含在错误消息标题中:
date: 'Fri, 24 …Run Code Online (Sandbox Code Playgroud) 我一直在使用Stripe API,并且已经成功调用我的Webhook大约一年了。
但是昨天第一次出现了问题。Webhook未能成功完成其预期的操作,但是无论如何返回了200状态代码,因此Stripe不再重试。
我现在已经解决了Webhook上的错误,但无法弄清楚如何使Stripe对该特定事件重复webhook调用。我可以检索该事件,但是没有要重新发送的按钮。如何?
我更新到最新的条纹。
如何从 STPPaymentMethodCardParams 创建源
我想将条纹元素添加到我的 nuxt js 页面但是,出现错误
条纹未定义
我已经插入了 <script src="https://js.stripe.com/v3/"></script>我的nuxt.config.js
这是代码
head: {
title: process.env.npm_package_name || "",
script: [{ src: "https://js.stripe.com/v3/" }],
link: [
{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" },
]
},
Run Code Online (Sandbox Code Playgroud)
我的付款页面
<template>
<div>
<div ref="card"></div>
<button v-on:click="purchase">Purchase</button>
</div>
</template>
<script>
let stripe = Stripe("Key"),
elements = stripe.elements(),
card = undefined;
export default {
mounted: function() {
card = elements.create("card");
card.mount(this.$refs.card);
},
methods: {
async purchase() {
let result = await stripe.createToken(card);
}
}
};
</script>
Run Code Online (Sandbox Code Playgroud)
我遵循了本教程,但仍然无法修复它 …
我正在尝试以条带实时模式付款,但显示以下错误:
PHP Fatal error: Uncaught (Status 400) (Request req_uocWWxAIPTJ6ZR) No such token: tok_1FbZniE3n36TXaJ5sMm5KSsX; 实时模式中存在类似的对象,但使用测试模式密钥来发出此请求。
扔进去
我已经在网上阅读了几个教程,但仍然没有正面。
require_once "vendor/autoload.php";
\Stripe\Stripe::setApiKey('sk_live_xxxxxxxxxxxxxxxxxxxxxx');
$token = $_POST['stripeToken'];
// Add customer to stripe
$customer = \Stripe\Customer::create(array(
'email' => $email,
'source' => $token
));
// Unique order ID
$orderID = strtoupper(str_replace('.','',uniqid('', true)));
// Charge a credit or a debit card
$charge = \Stripe\Charge::create(array(
'customer' => $customer->id,
'amount' => $amt,
"currency" => "usd",
'description' => "Payment for ". $rooms,
'metadata' => array(
'order_id' => $orderID
)
));
// …Run Code Online (Sandbox Code Playgroud) 为什么我会发现这个错误?
我在这里看到过类似的问题,但它们似乎没有解决我的问题。
错误:未找到与负载的预期签名匹配的签名。您是否正在传递从 Stripe 收到的原始请求正文?https://github.com/stripe/stripe-node#webhook-signing
这是我的 index.ts 删除了键。
import * as functions from 'firebase-functions';
import * as Stripe from 'stripe';
const stripe = new Stripe('sk_test_*****************************');
const endpointSecret = 'whsec_******************************';
import * as express from 'express';
import * as cors from 'cors';
const bodyParser = require('body-parser')
const app = express();
app.use(cors({origin: true}));
app.post('/webhook', bodyParser.raw({type: 'application/json'}), async(req, res) => {
const sig = req.headers['stripe-signature'] as string;
let event;
try {
event = stripe.webhooks.constructEvent(req.body, sig, endpointSecret);
} catch (err) {
console.log("ERROR!!!1");
console.log(err); …Run Code Online (Sandbox Code Playgroud) 我使用 Stripe 创建了一个订阅服务。我可以订阅用户使用定期付款。这是相关代码(节点):
// Create the subscription
const subscription = await stripe.subscriptions.create({
customer: req.body.customerId,
items: [{ price: req.body.priceId }],
expand: ['latest_invoice.payment_intent'],
});
Run Code Online (Sandbox Code Playgroud)
这有效并使用priceId仪表板中所示的:
但是,当我销售不经常出现的产品时,它就会失败。我收到错误:
The price specified is set to `type=one_time` but this field only accepts prices with `type=recurring`
Run Code Online (Sandbox Code Playgroud)
我理解错误,但我不确定是否可以将订阅设置为不重复。
我的应用程序有 3 层:
理想情况下,我不想添加一个全新的代码段来处理似乎是订阅所做的一个子集的事情,但即使我这样做了,该paymentIntent对象似乎只需要一个数量而不是 API ID,如图所示. 有没有办法使用我已经建立的基础设施来做到这一点?
stripe-payments ×10
php ×2
api ×1
datetime ×1
firebase ×1
ios ×1
laravel ×1
laravel-5 ×1
laravel-5.3 ×1
node.js ×1
nuxt.js ×1
python ×1
stripe.net ×1
swift ×1
typescript ×1
vue.js ×1