gpt4 book ai didi

php - 将 Paypal 按钮与自定义表单集成,并在单击该按钮后将客户信息保存到数据库中

转载 作者:行者123 更新时间:2023-11-29 00:36:39 26 4
gpt4 key购买 nike

我创建了一个包含多个字段的订单(代码在下面提到)。现在我要做的是将 paypal 的立即购买按钮与此表单集成!由于我是这里的新手,我不确定如何完成同样的事情!如您所见,该表单有一个常规的“提交”按钮,需要将其替换为 paypal 的立即购买。

我想弄清楚的另一件重要事情是如何在完成付款后通过单击“立即购买”按钮将客户输入的数据保存到数据库中。任何帮助将不胜感激。

我的自定义表单:

<!-- FORM DIV STARTS HERE -->
<div id="order-form">
<form name="orderform" id="orderform" action="" method="">

<!-- PERSONAL INFORMATION BLOCK-->

<legend class="form-header">Personal Information</legend>
<fieldset class="order-form-line">
<span class="req">Name:*</span> <input type="text" name="customername" id="customername" class="required letterswithbasicpunc" style="margin-left:78px;"/><br />
<div class="help">Enter your full name such as "John Smith"</div>
<span class="req">Email:*</span> <input type="text" name="customeremail" class="required email" style="margin-left:82px;" /><br />
<div class="help">Enter a valid email such as "johnsmith@gmail.com"</div>
Website: <input type="text" name="customersite" class="url" style="margin-left:72px;" />
<div class="help">Enter url like "http://www.yoursitename.com"</div>
</fieldset>

<!-- ORDER INFORMATION BLOCK-->

<legend class="form-header">Order Description</legend>
<fieldset class="order-form-line">
<div class="formbuttons">
<span class="req new">Content Type:*</span>
<input type="checkbox" name="webcontent" class="required" /> Article
<input type="checkbox" name="webcontent" /> Review
</div>
<div class="formbuttons2">
<span class="req new">Content Tone:*</span>
<input type="checkbox" name="contenttone" class="required" /> Professional
<input type="checkbox" name="contenttone" /> Friendly
</div>
Keyword(s): <input type="text" name="keys" class="" style="margin-left:51px;" /><br />
<div class="help">You can enter keywords in a comma-separated format</div>
Description: <div class="areatxt"><textarea rows="5" cols="31">Your description goes here</textarea></div>
<div class="help">Describe if you have any other requirements</div>
Audience: <input type="text" name="audience" class="" style="margin-left:66px;" />
<div class="help">You can provide info on your target audience</div>
</fieldset>

<!-- PAYMENT DETAILS BLOCK -->

<legend class="form-header">Payment Details</legend>
<fieldset class="order-form-line modified">
<span class="req">No. of Words:*</span> <input type="text" name="wordsno" id="wordsno" class="required digits" value="0" style="margin-left:31px; text-align:center;" /> <br />
<div class="help">Enter (only digits) your per word requirement such as "500" for five-hundred word articles</div>
<span class="req">Quantity:*</span> <input type="text" name="wordsqty" id="wordsqty" class="required digits" value="0" style="margin-left:60px;text-align:center;" /> <br />
<div class="help">Enter (only digits) the total number of articles you need such as "10" for ten articles</div>
Unit Price: <input type="text" name="wordsunitprice" value="$0.02" disabled="disabled" style="margin-left:64px;text-align:center;" /><br />
<div class="help">This is the "per word" cost</div>
Total Cost: <input type="text" name="wordstotalcost" id="wordstotalcost" value="$0.00" disabled="disabled" style="margin-left:59px;text-align:center;" /><br />
<div class="help">This reflects the total amount you would have to pay. It multiplies the 'unit price' with the result we get multiplying 'no. of words' and 'quantity'</div>
<input type="submit" value="Submit" />



</fieldset>
</form>
</div><!-- FORM DIV ENDS HERE -->

所以我的确切问题是:-

(1) 如何用 paypal buy now 替换自定义表单的常规 html 提交按钮?注意:“客户支付的金额”将动态传递给 paypal 的立即购买。

(2) 如果他想将整个客户信息保存到数据库中,他会怎么做?这应该在收到 paypal 端的付款确认后发生!

最佳答案

如果你想让事情尽可能简单,我会选择 PayPal Payments Standard .您可以在您的 PayPal 帐户中的“商家服务”选项卡下创建“立即购买”按钮代码,也可以使用 Cart Upload方法并自己构建它,这是我推荐的方法。

基本上,您只需创建一个包含一系列隐藏字段的新表单来表示您将发送到 PayPal 的数据,然后您可以使用您想要的任何类型的提交按钮。 PayPal 提供了一个 list of all the standard variables you could use with this .

要将订单数据导入您自己的数据库(或发送自定义电子邮件收据、与第 3 方网络服务交互等),我建议使用 Instant Payment Notification (IPN) .该系统将所有交易数据发布到您位于服务器上的监听器脚本。您可以随心所欲地处理这些数据,而且这一切都是实时发生的。

关于php - 将 Paypal 按钮与自定义表单集成,并在单击该按钮后将客户信息保存到数据库中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13974899/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com