#lk_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/1294353446098440254
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there
when the transaction goes through its $5,242.35
Do you have a PaymentIntent ID for this?
pi_3Q8mWcLKTM2K3idy1VXX0hpY
I've sent a few invoices -- that amount is for a previous client
but i've updated my code -- it should not be more than $2700.75
Happy to send my php if needed.
Here's the first charge they tried: pi_3Q8lXqLKTM2K3idy0PRvRflN
Here's my paymentIntent
try {
// Create a PaymentIntent with metadata for fee tracking
$paymentIntent = PaymentIntent::create([
'amount' => $amount_due_cents,
'currency' => 'usd',
'payment_method_types' => ['card'],
'application_fee_amount' => intval(($sketchplay_fee + $stripe_processing_fee + $stripe_fixed_fee) * 100),
'transfer_data' => [
'destination' => $connected_account_id,
],
'metadata' => [
'team_player_fee' => $team_player_fee,
'sketchplay_fee' => $sketchplay_fee,
'stripe_processing_fee' => $stripe_processing_fee,
'stripe_fixed_fee' => $stripe_fixed_fee,
'customer_email' => $customerEmail,
],
'receipt_email' => $customerEmail,
]);
// Log the PaymentIntent for debugging
error_log("PaymentIntent created: " . json_encode($paymentIntent));
echo json_encode([
'clientSecret' => $paymentIntent->client_secret,
]);
exit;
} catch (Exception $e) {
error_log("Stripe API Error: " . $e->getMessage());
http_response_code(500);
echo json_encode(['error' => 'An error occurred while processing your payment. Please try again.']);
exit;
}
I think I figured it out
Maybe the metadata is cached? Although, this is a new file.
I recommend logging the values you're expecting to pass to make sure they're what you expect
You can look at the creation request for that PI here to see what we received: https://dashboard.stripe.com/logs/req_4OvXdBGb0dZsxg
Yeah, thats whats in my php_error log file.
"amount": 524235
i don't know how thats being passed -- when
// Define payment amount and fees
$team_player_fee = 2550; // $2550 base fee
$sketchplay_fee_percentage = 0.03; // 3% Sketchplay Fee
$stripe_processing_fee_percentage = 0.029; // 2.9% Stripe Fee
$stripe_fixed_fee = 0.30; // Fixed $0.30 Stripe Fee
// Calculate fees
$sketchplay_fee = $team_player_fee * $sketchplay_fee_percentage;
$stripe_processing_fee = $team_player_fee * $stripe_processing_fee_percentage;
$total_fee = $sketchplay_fee + $stripe_processing_fee + $stripe_fixed_fee;
// Calculate final amount
$amount_due = $team_player_fee + $total_fee;
// Convert amount to cents (Stripe uses smallest currency unit)
$amount_due_cents = intval($amount_due * 100);
I think you should add some more logging here at every calculation step so you know what each value is, e., log the value of sketchplay_fee, etc.
doing that now and then running test mode
that value is from a previous client invoice I setup -- i copied and pasted the file and modified the content and the values for new client (2550). I also have several more invoices out -- so assuming they are all broke too.
fun day! lol
I'm blaming it on texas longhorns... go sooners!
damnit!!! found it
try {
// Send the email to the server to create the PaymentIntent
const response = await fetch('mudsock-checkout.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-Token': csrfToken
},
body: JSON.stringify({
email: emailInput.value
})
});
mudsock-checkout = old client
Ooh good find!
Thanks for the help!!1