mirror of
https://github.com/itflow-org/itflow
synced 2026-09-22 22:51:17 +00:00
Potential fix for Stripe charges being off by a cent
This commit is contained in:
@@ -410,7 +410,7 @@ if (isset($_POST['add_payment_stripe'])) {
|
|||||||
// Create a payment intent
|
// Create a payment intent
|
||||||
try {
|
try {
|
||||||
$payment_intent = $stripe->paymentIntents->create([
|
$payment_intent = $stripe->paymentIntents->create([
|
||||||
'amount' => intval($balance_to_pay * 100), // Times by 100 as Stripe expects values in cents
|
'amount' => intval(round($balance_to_pay * 100)), // Times by 100 as Stripe expects values in cents
|
||||||
'currency' => $invoice_currency_code,
|
'currency' => $invoice_currency_code,
|
||||||
'customer' => $payment_provider_client,
|
'customer' => $payment_provider_client,
|
||||||
'payment_method' => $saved_payment_method,
|
'payment_method' => $saved_payment_method,
|
||||||
|
|||||||
@@ -848,7 +848,7 @@ if (isset($_GET['add_payment_by_provider'])) {
|
|||||||
// Create a payment intent
|
// Create a payment intent
|
||||||
try {
|
try {
|
||||||
$payment_intent = $stripe->paymentIntents->create([
|
$payment_intent = $stripe->paymentIntents->create([
|
||||||
'amount' => intval($balance_to_pay * 100), // Times by 100 as Stripe expects values in cents
|
'amount' => intval(round($balance_to_pay * 100)), // Times by 100 as Stripe expects values in cents
|
||||||
'currency' => $invoice_currency_code,
|
'currency' => $invoice_currency_code,
|
||||||
'customer' => $payment_provider_client,
|
'customer' => $payment_provider_client,
|
||||||
'payment_method' => $saved_payment_method,
|
'payment_method' => $saved_payment_method,
|
||||||
|
|||||||
@@ -953,7 +953,7 @@ while ($row = mysqli_fetch_assoc($sql_recurring_payments)) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$payment_intent = $stripe->paymentIntents->create([
|
$payment_intent = $stripe->paymentIntents->create([
|
||||||
'amount' => intval($balance_to_pay * 100),
|
'amount' => intval(round($balance_to_pay * 100)),
|
||||||
'currency' => $recurring_payment_currency_code,
|
'currency' => $recurring_payment_currency_code,
|
||||||
'customer' => $stripe_customer_id,
|
'customer' => $stripe_customer_id,
|
||||||
'payment_method' => $stripe_payment_method_id,
|
'payment_method' => $stripe_payment_method_id,
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ if (isset($_GET['stripe_create_pi'])) {
|
|||||||
\Stripe\Stripe::setApiKey($stripe_secret_key);
|
\Stripe\Stripe::setApiKey($stripe_secret_key);
|
||||||
|
|
||||||
$paymentIntent = \Stripe\PaymentIntent::create([
|
$paymentIntent = \Stripe\PaymentIntent::create([
|
||||||
'amount' => intval($balance_to_pay * 100), // Stripe expects cents
|
'amount' => intval(round($balance_to_pay * 100)), // Stripe expects cents
|
||||||
'currency' => $invoice_currency_code,
|
'currency' => $invoice_currency_code,
|
||||||
'description' => $pi_description,
|
'description' => $pi_description,
|
||||||
'metadata' => [
|
'metadata' => [
|
||||||
|
|||||||
Reference in New Issue
Block a user