一个网页中有多个SqPaymentForms

时间:2016-05-25 11:36:11

标签: square-connect

我正在使用Square信用卡处理,我必须在同一网页中使用两个付款表单,一个用于取件付款,另一个用于付款。 我试图将SqPaymentForm集成到我的网页中,我成功进行了取件付款。当涉及到交付可能是表格加载两次,我必须在表格中输入我的所有卡详细信息两次。我怎么能解决这个问题?

 var paymentFormUserPickUp = new SqPaymentForm({
                        applicationId: ApplicationId,
                        inputClass: 'sq-input',
                        cardNumber: {
                            elementId: 'sq-card-numberup',
                            placeholder: 'Card Number'
                        },
                        cvv: {
                            elementId: 'sq-cvvup',
                            placeholder: 'CVV'
                        },
                        expirationDate: {
                            elementId: 'sq-expiration-dateup',
                            placeholder: 'MM/YY'
                        },
                        postalCode: {
                            elementId: 'sq-postal-codeup',
                            placeholder: 'Zip Code'
                        },
                        callbacks: {
                            cardNonceResponseReceived: function (errors, nonce, cardData) {
                                if (errors) {
                                    // handle errors
                                    var Errors;
                                    errors.forEach(function (error) {
                                        Errors += error.message + ",";
                                    });
                                    Errors.trimEnd(',');
                                    alert(Errors);
                                } else {
                                    alert(nonce);
                                    localStorage.setItem("Nonce", nonce);
                                }
                            },
                            unsupportedBrowserDetected: function () {
                                // Alert the buyer that their browser is not supported
                            }
                        }
                    });


var paymentFormUserDelivery = new SqPaymentForm({
                        applicationId: ApplicationId,
                        inputClass: 'sq-input',
                        cardNumber: {
                            elementId: 'sq-card-numberud',
                            placeholder: 'Card Number'
                        },
                        cvv: {
                            elementId: 'sq-cvvud',
                            placeholder: 'CVV'
                        },
                        expirationDate: {
                            elementId: 'sq-expiration-dateud',
                            placeholder: 'MM/YY'
                        },
                        postalCode: {
                            elementId: 'sq-postal-codeud',
                            placeholder: 'Zip Code'
                        },
                        callbacks: {
                            cardNonceResponseReceived: function (errors, nonce, cardData) {
                                if (errors) {
                                    // handle errors
                                    var Errors;
                                    errors.forEach(function (error) {
                                        Errors += error.message + ",";
                                    });
                                    Errors.trimEnd(',');
                                    alert(Errors);
                                } else {
                                    alert(nonce);
                                    localStorage.setItem("Nonce", nonce);
                                }
                            },
                            unsupportedBrowserDetected: function () {
                                // Alert the buyer that their browser is not supported
                            }
                        }
                    });

感谢!!!

1 个答案:

答案 0 :(得分:0)

单卡输入不支持多种形式。为什么订单需要付款和付款?你有样本页吗?