Python(Django) :I want the payment form(code) triggered whenever a user clicks the submit button and only saved into DB if payment is succesful The Next CEO of Stack OverflowHow can I build multiple submit buttons django form?Django Form Submit Buttondjango form doesn't work on click submitSaving Django User in FormDisable form auto submit on button clickPHP submit button whenever user clicksGet file name from Django imagefield before submit with jQueryDjango: Saving form with User as Foreign keydjango models request get id error Room matching query does not existHow to submit Django form in the background by clicking a button?

vector calculus integration identity problem

Is it okay to majorly distort historical facts while writing a fiction story?

Is a distribution that is normal, but highly skewed, considered Gaussian?

From jafe to El-Guest

Is there an equivalent of cd - for cp or mv

Film where the government was corrupt with aliens, people sent to kill aliens are given rigged visors not showing the right aliens

What is the process for purifying your home if you believe it may have been previously used for pagan worship?

Aggressive Under-Indexing and no data for missing index

Expressing the idea of having a very busy time

Is there a way to save my career from absolute disaster?

What day is it again?

Can I board the first leg of the flight without having final country's visa?

Reference request: Grassmannian and Plucker coordinates in type B, C, D

What was Carter Burke's job for "the company" in Aliens?

Would a grinding machine be a simple and workable propulsion system for an interplanetary spacecraft?

Why did early computer designers eschew integers?

In the "Harry Potter and the Order of the Phoenix" video game, what potion is used to sabotage Umbridge's speakers?

Won the lottery - how do I keep the money?

Purpose of level-shifter with same in and out voltages

How to find image of a complex function with given constraints?

Is it convenient to ask the journal's editor for two additional days to complete a review?

How to get the last not-null value in an ordered column of a huge table?

TikZ: How to fill area with a special pattern?

Players Circumventing the limitations of Wish



Python(Django) :I want the payment form(code) triggered whenever a user clicks the submit button and only saved into DB if payment is succesful



The Next CEO of Stack OverflowHow can I build multiple submit buttons django form?Django Form Submit Buttondjango form doesn't work on click submitSaving Django User in FormDisable form auto submit on button clickPHP submit button whenever user clicksGet file name from Django imagefield before submit with jQueryDjango: Saving form with User as Foreign keydjango models request get id error Room matching query does not existHow to submit Django form in the background by clicking a button?










0















I am currently using DJANGO
How can I make the payment form(code) triggered when a user clickn submit and also make it saved into DB after successful payment. Please help me out.. i have been trying to solved this days back.



Here is my models.py



from django.db import models
class Promoting(models.Model):
yourname= models.CharField(max_length=60)
fathername= models.CharField(max_length=60)
mothername= models.CharField(max_length=60)
imagefield=models.ImageField(upload_to='postedimages')

def __str__(self):
return self.promoterauthor


Here is my views.py



from django.shortcuts import render
from .models import Promoting
def homepage(request):
if request.method == 'POST':
yourname=request.POST.get('yourname')
fathername=request.POST.get('fathername')
mothername=request.POST.get(' mothername')
imagefield=request.FILES['imagefield']
newdata=Promoting(promoterauthor=promoterauthor,websiteurl=websiteurl,tagline=tagline,imagefield=imagefield)
newone.save()
return render(request, 'success.html', )
else:
return render(request, 'homepage.html', )


Here is my form






<form action="% url 'home' %" method="POST" role="form" enctype="multipart/form-data class="contactForm">
% csrf_token %

<div class="form-row">
<div class="form-group col-md-6">
<input type="text" name="yourname" id="yourname" class="form-control" placeholder="Youur username" required>
</div>
<div class="form-group col-md-6">
<input type="" class="form-control" name="fathername" id="fathername" placeholder="Your Website" required>
</div>
</div>
<div class="form-group">
<input type="text" class="form-control" name="mothername" id="mothername" placeholder="Add a Tag line" required>
</div>
<div class="form-group">
<input type="file" class="form-control" name="imagefield" id="imagefield" placeholder="Your image" accept="image/*" required>
</div>
<div class="text-center"><button type="submit">Send Message</button></div>
</form>





The form submits successfully into the database and also my payment gateway(Rave by flutterwave.COM is working well)n I ONLY NEED A WAY TO LINK BOTH TOGETHER



Precisely, what I want is the payment form triggered once the submit button is clicked and I only want a the data saved into DB if only payment is successful .. please help out
The code snippet from my payment gateway also works when the pay button is clicked...
Here it the payment code






<form>
<script src="https://api.ravepay.co/flwv3-pug/getpaidx/api/flwpbf-inline.js"></script>
<button type="button" onClick="payWithRave()">Pay Now</button>
</form>

<script>
const API_publicKey = "FLWPUBK-152e7e9e17c0f7e985f9fee5838eafcc-X";

function payWithRave()
var x = getpaidSetup(
PBFPubKey: API_publicKey,
customer_email: "user@example.com",
amount:5,
customer_phone: "234099940409",
currency: "USD",
txref: "rave-123456",
meta: [
metaname: "flightID",
metavalue: "AP1234"
],
onclose: function() ,
callback: function(response)
);

</script>





THIS IS WHAT IS GENERATED BY THE PAYMENT CODE WHEN PAY IS CLICKED










share|improve this question
























  • You need to use Django forms or model forms and get data from cleaned_data

    – Rarblack
    Mar 21 at 20:32











  • @Rarblack Thanks for answering... I am now able to submit the data into database But i need a way to integrate the payment in such a way that whenever a user wants to submit those information the payment option provided up here will be triggered also the data in the form is submitted only after successful payment. Thankk

    – ray
    Mar 22 at 10:42















0















I am currently using DJANGO
How can I make the payment form(code) triggered when a user clickn submit and also make it saved into DB after successful payment. Please help me out.. i have been trying to solved this days back.



Here is my models.py



from django.db import models
class Promoting(models.Model):
yourname= models.CharField(max_length=60)
fathername= models.CharField(max_length=60)
mothername= models.CharField(max_length=60)
imagefield=models.ImageField(upload_to='postedimages')

def __str__(self):
return self.promoterauthor


Here is my views.py



from django.shortcuts import render
from .models import Promoting
def homepage(request):
if request.method == 'POST':
yourname=request.POST.get('yourname')
fathername=request.POST.get('fathername')
mothername=request.POST.get(' mothername')
imagefield=request.FILES['imagefield']
newdata=Promoting(promoterauthor=promoterauthor,websiteurl=websiteurl,tagline=tagline,imagefield=imagefield)
newone.save()
return render(request, 'success.html', )
else:
return render(request, 'homepage.html', )


Here is my form






<form action="% url 'home' %" method="POST" role="form" enctype="multipart/form-data class="contactForm">
% csrf_token %

<div class="form-row">
<div class="form-group col-md-6">
<input type="text" name="yourname" id="yourname" class="form-control" placeholder="Youur username" required>
</div>
<div class="form-group col-md-6">
<input type="" class="form-control" name="fathername" id="fathername" placeholder="Your Website" required>
</div>
</div>
<div class="form-group">
<input type="text" class="form-control" name="mothername" id="mothername" placeholder="Add a Tag line" required>
</div>
<div class="form-group">
<input type="file" class="form-control" name="imagefield" id="imagefield" placeholder="Your image" accept="image/*" required>
</div>
<div class="text-center"><button type="submit">Send Message</button></div>
</form>





The form submits successfully into the database and also my payment gateway(Rave by flutterwave.COM is working well)n I ONLY NEED A WAY TO LINK BOTH TOGETHER



Precisely, what I want is the payment form triggered once the submit button is clicked and I only want a the data saved into DB if only payment is successful .. please help out
The code snippet from my payment gateway also works when the pay button is clicked...
Here it the payment code






<form>
<script src="https://api.ravepay.co/flwv3-pug/getpaidx/api/flwpbf-inline.js"></script>
<button type="button" onClick="payWithRave()">Pay Now</button>
</form>

<script>
const API_publicKey = "FLWPUBK-152e7e9e17c0f7e985f9fee5838eafcc-X";

function payWithRave()
var x = getpaidSetup(
PBFPubKey: API_publicKey,
customer_email: "user@example.com",
amount:5,
customer_phone: "234099940409",
currency: "USD",
txref: "rave-123456",
meta: [
metaname: "flightID",
metavalue: "AP1234"
],
onclose: function() ,
callback: function(response)
);

</script>





THIS IS WHAT IS GENERATED BY THE PAYMENT CODE WHEN PAY IS CLICKED










share|improve this question
























  • You need to use Django forms or model forms and get data from cleaned_data

    – Rarblack
    Mar 21 at 20:32











  • @Rarblack Thanks for answering... I am now able to submit the data into database But i need a way to integrate the payment in such a way that whenever a user wants to submit those information the payment option provided up here will be triggered also the data in the form is submitted only after successful payment. Thankk

    – ray
    Mar 22 at 10:42













0












0








0








I am currently using DJANGO
How can I make the payment form(code) triggered when a user clickn submit and also make it saved into DB after successful payment. Please help me out.. i have been trying to solved this days back.



Here is my models.py



from django.db import models
class Promoting(models.Model):
yourname= models.CharField(max_length=60)
fathername= models.CharField(max_length=60)
mothername= models.CharField(max_length=60)
imagefield=models.ImageField(upload_to='postedimages')

def __str__(self):
return self.promoterauthor


Here is my views.py



from django.shortcuts import render
from .models import Promoting
def homepage(request):
if request.method == 'POST':
yourname=request.POST.get('yourname')
fathername=request.POST.get('fathername')
mothername=request.POST.get(' mothername')
imagefield=request.FILES['imagefield']
newdata=Promoting(promoterauthor=promoterauthor,websiteurl=websiteurl,tagline=tagline,imagefield=imagefield)
newone.save()
return render(request, 'success.html', )
else:
return render(request, 'homepage.html', )


Here is my form






<form action="% url 'home' %" method="POST" role="form" enctype="multipart/form-data class="contactForm">
% csrf_token %

<div class="form-row">
<div class="form-group col-md-6">
<input type="text" name="yourname" id="yourname" class="form-control" placeholder="Youur username" required>
</div>
<div class="form-group col-md-6">
<input type="" class="form-control" name="fathername" id="fathername" placeholder="Your Website" required>
</div>
</div>
<div class="form-group">
<input type="text" class="form-control" name="mothername" id="mothername" placeholder="Add a Tag line" required>
</div>
<div class="form-group">
<input type="file" class="form-control" name="imagefield" id="imagefield" placeholder="Your image" accept="image/*" required>
</div>
<div class="text-center"><button type="submit">Send Message</button></div>
</form>





The form submits successfully into the database and also my payment gateway(Rave by flutterwave.COM is working well)n I ONLY NEED A WAY TO LINK BOTH TOGETHER



Precisely, what I want is the payment form triggered once the submit button is clicked and I only want a the data saved into DB if only payment is successful .. please help out
The code snippet from my payment gateway also works when the pay button is clicked...
Here it the payment code






<form>
<script src="https://api.ravepay.co/flwv3-pug/getpaidx/api/flwpbf-inline.js"></script>
<button type="button" onClick="payWithRave()">Pay Now</button>
</form>

<script>
const API_publicKey = "FLWPUBK-152e7e9e17c0f7e985f9fee5838eafcc-X";

function payWithRave()
var x = getpaidSetup(
PBFPubKey: API_publicKey,
customer_email: "user@example.com",
amount:5,
customer_phone: "234099940409",
currency: "USD",
txref: "rave-123456",
meta: [
metaname: "flightID",
metavalue: "AP1234"
],
onclose: function() ,
callback: function(response)
);

</script>





THIS IS WHAT IS GENERATED BY THE PAYMENT CODE WHEN PAY IS CLICKED










share|improve this question
















I am currently using DJANGO
How can I make the payment form(code) triggered when a user clickn submit and also make it saved into DB after successful payment. Please help me out.. i have been trying to solved this days back.



Here is my models.py



from django.db import models
class Promoting(models.Model):
yourname= models.CharField(max_length=60)
fathername= models.CharField(max_length=60)
mothername= models.CharField(max_length=60)
imagefield=models.ImageField(upload_to='postedimages')

def __str__(self):
return self.promoterauthor


Here is my views.py



from django.shortcuts import render
from .models import Promoting
def homepage(request):
if request.method == 'POST':
yourname=request.POST.get('yourname')
fathername=request.POST.get('fathername')
mothername=request.POST.get(' mothername')
imagefield=request.FILES['imagefield']
newdata=Promoting(promoterauthor=promoterauthor,websiteurl=websiteurl,tagline=tagline,imagefield=imagefield)
newone.save()
return render(request, 'success.html', )
else:
return render(request, 'homepage.html', )


Here is my form






<form action="% url 'home' %" method="POST" role="form" enctype="multipart/form-data class="contactForm">
% csrf_token %

<div class="form-row">
<div class="form-group col-md-6">
<input type="text" name="yourname" id="yourname" class="form-control" placeholder="Youur username" required>
</div>
<div class="form-group col-md-6">
<input type="" class="form-control" name="fathername" id="fathername" placeholder="Your Website" required>
</div>
</div>
<div class="form-group">
<input type="text" class="form-control" name="mothername" id="mothername" placeholder="Add a Tag line" required>
</div>
<div class="form-group">
<input type="file" class="form-control" name="imagefield" id="imagefield" placeholder="Your image" accept="image/*" required>
</div>
<div class="text-center"><button type="submit">Send Message</button></div>
</form>





The form submits successfully into the database and also my payment gateway(Rave by flutterwave.COM is working well)n I ONLY NEED A WAY TO LINK BOTH TOGETHER



Precisely, what I want is the payment form triggered once the submit button is clicked and I only want a the data saved into DB if only payment is successful .. please help out
The code snippet from my payment gateway also works when the pay button is clicked...
Here it the payment code






<form>
<script src="https://api.ravepay.co/flwv3-pug/getpaidx/api/flwpbf-inline.js"></script>
<button type="button" onClick="payWithRave()">Pay Now</button>
</form>

<script>
const API_publicKey = "FLWPUBK-152e7e9e17c0f7e985f9fee5838eafcc-X";

function payWithRave()
var x = getpaidSetup(
PBFPubKey: API_publicKey,
customer_email: "user@example.com",
amount:5,
customer_phone: "234099940409",
currency: "USD",
txref: "rave-123456",
meta: [
metaname: "flightID",
metavalue: "AP1234"
],
onclose: function() ,
callback: function(response)
);

</script>





THIS IS WHAT IS GENERATED BY THE PAYMENT CODE WHEN PAY IS CLICKED






<form action="% url 'home' %" method="POST" role="form" enctype="multipart/form-data class="contactForm">
% csrf_token %

<div class="form-row">
<div class="form-group col-md-6">
<input type="text" name="yourname" id="yourname" class="form-control" placeholder="Youur username" required>
</div>
<div class="form-group col-md-6">
<input type="" class="form-control" name="fathername" id="fathername" placeholder="Your Website" required>
</div>
</div>
<div class="form-group">
<input type="text" class="form-control" name="mothername" id="mothername" placeholder="Add a Tag line" required>
</div>
<div class="form-group">
<input type="file" class="form-control" name="imagefield" id="imagefield" placeholder="Your image" accept="image/*" required>
</div>
<div class="text-center"><button type="submit">Send Message</button></div>
</form>





<form action="% url 'home' %" method="POST" role="form" enctype="multipart/form-data class="contactForm">
% csrf_token %

<div class="form-row">
<div class="form-group col-md-6">
<input type="text" name="yourname" id="yourname" class="form-control" placeholder="Youur username" required>
</div>
<div class="form-group col-md-6">
<input type="" class="form-control" name="fathername" id="fathername" placeholder="Your Website" required>
</div>
</div>
<div class="form-group">
<input type="text" class="form-control" name="mothername" id="mothername" placeholder="Add a Tag line" required>
</div>
<div class="form-group">
<input type="file" class="form-control" name="imagefield" id="imagefield" placeholder="Your image" accept="image/*" required>
</div>
<div class="text-center"><button type="submit">Send Message</button></div>
</form>





<form>
<script src="https://api.ravepay.co/flwv3-pug/getpaidx/api/flwpbf-inline.js"></script>
<button type="button" onClick="payWithRave()">Pay Now</button>
</form>

<script>
const API_publicKey = "FLWPUBK-152e7e9e17c0f7e985f9fee5838eafcc-X";

function payWithRave()
var x = getpaidSetup(
PBFPubKey: API_publicKey,
customer_email: "user@example.com",
amount:5,
customer_phone: "234099940409",
currency: "USD",
txref: "rave-123456",
meta: [
metaname: "flightID",
metavalue: "AP1234"
],
onclose: function() ,
callback: function(response)
);

</script>





<form>
<script src="https://api.ravepay.co/flwv3-pug/getpaidx/api/flwpbf-inline.js"></script>
<button type="button" onClick="payWithRave()">Pay Now</button>
</form>

<script>
const API_publicKey = "FLWPUBK-152e7e9e17c0f7e985f9fee5838eafcc-X";

function payWithRave()
var x = getpaidSetup(
PBFPubKey: API_publicKey,
customer_email: "user@example.com",
amount:5,
customer_phone: "234099940409",
currency: "USD",
txref: "rave-123456",
meta: [
metaname: "flightID",
metavalue: "AP1234"
],
onclose: function() ,
callback: function(response)
);

</script>






django django-models django-forms payment-gateway form-submit






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 22 at 11:25







ray

















asked Mar 21 at 19:05









rayray

12




12












  • You need to use Django forms or model forms and get data from cleaned_data

    – Rarblack
    Mar 21 at 20:32











  • @Rarblack Thanks for answering... I am now able to submit the data into database But i need a way to integrate the payment in such a way that whenever a user wants to submit those information the payment option provided up here will be triggered also the data in the form is submitted only after successful payment. Thankk

    – ray
    Mar 22 at 10:42

















  • You need to use Django forms or model forms and get data from cleaned_data

    – Rarblack
    Mar 21 at 20:32











  • @Rarblack Thanks for answering... I am now able to submit the data into database But i need a way to integrate the payment in such a way that whenever a user wants to submit those information the payment option provided up here will be triggered also the data in the form is submitted only after successful payment. Thankk

    – ray
    Mar 22 at 10:42
















You need to use Django forms or model forms and get data from cleaned_data

– Rarblack
Mar 21 at 20:32





You need to use Django forms or model forms and get data from cleaned_data

– Rarblack
Mar 21 at 20:32













@Rarblack Thanks for answering... I am now able to submit the data into database But i need a way to integrate the payment in such a way that whenever a user wants to submit those information the payment option provided up here will be triggered also the data in the form is submitted only after successful payment. Thankk

– ray
Mar 22 at 10:42





@Rarblack Thanks for answering... I am now able to submit the data into database But i need a way to integrate the payment in such a way that whenever a user wants to submit those information the payment option provided up here will be triggered also the data in the form is submitted only after successful payment. Thankk

– ray
Mar 22 at 10:42












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55287609%2fpythondjango-i-want-the-payment-formcode-triggered-whenever-a-user-clicks-t%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid …


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55287609%2fpythondjango-i-want-the-payment-formcode-triggered-whenever-a-user-clicks-t%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?