此Stripe请求和响应是否已准备好SCA?我到处搜索,Stripe仪表板说一切都很好,但是它没有任何SCA状态或SCA详细信息。
基于其他答案,响应中没有requires_action
元素。另外,我想保留当前的付款方式,不想迁移到 Elements 或其他付款方式。
很抱歉,代码转储非常简短。我拿出了不相关的代码。
<?php
$plan = \Stripe\Plan::create([
"product" => [
"name" => "My Product",
"type" => "service"
],
"nickname" => "My Product",
"interval" => "month",
"interval_count" => "1",
"currency" => "usd",
"amount" => "3000",
]);
$customer = \Stripe\Customer::create([
'email' => $email,
'source' => $token,
]);
$subscription = \Stripe\Subscription::create([
"customer" => $customer->id,
"items" => [
[
"plan" => $plan->id,
]
]
]);
echo '<h1>Successfully charged $30.00!</h1>';
echo '<pre>';
print_r($subscription);
echo '</pre>';
响应为:
Stripe\Subscription Object
(
[id] => sub_GBuKoA4aJzHzlH
[object] => subscription
[application_fee_percent] =>
[billing] => charge_automatically
[billing_cycle_anchor] => 1573930876
[billing_thresholds] =>
[cancel_at] =>
[cancel_at_period_end] =>
[canceled_at] =>
[collection_method] => charge_automatically
[created] => 1573930876
[current_period_end] => 1576522876
[current_period_start] => 1573930876
[customer] => cus_GBuKmMlIGTZv7O
[days_until_due] =>
[default_payment_method] =>
[default_source] =>
[default_tax_rates] => Array
(
)
[discount] =>
[ended_at] =>
[invoice_customer_balance_settings] => Stripe\StripeObject Object
(
[consume_applied_balance_on_void] => 1
)
[items] => Stripe\Collection Object
(
[object] => list
[data] => Array
(
[0] => Stripe\SubscriptionItem Object
(
[id] => si_GBuKVkWxNTIKCw
[object] => subscription_item
[billing_thresholds] =>
[created] => 1573930877
[metadata] => Stripe\StripeObject Object
(
)
[plan] => Stripe\Plan Object
(
[id] => plan_GBuKHcb3Vp0wlg
[object] => plan
[active] => 1
[aggregate_usage] =>
[amount] => 3000
[amount_decimal] => 3000
[billing_scheme] => per_unit
[created] => 1573930876
[currency] => usd
[interval] => month
[interval_count] => 1
[livemode] =>
[metadata] => Stripe\StripeObject Object
(
)
[nickname] => My Product
[product] => prod_GBuKw4kNot7jHc
[tiers] =>
[tiers_mode] =>
[transform_usage] =>
[trial_period_days] =>
[usage_type] => licensed
)
[quantity] => 1
[subscription] => sub_GBuKoA4aJzHzlH
[tax_rates] => Array
(
)
)
)
[has_more] =>
[total_count] => 1
[url] => /v1/subscription_items?subscription=sub_GBuKoA4aJzHzlH
)
[latest_invoice] => in_1FfWWG2qoWCIfwhBgZNXG7gh
[livemode] =>
[metadata] => Stripe\StripeObject Object
(
)
[next_pending_invoice_item_invoice] =>
[pending_invoice_item_interval] =>
[pending_setup_intent] =>
[plan] => Stripe\Plan Object
(
[id] => plan_GBuKHcb3Vp0wlg
[object] => plan
[active] => 1
[aggregate_usage] =>
[amount] => 3000
[amount_decimal] => 3000
[billing_scheme] => per_unit
[created] => 1573930876
[currency] => usd
[interval] => month
[interval_count] => 1
[livemode] =>
[metadata] => Stripe\StripeObject Object
(
)
[nickname] => My Product
[product] => prod_GBuKw4kNot7jHc
[tiers] =>
[tiers_mode] =>
[transform_usage] =>
[trial_period_days] =>
[usage_type] => licensed
)
[quantity] => 1
[schedule] =>
[start] => 1573930876
[start_date] => 1573930876
[status] => active
[tax_percent] =>
[trial_end] =>
[trial_start] =>
)