我的网站正在运行 TLS 1.2,经https://www.ssllabs.com/验证 。但是,我在 Stripe 中不断看到收费以 TLS 1.0 方式进行,我需要升级。
我致电 Hostmonster,他们还验证了我使用的是 TLS 1.2。
那么我错过了什么?为什么费用仍然通过 TLS 1.0 进行?
我正在使用 Stripe 和 PHP。
我想在该月的最后一天进行订阅,以便根据创建的订阅按比例收取费用。我使用下面的代码来计算该月的最后一天:
var date = new Date();
var lastDay = Date.UTC(date.getFullYear(), date.getMonth() + 1, 0);
var monthLastDay = Math.floor(lastDay/1000);
Run Code Online (Sandbox Code Playgroud)
我位于 IST 时区,所以我得到的 MonthLastDay 为 1527724800,它等于: 05/31/2018 @ 12:00am (UTC) 上面的代码按比例分配的金额工作正常,但订阅存在问题。我于 2018 年 5 月 11 日创建订阅。因此按比例分配的金额是从 5/11/2018 到 5/31/2018 计算的。但订阅是从 2018 年 5 月 31 日开始创建的。
我希望订阅安排在 2018 年 6 月 1 日。谁能帮助我并指出我哪里出错了。
注意:我将日期转换为 UTC 时区以避免不同时区问题。
我正在尝试找到一种方法让 Stripe 一次性为多个项目充电。我想它看起来会是这样的:
$totalitems = [];
if ( $item1 == "true" ) {
$currentitem = array(
"amount" => 19999,
"currency" => "usd",
"description" => "Item 1",
"customer" => $customer->id,
);
array_push($totalitems, $currentitem);
}
if ( $item2 == "true" ) {
$currentitem = array(
"amount" => 29999,
"currency" => "usd",
"description" => "Item 2",
"customer" => $customer->id,
);
array_push($totalitems, $currentitem);
}
$charge = \Stripe\Charge::create([$totalitems]);
Run Code Online (Sandbox Code Playgroud)
这仅对数组中的第一项收费。有没有办法同时为多个项目充电?
如何为 stripe CardInputWidget 添加邮政编码 我可以使用 CardMultilineWidget 实现这一点,但我现在需要在一行中输入卡号、MM/YY 和 CVV 我还需要一个地方来输入邮政编码代码。
<com.stripe.android.view.CardInputWidget
android:id="@+id/card_input_widget"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
Run Code Online (Sandbox Code Playgroud)
我收到来自 Stripe API GET /invoices 端点的响应,该端点将日期作为 unix 时间戳返回。示例值为 1573917475。我需要将此值保存在 Mongoose 中的 ISO 格式中。示例:2019-11-16T15:17:55 我熟悉如何使用 Javascript 或 MomentJS 将此值转换为 ISO / UTC 格式的日期时间值。但是,如果可能,我想在 Mongoose Schema 中设置此行为。
包含时间戳值的 API 响应:
{
"period_end": 1576509475,
"period_start": 1573917475
}
Run Code Online (Sandbox Code Playgroud)
猫鼬架构:
new Schema({
... redacted ...
period_end: { type: Date },
period_start: { type: Date },
... redacted ...
});
Run Code Online (Sandbox Code Playgroud)
目前正在使用以下值保存 Mongo 中的 as 日期:
{
"period_end": "1970-01-19T04:34:23.671+0000"
}
Run Code Online (Sandbox Code Playgroud)
When the year is 1970 this is usually because an issue with the input date format. Can …
是否可以使用 Stripe PHP SDK 从 PaymentIntent 对象(与 Charges API 不同)获取卡的最后 4 位数字?
按照我的服务器 ( Firebase )的指南,他们向用户收费:
const payment = await stripe.paymentIntents.create(
{
amount,
currency,
customer,
payment_method,
off_session: false,
confirm: true,
confirmation_method: 'manual',
},
{ idempotencyKey }
);
Run Code Online (Sandbox Code Playgroud)
现在在所有Stripe示例中,他们使用类似的东西:
const subscription = await stripe.subscriptions.create({
customer: '{{CUSTOMER_ID}}',
items: [{
price: '{{RECURRING_PRICE_ID}}',
}],
add_invoice_items: [{
price: '{{PRICE_ID}}',
}],
});
Run Code Online (Sandbox Code Playgroud)
我试图理解:
paymentIntent做什么的?以及它与订阅有何关系?(对我来说,它只是向用户收费,不清楚这是一次性收费还是订阅)阅读文档无济于事,因为它充满了如此多的信息和选项而没有清晰的流程。
我正在尝试将 Stripe 集成到我的网站中,但我目前遇到了一些麻烦。我其实有疑问
#1:
我已经关注了这个线程和这个stackblitz页面。但它仍然无法正常工作。看起来我的应用程序没有选择 Stripe 组件。
我的.ts文件
import {
Component,
AfterViewInit,
OnDestroy,
ViewChild,
ElementRef,
ChangeDetectorRef
} from '@angular/core';
import { NgForm } from "@angular/forms"
import { AngularStripeService } from '@fireflysemantics/angular-stripe-service'
@Component({
selector: 'payment',
templateUrl: './payment.component.html',
styleUrls: ['./payment.component.css']
})
export class PaymentComponent implements AfterViewInit, OnDestroy {
@ViewChild('cardInfo', { static: false }) cardInfo: ElementRef;
stripe: any;
loading = false;
confirmation: any;
card: any;
cardHandler = this.onChange.bind(this);
error: any;
constructor(
private cd: ChangeDetectorRef,
private stripeService:AngularStripeService) {}
ngAfterViewInit() { …Run Code Online (Sandbox Code Playgroud) stripe pricing api不提供tired -graduate定价金额的详细信息。
::Stripe::Price.retrieve('price_1HMjKfHHVdXnGelT')
Run Code Online (Sandbox Code Playgroud)
这是回应:
<Stripe::Price:0x3fed95f00ab0 id=price_1HMjKfHHVdXnss3> JSON: {
"id": "price_1HMjKfHHVdXnGelT7fB47cEk",
"object": "price",
"active": true,
"billing_scheme": "tiered",
"created": 1599004569,
"currency": "aud",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"product": "prod_HwcZXLTSewzcj1",
"recurring": {"aggregate_usage":null,"interval":"month","interval_count":1,"trial_period_days":null,"usage_type":"licensed"},
"tiers_mode": "graduated",
"transform_quantity": null,
"type": "recurring",
"unit_amount": null,
"unit_amount_decimal": null
}
Run Code Online (Sandbox Code Playgroud)
此图像是条纹仪表板(开发人员控制台 -> 网络选项卡)。
tiers上面的api中缺少键
在条带文档中,它说:
所以在这种情况下,结帐页面会转到我前端的成功或失败页面。
我使用后端来跟踪付款状态,以便我们可以监控管理门户中的交易,而上述方法对我来说似乎很危险。
结帐成功后,它将窗口重定向到成功 url。这意味着我必须在成功页面中调用后端 API 来更新付款状态。但是,stripe 是支付状态的真实来源,DB 上的状态更新应该来自 Stripe,而不是来自前端页面。至少,如果用户刷新成功页面,它会一次又一次地调用 API,这很糟糕。此外,它是关于“用户说我支付成功”与“Stripe 说他们支付成功”。
我尝试了 Stripe webhooks,但在 webhook 数据对象中,没有信息可用于将其链接到创建结帐会话时生成的 sessionId,但会话 ID 是我可以从 Stripe 获取的唯一跟踪 ID关于付款。
如果 Checkout 是安全更新我的数据库的唯一解决方案,最佳实践是什么?
stripe-payments ×10
php ×2
android ×1
angular ×1
java ×1
javascript ×1
kotlin ×1
mongodb ×1
mongoose ×1
node.js ×1
ssl ×1
tls1.2 ×1
typescript ×1