我正在将Authorize.NET与我的Web应用程序集成。我正在使用托管付款表格,如下所述:
我想使用设置页面中所述的默认付款方式:https://sandbox.authorize.net/UI/themes/sandbox/Settings/SettingsPayFormMain.aspx我想通过传递相关字段来自定义此付款方式。
我正在使用以下JSON对象:
{
"getHostedPaymentPageRequest": {
"merchantAuthentication": {
"name": "api_key",
"transactionKey": "transaction_key"
},
"transactionRequest": {
"transactionType": "authCaptureTransaction",
"amount": "20.00",
"profile": {
"customerProfileId": "123456789"
},
"customer": {
"email": "[email protected]"
},
"billTo": {
"firstName": "Ellen",
"lastName": "Johnson",
"company": "Souveniropolis",
"address": "14 Main Street",
"city": "Pecan Springs",
"state": "TX",
"zip": "44628",
"country": "USA"
}
},
"hostedPaymentSettings": {
"setting": [{
"settingName": "hostedPaymentReturnOptions",
"settingValue": "{\"showReceipt\": true, \"url\": \"https://example.com/receipt\", \"urlText\": \"Continue\", \"cancelUrl\": \"https://example.com/cancel\", \"cancelUrlText\": \"Cancel\"}"
}, {
"settingName": "hostedPaymentShippingAddressOptions",
"settingValue": "{\"show\": false, \"required\": false}"
}, {
"settingName": "hostedPaymentBillingAddressOptions",
"settingValue": "{\"show\": true, \"required\": false}"
}, {
"settingName": "hostedPaymentCustomerOptions",
"settingValue": "{\"showEmail\": false, \"requiredEmail\": false, \"addPaymentProfile\": true}"
}, {
"settingName": "hostedPaymentOrderOptions",
"settingValue": "{\"show\": true, \"merchantName\": \"G and S Questions Inc.\"}"
}, {
"settingName": "hostedPaymentIFrameCommunicatorUrl",
"settingValue": "{\"url\": \"https://example.com/special\"}"
}]
}
}
}
我将收到以下看起来不专业的付款表格。任何想法如何使用Authorize.NET的默认付款方式
使用的HTML表单:
<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<head>
</head>
<body>
<form method="post" action="https://test.authorize.net/payment/payment" id="formAuthorizeNetTestPage" name="formAuthorizeNetTestPage">
<input type="hidden" name="token" value="Replace with form token from getHostedPaymentPageResponse" />
Continue to Authorize.Net to Payment Page
<button id="btnContinue">Continue to next page</button>
</form>
</body>
</html>
Authorize.Net accept.js托管表单无法按照您希望的方式进行自定义。那是设计使然。它适用于不具备技术知识的企业/开发人员,即使他们执行结帐页面的方法也比较复杂(即使只有很少的技巧)。
自托管的accept.js表单可以自定义完全,并且仍将我们的站点保留在PCI范围之外,因为信用卡数据永远不会通过您的服务器。
总而言之,Authorize.Net托管的表单无法按照您想要的方式进行自定义。 但是这不是必需的,因为您可以完成同一件事,并通过使用该表单的自托管版本来将其排除在PCI范围之外。
这是我用来获取托管付款表格的代码,该表格显示了您希望的方式。如果没有看到与我相同的页面,请在表单操作中确认您具有正确的URL。以下是沙盒网址。生产URL为https://accept.authorize.net/payment/payment
。
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hosted Accept.js Payment Form</title>
</head>
<body>
<form id="paymentForm" method="POST" action="https://test.authorize.net/payment/payment">
<input type="hidden" name="token" id="token" value="YOUR_TOKEN_HERE" />
<button onclick="sendPaymentDataToAnet()">Go to Authorize.Net hosted payment form</button>
</form>
</body>
</html>