#thehollytoats_code
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1243260262744854680
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi ๐
You are getting an error because you either use application_fee_amount OR transfer_data.amount to determine how much of the funds your platform keeps. You need to pick which one you want to use.
For Destination chages, we recommend using transfer_data.amount
I received error: PHP Fatal error: Uncaught Error sending request to Stripe: (Status 400) (Request req_S79t672mCqisEt) Received unknown parameter: transfer_data
Below is the code:
$checkout_session = $stripe->checkout->sessions->create([
'ui_mode' => 'embedded',
'line_items' => [[
'price_data' => [
'currency' => $currency,
'unit_amount' => $cart_total * 100, // Amount in cents ($10.00)
'product_data' => [
'name' => $content, // Replace with your product name
],
],
'quantity' => 1,
]],
'mode' => 'payment',
'metadata' => ['mac' => $mac],
'return_url' => $YOUR_DOMAIN . '/pay_auth_ok.php?session_id={CHECKOUT_SESSION_ID}',
'automatic_tax' => [
'enabled' => true,
],
'payment_intent_data' => [
'setup_future_usage' => 'off_session',
'capture_method' => 'manual',
],
'transfer_data' => array(
'amount' => $application_fee_amount,
),
]);
transfer_data is not a parameter on a Checkout Session API request.
If you want to use Checkout Sessions with transfer amounts, you need to pass that in payment_intent_data.transfer_data
https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-payment_intent_data-transfer_data
Also I think you are misunderstanding how the transfer_data.amount parameter works. When you specify that amount, you are telling Stripe how much of the original charge to send to the Connected Account.
So if you, the Platform, want to keep $1 from a $10 charge, you set the transfer_data.amount to $9
Thank you. I fix some part of it, but now I get
PHP Fatal error: Uncaught Error sending request to Stripe: (Status 400) (Request req_ZkmDeeqZEBcGEs) Invalid object
Stripe\Exception\InvalidRequestException: Invalid object in /var/www/html/au/wp-content/plugins/qrpaynow/stripe-php/lib/Exception/ApiErrorException.php:38
here is the updated code:
$checkout_session = $stripe->checkout->sessions->create([
'ui_mode' => 'embedded',
'line_items' => [[
'price_data' => [
'currency' => $currency,
'unit_amount' => $cart_total * 100, // Amount in cents ($10.00)
'product_data' => [
'name' => $content, // Replace with your product name
],
],
'quantity' => 1,
]],
'mode' => 'payment',
'metadata' => ['mac' => $mac],
'return_url' => $YOUR_DOMAIN . '/pay_auth_ok.php?session_id={CHECKOUT_SESSION_ID}',
'automatic_tax' => [
'enabled' => false,
'liability' => 'self',
],
'payment_intent_data' => [
'setup_future_usage' => 'off_session',
'capture_method' => 'manual',
'transfer_data' => array(
'destination' => $connected_account_id, // Charge the connected account
'amount' => $cart_total *100 - $application_fee_amount,
),
]
]);
See the full error in your dashboard: https://dashboard.stripe.com/test/logs/req_ZkmDeeqZEBcGEs
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
message: "Invalid object",
param: "automatic_tax[liability]",
'automatic_tax' => [
'enabled' => false,
'liability' => 'self',
],
this is not valid
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
liability should be an object with type=self
'automatic_tax' => [
'enabled' => false,
'liability' => [ 'type' => 'self'],
],
It works!
Thank you very much.