目次一覧
状態:-
閲覧数:444
投稿日:2019-08-24
更新日:2019-08-25
Q67 / A / 連絡
Q67 / A / 連絡
Q67
Can only apply an application_fee when the request is made on behalf of another account (using an OAuth key, the Stripe-Account header, or the destination parameter).
2019/8/24
下記エラーが出ます。原因は何でしょうか?
Can only apply an application_fee when the request is made on behalf of another account (using an OAuth key, the Stripe-Account header, or the destination parameter).
※やりたいことは、Connect StandardアカウントのDirect Chargeです
コード
Can only apply an application_fee when the request is made on behalf of another account (using an OAuth key, the Stripe-Account header, or the destination parameter).
※やりたいことは、Connect StandardアカウントのDirect Chargeです
コード
<?php
\Stripe\Stripe::setApiKey("sk_test_xxxx"); //親 テスト シークレット
$checkoutSession = \Stripe\Checkout\Session::create([
'payment_method_types' => ['card'],
'line_items' => [[
'name' => "Checkout Session Direct Charges デモ3",
'amount' => 200,
'currency' => 'jpy',
'quantity' => 10,
]],
'payment_intent_data' => [
'application_fee_amount' => 200,
'metadata' => ['fw_login_flag' => 'true','fw_entry_id' => 846,],
],
'success_url' => 'https://xxxx/thanks.php?session_id={CHECKOUT_SESSION_ID}',
'cancel_url' => 'https://xxxx/cancel.php',
'client_reference_id' => '725',
], [
'stripe_account' => 'acct_1F0zwJLlsmkNgPt8', //子
]);
?>
<button id="checkout-button" role="link">Pay</button>
<div id="error-message"></div>
<script src="https://js.stripe.com/v3"></script>
<script>
const stripe = Stripe('pk_test_xxxx', { //親テスト公開キー
stripeAccount: 'acct_xxxx', //子
});
const checkoutButton = document.getElementById('checkout-button');
checkoutButton.addEventListener('click', function () {
stripe.redirectToCheckout({
sessionId: '<?php echo $checkoutSession->id; ?>'
})
.then(function (result) {
if (result.error) {
var displayError = document.getElementById('error-message');
displayError.textContent = result.error.message;
}
});
});
</script>
A
ご教示いただいたエラーに関して、詳しく調査させていただきたく存じます。
つきましては、お手数をおかけし恐縮ですが、該当のエラーが発生したリクエストIDをご教示いただけますでしょうか。
念のためのご案内とはなりますが、Connectを利用した際の Checkout session の作成に関しては、下記に記載がございます:https://stripe.com/docs/payments/payment-intents/use-cases#connected-accounts
つきましては、お手数をおかけし恐縮ですが、該当のエラーが発生したリクエストIDをご教示いただけますでしょうか。
念のためのご案内とはなりますが、Connectを利用した際の Checkout session の作成に関しては、下記に記載がございます:https://stripe.com/docs/payments/payment-intents/use-cases#connected-accounts
連絡
表記の件ですが、自己解決しました。
原因は、(親子アカウントの)ApiKey記載を間違えていました。
原因は、(親子アカウントの)ApiKey記載を間違えていました。