diff --git a/packages/plugin/src/Bundles/Fields/FieldProvider.php b/packages/plugin/src/Bundles/Fields/FieldProvider.php index f4c266350..a997be5a1 100644 --- a/packages/plugin/src/Bundles/Fields/FieldProvider.php +++ b/packages/plugin/src/Bundles/Fields/FieldProvider.php @@ -42,6 +42,16 @@ public function getFieldByUid(string $fieldUid, ?Form $form = null): ?FieldInter return $field; } + $row = $this->getRowByUid($fieldUid, $form->getId()); + + if ($row) { + $field = $this->createField($row, $form, false); + + if ($field instanceof FieldInterface) { + return $field; + } + } + $this->getFields($form); return $this->cache->get($formFieldKey, self::PREFIX_BY_FORM_UID); @@ -151,6 +161,23 @@ static function () use ($formId): array { ); } + private function getRowByUid(string $fieldUid, int $formId): ?array + { + $rowsTable = FormRowRecord::TABLE; + + return FormFieldRecord::find() + ->select(['field.*', 'row.uid as rowUid']) + ->alias('field') + ->innerJoin("{$rowsTable} row", '[[row.id]] = [[field.rowId]]') + ->where([ + 'field.formId' => $formId, + 'field.uid' => $fieldUid, + ]) + ->asArray() + ->one() + ; + } + private function createField(array $row, ?Form $form = null, bool $cacheGlobally = true): ?FieldInterface { $form ??= $this->getForm($row['formId']); diff --git a/packages/plugin/src/Integrations/PaymentGateways/Stripe/Fields/StripeField.php b/packages/plugin/src/Integrations/PaymentGateways/Stripe/Fields/StripeField.php index 5375f274e..d5cad8474 100644 --- a/packages/plugin/src/Integrations/PaymentGateways/Stripe/Fields/StripeField.php +++ b/packages/plugin/src/Integrations/PaymentGateways/Stripe/Fields/StripeField.php @@ -177,7 +177,7 @@ class StripeField extends AbstractField implements PaymentFieldInterface, SkipGi #[ValueTransformer(FieldTransformer::class)] #[Input\Field( label: 'Payment Amount Field', - instructions: 'Select a Number field which will determine the payment amount.', + instructions: 'Select a Number field which will determine the payment amount. The minimum amount is $0.50 US or equivalent in Payment Currency.', emptyOption: 'No field selected', implements: [ NumericInterface::class, diff --git a/packages/plugin/src/Integrations/PaymentGateways/Stripe/Services/StripePriceService.php b/packages/plugin/src/Integrations/PaymentGateways/Stripe/Services/StripePriceService.php index 3d74d3c83..fd62604f6 100644 --- a/packages/plugin/src/Integrations/PaymentGateways/Stripe/Services/StripePriceService.php +++ b/packages/plugin/src/Integrations/PaymentGateways/Stripe/Services/StripePriceService.php @@ -154,6 +154,12 @@ private function getDynamicAmount(Form $form, StripeField $field): float $amount = (float) $formField->getValue(); } + // Stripe expects the minimum amount of $0.50 US or equivalent in Payment Currency. + // https://docs.stripe.com/api/payment_intents/create?lang=php&api-version=2026-02-25.clover#create_payment_intent-amount + if (empty($amount)) { + return 0.5; + } + return $amount; } diff --git a/packages/plugin/src/translations/de/freeform.php b/packages/plugin/src/translations/de/freeform.php index f86b52e52..9ff509de6 100644 --- a/packages/plugin/src/translations/de/freeform.php +++ b/packages/plugin/src/translations/de/freeform.php @@ -259,6 +259,7 @@ 'Enter the amount you want to charge for this payment.' => 'Geben Sie den Betrag ein, den Sie für diese Zahlung berechnen möchten.', 'Payment Amount Field' => 'Zahlungsbetragsfeld', 'Select a Number field which will determine the payment amount.' => 'Wählen Sie ein Zahlenfeld aus, das den Zahlungsbetrag bestimmt.', + 'Select a Number field which will determine the payment amount. The minimum amount is $0.50 US or equivalent in Payment Currency.' => 'Wählen Sie ein Zahlenfeld aus, das den Zahlungsbetrag bestimmt. Der Mindestbetrag beträgt 0,50 US-Dollar oder den entsprechenden Gegenwert in Ihrer Währung.', 'Payment Currency' => 'Zahlungswährung', 'Subscription Product Name' => 'Name des Abonnementprodukts', 'Enter the name of the product you want to subscribe to. You can use the `form` and `integration` objects in twig.' => 'Geben Sie den Namen des Produkts ein, für das Sie sich anmelden möchten. Sie können die Objekte `form` und `integration` in Twig verwenden.', diff --git a/packages/plugin/src/translations/en/freeform.php b/packages/plugin/src/translations/en/freeform.php index 7a5b87967..7906cada3 100644 --- a/packages/plugin/src/translations/en/freeform.php +++ b/packages/plugin/src/translations/en/freeform.php @@ -259,6 +259,7 @@ 'Enter the amount you want to charge for this payment.' => 'Enter the amount you want to charge for this payment.', 'Payment Amount Field' => 'Payment Amount Field', 'Select a Number field which will determine the payment amount.' => 'Select a Number field which will determine the payment amount.', + 'Select a Number field which will determine the payment amount. The minimum amount is $0.50 US or equivalent in Payment Currency.' => 'Select a Number field which will determine the payment amount. The minimum amount is $0.50 US or equivalent in Payment Currency.', 'Payment Currency' => 'Payment Currency', 'Subscription Product Name' => 'Subscription Product Name', 'Enter the name of the product you want to subscribe to. You can use the `form` and `integration` objects in twig.' => 'Enter the name of the product you want to subscribe to. You can use the `form` and `integration` objects in twig.', diff --git a/packages/plugin/src/translations/fr/freeform.php b/packages/plugin/src/translations/fr/freeform.php index 4078b66c1..63b621cdd 100644 --- a/packages/plugin/src/translations/fr/freeform.php +++ b/packages/plugin/src/translations/fr/freeform.php @@ -259,6 +259,7 @@ 'Enter the amount you want to charge for this payment.' => 'Entrez le montant que vous voulez facturer pour ce paiement.', 'Payment Amount Field' => 'Champ du montant du paiement', 'Select a Number field which will determine the payment amount.' => 'Sélectionnez un champ Nombre qui déterminera le montant du paiement.', + 'Select a Number field which will determine the payment amount. The minimum amount is $0.50 US or equivalent in Payment Currency.' => 'Sélectionnez un champ Nombre qui déterminera le montant du paiement. Le montant minimum est de 0,50$ US ou l’équivalent dans la devise de paiement.', 'Payment Currency' => 'Devise du paiement', 'Subscription Product Name' => 'Nom du produit d’abonnement', 'Enter the name of the product you want to subscribe to. You can use the `form` and `integration` objects in twig.' => 'Entrez le nom du produit auquel vous voulez vous abonner. Vous pouvez utiliser les objets `form` et `integration` dans twig.', diff --git a/packages/plugin/src/translations/it/freeform.php b/packages/plugin/src/translations/it/freeform.php index da5a4910d..be697bd59 100644 --- a/packages/plugin/src/translations/it/freeform.php +++ b/packages/plugin/src/translations/it/freeform.php @@ -259,6 +259,7 @@ 'Enter the amount you want to charge for this payment.' => 'Inserisci l’importo da addebitare per questo pagamento.', 'Payment Amount Field' => 'Campo importo del pagamento', 'Select a Number field which will determine the payment amount.' => 'Seleziona un campo numerico che determinerà l’importo del pagamento.', + 'Select a Number field which will determine the payment amount. The minimum amount is $0.50 US or equivalent in Payment Currency.' => 'Seleziona un campo numerico che determinerà l’importo del pagamento. L’importo minimo è di 0,50 dollari USA o l’equivalente nella valuta di pagamento.', 'Payment Currency' => 'Valuta del pagamento', 'Subscription Product Name' => 'Nome del prodotto in abbonamento', 'Enter the name of the product you want to subscribe to. You can use the `form` and `integration` objects in twig.' => 'Inserisci il nome del prodotto a cui abbonarsi. Puoi usare gli oggetti `form` e `integration` in Twig.', diff --git a/packages/plugin/src/translations/nl/freeform.php b/packages/plugin/src/translations/nl/freeform.php index 43180623c..2a5990b9b 100644 --- a/packages/plugin/src/translations/nl/freeform.php +++ b/packages/plugin/src/translations/nl/freeform.php @@ -259,6 +259,7 @@ 'Enter the amount you want to charge for this payment.' => 'Vul het bedrag in dat u voor deze betaling in rekening wilt brengen.', 'Payment Amount Field' => 'Betalingsbedragveld', 'Select a Number field which will determine the payment amount.' => 'Selecteer een nummerveld dat het betalingsbedrag bepaalt.', + 'Select a Number field which will determine the payment amount. The minimum amount is $0.50 US or equivalent in Payment Currency.' => 'Selecteer een nummerveld dat het betalingsbedrag bepaalt. Het minimumbedrag is $0,50 USD of het equivalent in de betaalvaluta.', 'Payment Currency' => 'Betalingsvaluta', 'Subscription Product Name' => 'Productnaam abonnement', 'Enter the name of the product you want to subscribe to. You can use the `form` and `integration` objects in twig.' => 'Vul de naam in van het product waarop u zich wilt abonneren. U kunt de `form`- en `integration`-objecten in twig gebruiken.',