#thehollytoats_code

1 messages ยท Page 1 of 1 (latest)

cobalt raftBOT
#

๐Ÿ‘‹ 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.

lyric oar
#

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

fierce moth
#

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,
),
]);

lyric oar
#

transfer_data is not a parameter on a Checkout Session API request.

#

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

cobalt raftBOT
fierce moth
#

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,
),
]
]);

karmic plinth
#
message: "Invalid object",
    param: "automatic_tax[liability]",
#
'automatic_tax' => [
    'enabled' => false,
    'liability' => 'self',
  ],

this is not valid

#

liability should be an object with type=self

#
'automatic_tax' => [
    'enabled' => false,
    'liability' => [ 'type' => 'self'],
  ],
fierce moth
#

It works!
Thank you very much.