- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在开发 square up API。并使用 js 库来填充其表单。当我创建应用程序的构建并在 android 上运行它时,它工作正常并按预期填充表单。
但在 IOS 设备上,它不会填充表单字段。当我提醒它时,甚至该对象也会被创建
alert(JSON.stringify(paymentform));
在 IOS 和 Android 上以相同的方式填充。
我的代码是。
HTML
<script type="text/javascript" src="https://js.squareup.com/v2/paymentform"></script>
<script type="text/javascript" src="sqpaymentform.js"></script>
<div id="pay_now_cc_dialog" style="display: none;">
<b>Recipient</b>: Please fill out your credit card information below:<br><br>
<form id="nonce-form" novalidate method="post">
<div class="form-group">
<input type="text" style="height: 38px !important;" name="cc_number"
id="sq-card-number"/>
<small>Credit Card Number</small>
</div>
<div class="form-group">
<input type="text" style="height: 38px !important;" name="cc_expiration"
id="sq-expiration-date"/>
<small>Expiration Date</small>
</div>
<div class="form-group">
<input type="text" style="height: 38px !important;" name="cc_cvv" id="sq-cvv"/>
<small>CVV Code</small>
</div>
<div class="form-group">
<input type="text" style="height: 38px !important;" name="cc_zip"
id="sq-postal-code"/>
<small>ZIP Code</small>
</div>
<button id="sq-creditcard" class="button-credit-card" onclick="requestCardNonce(event)">
Charge Card
</button>
<!--
After a nonce is generated it will be assigned to this hidden input field.
-->
<input type="hidden" id="card-nonce" name="nonce">
</form>
</div>
JS Code
/*
* function: requestCardNonce
*
* requestCardNonce is triggered when the "Pay with credit card" button is
* clicked
*
* Modifying this function is not required, but can be customized if you
* wish to take additional action when the form button is clicked.
*/
function requestCardNonce(event) {
// Don't submit the form until SqPaymentForm returns with a nonce
event.preventDefault();
// Request a nonce from the SqPaymentForm object
paymentForm.requestCardNonce();
}
// Create and initialize a payment form object
var paymentForm = new SqPaymentForm({
// Initialize the payment form elements
applicationId: applicationId,
locationId: locationId,
inputClass: 'sq-input',
// Customize the CSS for SqPaymentForm iframe elements
inputStyles: [{
fontSize: '.9em'
}],
// Initialize the credit card placeholders
cardNumber: {
elementId: 'sq-card-number',
placeholder: '•••• •••• •••• ••••'
},
cvv: {
elementId: 'sq-cvv',
placeholder: 'CVV'
},
expirationDate: {
elementId: 'sq-expiration-date',
placeholder: 'MM/YY'
},
postalCode: {
elementId: 'sq-postal-code',
placeholder: '-----'
},
// SqPaymentForm callback functions
callbacks: {
/*
* callback function: methodsSupported
* Triggered when: the page is loaded.
*/
methodsSupported: function (methods) {
var applePayBtn = document.getElementById('sq-apple-pay');
var applePayLabel = document.getElementById('sq-apple-pay-label');
var masterpassBtn = document.getElementById('sq-masterpass');
var masterpassLabel = document.getElementById('sq-masterpass-label');
// Only show the button if Apple Pay for Web is enabled
// Otherwise, display the wallet not enabled message.
if (methods.applePay === true) {
applePayBtn.style.display = 'inline-block';
applePayLabel.style.display = 'none';
}
// Only show the button if Masterpass is enabled
// Otherwise, display the wallet not enabled message.
if (methods.masterpass === true) {
masterpassBtn.style.display = 'inline-block';
masterpassLabel.style.display = 'none';
}
},
/*
* callback function: createPaymentRequest
* Triggered when: a digital wallet payment button is clicked.
*/
createPaymentRequest: function () {
var paymentRequestJson;
/* ADD CODE TO SET/CREATE paymentRequestJson */
return paymentRequestJson;
},
/*
* callback function: cardNonceResponseReceived
* Triggered when: SqPaymentForm completes a card nonce request
*/
cardNonceResponseReceived: function (errors, nonce, cardData) {
if (errors) {
// Log errors from nonce generation to the Javascript console
console.log("Encountered errors:");
var message_string = "";
errors.forEach(function (error) {
message_string = message_string + error.message + ".<br>";
});
swal({
type: "error",
title: "Error Charging Card",
html: true,
text: message_string,
confirmButtonClass: "btn-danger",
});
return;
}
// Assign the nonce value to the hidden form field
console.log(nonce);
document.getElementById('card-nonce').value = nonce;
//alert(nonce);
// POST the nonce form to the payment processing page
// document.getElementById('nonce-form').submit();
test_cc();
},
/*
* callback function: unsupportedBrowserDetected
* Triggered when: the page loads and an unsupported browser is detected
*/
unsupportedBrowserDetected: function () {
/* PROVIDE FEEDBACK TO SITE VISITORS */
},
/*
* callback function: inputEventReceived
* Triggered when: visitors interact with SqPaymentForm iframe elements.
*/
inputEventReceived: function (inputEvent) {
switch (inputEvent.eventType) {
case 'focusClassAdded':
/* HANDLE AS DESIRED */
break;
case 'focusClassRemoved':
/* HANDLE AS DESIRED */
break;
case 'errorClassAdded':
/* HANDLE AS DESIRED */
break;
case 'errorClassRemoved':
/* HANDLE AS DESIRED */
break;
case 'cardBrandChanged':
/* HANDLE AS DESIRED */
break;
case 'postalCodeChanged':
/* HANDLE AS DESIRED */
break;
}
},
/*
* callback function: paymentFormLoaded
* Triggered when: SqPaymentForm is fully loaded
*/
paymentFormLoaded: function () {
console.log("Square loaded");
/* HANDLE AS DESIRED */
}
}
});
我认为它应该适用于 IOS 和 Android。但仅适用于 Android。
任何帮助将不胜感激。谢谢
最佳答案
在这里为其他人发布答案:
在你的config.xml文件中,你需要添加
<allow-navigation href="https://*squareup.com/*" />
基于 https://medium.com/collaborne-engineering/who-blocks-my-youtube-embed-cordova-phonegap-45a8ec04ff72
关于javascript - 在(Phonegap 应用程序)中构建不填充 IOS 设备上的字段的方形表单构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55516658/
我目前有一个程序,可以简单地在屏幕上绘制一个正方形,但是,我试图向这个正方形添加垂直线,它确实打印到屏幕上,但不是它定义的完整长度,而且不是广场内。任何帮助将不胜感激! #include int m
.products { width: 100%; height: 500px; background: gray; } .box { width: 250px; height: 3
I need the square-symbolized character have the square shape that fills entire the character's area,
我们应该知道,Clojure 的 map 可以应用于序列: (map #(* %1 %1) [1 2 3]) ; (1) ..或者多个,通过这种方式: (map vector [0
我正在尝试用 HTML/CSS 制作类似这样的东西:https://gyazo.com/6db0d2e3565414c10b65480c5d4b7526 我正在使用一个 Bootstrap 模板,我想
当我为我的 fab 设置颜色时,它看起来像这样: 我的布局 xml: 颜色也不会改变。谁能帮助我理解我做错了什么? 我也尝试过使用 @color 链接但它崩溃了,背景是可绘制的 (ex. andr
我有一个带有圆形图像的自定义按钮。 问题是 Controller 默认是方形的,所以每当我单击图像的角时,按钮都会响应调用关联的方法,而实际上他不应该这样做,因为角上没有图像,所以按钮不应响应。 有人
您好,我的页面顶部有一个 div http://www.uk-sf.com/MyTraining.php box-shadow 被切割在 wrapper 上,我试着给它一个 z-index 但没有任何
我有一个包含图像的 div。此图像仅在元素悬停时显示,因此我希望侧箭头从指向侧面的 div 出来(在元素悬停的方向)。 此代码生成正方形 div: CSS: #image-t
我在 Android 项目中使用 ImageView。 宽度:match_parent高度:wrap_content 然后我将它缩放到 fill_XY,但图像还不是正方形...我该怎么办? 最佳答案
我正在尝试使用 div 创建一个 2x2 网格。一些 div 可能包含图像,但它可能会被设置为背景,选项为 background-size: cover。 这是我创建的笔:http://codepen
* { box-sizing: border-box; } .publication { display: flex;
我有以下代码: 结果: 如何使 View 的高度与其宽度相等(由 layout_weight 产生)? 最佳答案 您必须重写 onMeasure 方法,将高度设置为与高度相
我正在开发照片编辑应用程序,我有 3 个带有 UIImageview 的 ScrollView ,我想将 ScrollView 设置如下 我试过“Scenekit”,但它不起作用,因为我想要 Scro
在不使用 SVG 图像的情况下,使用 React 可以在其中包含自定义文本来创建圆形和方形的方法是什么?一个例子: 我尝试了以下代码,但它没有呈现任何形状: import React from 're
我想要一个没有滚动条的响应式 9x9 div 网格。 div 网格应根据可见的浏览器窗口调整大小。我合并了"How to maintain the aspect ratio of a div usin
我第一次尝试使用Picasso 如官方网站示例: private void setItemBgImageUsingPicasso(View convertView) { String imag
尝试为 Android 使用 Dagger 依赖注入(inject)器。这是扩展的应用程序类: public class MyApplication extends Application {
我使用 Bootstrap 3 的 .thumbnail 类创建了一个图像网格。在调整图像大小和根据窗口大小更改列方面,一切似乎都很好。唯一的问题是图像的大小各不相同,并且纵向/横向都是。这会导致缩略
我正尝试通过 Square 在我的 iOS 应用程序中实现 OAuth2,但它说当我通过弹出的浏览器成功登录时,我的 redirect_uri 出现错误。 我正在使用 OAuthSwift pod。这
我是一名优秀的程序员,十分优秀!