You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And it will return blank form. Sometimes we don't exactly know total amount, before payment form initialization, for example for single page checkouts.
Also there is a bug I think, when I want to initialize form with data:
payment_form = payment.get_form(request.POST or None)
Some payment gateways require the form to be cryptographically signed using a hidden input. You need a payment object to do this.
Some payment gateways require that the form's action points to an external server. You can't put these inside a single page checkout.
get_form() is really a view. It either returns a form to display or tells you to redirect the user somewhere. It was not meant to be composed with other such views as there is no way to redirect a single browser to two separate resources. If you really want to call get_form() from a composite view, do not pass in data unless all other forms are valid and you've already saved them (so that get_form() can save whatever it wants and take over).
Now when I want to render payment form (example with Stripe) I have to do something like this:
And it will return blank form. Sometimes we don't exactly know total amount, before payment form initialization, for example for single page checkouts.
Also there is a bug I think, when I want to initialize form with data:
It performs validation and save at this step⚠️
https://github.com/mirumee/django-payments/blob/master/payments/stripe/__init__.py#L33
In my opinion
get_form()
method shouldn't try to validate the form and for sure it shouldn't save the form.The text was updated successfully, but these errors were encountered: