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

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript