如何将自定义字段添加到Stripe Checkout表单,如名字,姓氏,甚至可能是带有自定义按钮的复选框?到目前为止,我已经想出了这个;
<script src="https://checkout.stripe.com/checkout.js"></script>
<form action="/charge" method="POST">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_i2txBI2jUjSQIMoqFz3Fo326"
data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
data-name="Matt's Widgets and Gizmos"
data-description="2 widgets ($20.00)"
data-amount="2000"
data-billingAddress="true"
data-shippingAddress="true">
</script>
</form>
Run Code Online (Sandbox Code Playgroud)
我发现Stripe Checkout只能包含以下自定义值;
stripeBillingName:
stripeBillingAddressLine1:
stripeBillingAddressApt:
stripeBillingAddressZip:
stripeBillingAddressCity:
stripeBillingAddressState:
stripeBillingAddressCountry:
stripeBillingAddressCountryCode:
Run Code Online (Sandbox Code Playgroud)
有没有办法解决?请让我知道谢谢
在PHP中,我使用一个if语句来识别用户是否登录,并根据结果显示主菜单(如果已登录)或"你需要登录"消息,如果没有.我是这样做的:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" href="style.css" type="text/css" />
<title>Home</title>
</head>
<body>
<div id="header">
<a href="index.php"><img src="wtcdblogo.png" alt="WTC DB logo" /></a>
</div>
<?php
if($_SESSION['loggedIn'] == 1) {
echo "<div id='main'>MAIN MENU stuff goes here</div>";
} else {
echo "<div id='main'>Please login...</div>";
}
?>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
如您所见,显示主菜单或"请登录"消息的代码由a生成echo.这是不好的做法,也许有更好的方法?
顺便说一下,我从echo上面的代码片段中删除了大部分HTML .主菜单由一个列表组成,但我没有打扰,因为它与问题无关,我想.