关联帐户的条带化结帐出现“无效的payment_page ID”错误

时间:2019-05-10 14:43:49

标签: stripe-payments

我正在尝试将我网站上的Stripe Checkout的最新版本与连接的帐户和使用目的地费用的平台费进行集成。

首先,我创建一个会话:

$session = \Stripe\Checkout\Session::create([
    'customer_email' => $_SESSION["EMAIL"],
    'client_reference_id' => $_SESSION["USER_ID"],
    'payment_method_types' => ['card'],
    'line_items' => [[
        'name' => $listing["title"],
        'description' => $nb_days . " night(s) / " . $nb_guests . " guest(s) in " . $listing["title"],
        'images' => [URL . "img/logo.png"],
        'amount' => $total_stripe,
        'currency' => 'usd',
        'quantity' => 1,
    ]],
    'payment_intent_data' => [
        'application_fee_amount' => $total_fee,
        'transfer_data' => [
          'destination' => $owner_stripe_id,
        ],
    ],
    'success_url' => URL . 'order-success.php',
    'cancel_url' => URL . 'book-listing.php?action=order_error',
]); 

然后,在我的JS代码中,我提供由上面的会话创建的ID,并引用将接收款项的关联帐户:

var stripe = Stripe(STRIPE_PK_KEY, {
    stripeAccount: STRIPE_CONNECT_ID,
});

$(".btn-confirm-pay").click(function(e) {

    stripe.redirectToCheckout({
        sessionId: STRIPE_SESSION_ID,
    }).then(function (result) {

    });

});

但是,当我单击按钮.btn-confirm-pay时,我被重定向到Stripe,该错误显示错误“发生了错误”,当我检查控制台时,我看到Stripe出现404错误,并显示以下消息:无效Payment_page ID:cs_test_xxx ...

我注意到,当我使用“直接收费”方法代替here中所述的“目的地费用”时,不会出现此错误。

您能帮助解决此问题吗?

1 个答案:

答案 0 :(得分:1)

您应该在Javascript中省略stripeAccount。仅当您使用直接收费时,即在已连接的帐户上创建Checkout会话对象。在您的情况下,您使用的是目的地费用,因此Checkout Session对象存在于您的平台帐户中,因此您不想使用stripeAccount。我认为,Stripe的文档对此可能是错误的。