【发布时间】:2020-01-10 00:30:33
【问题描述】:
我正在尝试为 SCA(我们位于英国)更新 Square 付款表单 JS 中的 cardNonceResponseReceived,并使用当前的连接版本并遵循 Square 提供的代码示例,但在控制台和表单无法按预期加载。我看不到我缺少什么 - 感谢任何帮助。
我已经检查了最新的 JS 示例的当前 connect-api php-payment,但无论调用沙箱或实时环境,问题仍然存在于我们的实时和 https://github.com/square/connect-api-examples/blob/master/connect-examples/v2/php_payment/js/sq-payment-form.js 示例中。该错误发生在食谱中所有 Square 的更新 cardNonceResponseReceived 示例的示例中。我提供 locationId 并已更新代码如下(形成提供的示例):
/*
* callback function: cardNonceResponseReceived
* Triggered when: SqPaymentForm completes a card nonce request
*/
cardNonceResponseReceived: function (errors, nonce, cardData) {
// Assign the nonce value to the hidden form field
document.getElementById('card-nonce').value = nonce;
const verificationDetails = {
amount: '100.00',
intent: "CHARGE", //Allowed values: "CHARGE", "STORE"
billingContact: {
familyName: "Smith",
givenName: "John",
email: "jsmith@example.com",
country: "GB",
city: "London",
postalCode: "SW7 4JA",
phone: "020 7946 0532"
}
};
try {
paymentform.verifyBuyer(
nonce,
verificationDetails,
callback(err,verification) {
if (err == null) {
document.getElementById('buyerVerification-token').value = verification;
}
});
// POST the nonce form to the payment processing page
document.getElementById('nonce-form').submit();
} catch (typeError) {
//TypeError thrown if illegal arguments are passed
}
}
控制台报告SyntaxError: Expected ')'(边缘)
SyntaxError: missing ) after argument list(火狐)上线
callback(err,verification) {
【问题讨论】:
标签: javascript square-connect square