Skip to content
This repository has been archived by the owner on May 13, 2021. It is now read-only.

SqPaymentForm results in error without locationId #4

Open
PeterTakahashi opened this issue Oct 28, 2019 · 7 comments
Open

SqPaymentForm results in error without locationId #4

PeterTakahashi opened this issue Oct 28, 2019 · 7 comments

Comments

@PeterTakahashi
Copy link

<script type="text/javascript">
 // Create and initialize a payment form object
 const paymentForm = new SqPaymentForm({
   // Initialize the payment form elements

   //TODO: Replace with your sandbox application ID
   applicationId: "xxxxxxxxxx",
   locationId: "xxxxxxxxxxx",
   inputClass: 'sq-input',
   autoBuild: false,
   // Customize the CSS for SqPaymentForm iframe elements
   inputStyles: [{
       fontSize: '16px',
       lineHeight: '24px',
       padding: '16px',
       placeholderColor: '#a0a0a0',
       backgroundColor: 'transparent',
   }],
   // Initialize the credit card placeholders
   cardNumber: {
       elementId: 'sq-card-number',
       placeholder: 'Card Number'
   },
   cvv: {
       elementId: 'sq-cvv',
       placeholder: 'CVV'
   },
   expirationDate: {
       elementId: 'sq-expiration-date',
       placeholder: 'MM/YY'
   },
   postalCode: {
       elementId: 'sq-postal-code',
       placeholder: 'Postal'
   },
   // SqPaymentForm callback functions
   callbacks: {
       /*
       * 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 browser developer console.
           console.error('Encountered errors:');
           errors.forEach(function (error) {
               console.error('  ' + error.message);
           });
           alert('Encountered errors, check browser developer console for more details');
           return;
       }
          alert(`The generated nonce is:\n${nonce}`);
          //TODO: Replace alert with code in step 2.1
       }
   }
 });

 paymentForm.build();

 function onGetCardNonce(event) {
 // Don't submit the form until SqPaymentForm returns with a nonce
   event.preventDefault();
   // Request a nonce from the SqPaymentForm object
   paymentForm.requestCardNonce();
 }
 //TODO: paste code from step 1.2.4
</script>
@PeterTakahashi
Copy link
Author

Change the document to add locationId to SqPaymentForm

@bwisem
Copy link

bwisem commented Dec 12, 2019

Hi!

Thanks for reaching out.

With the SqPaymentForm the locationId isn't required to render the form or process a payment. We definitely recommend passing a location to the payment for better tracking but it's not currently required. The locationId is however required when using digital wallets.

We’re constantly working to improve our features based on feedback like this, so I’ll be sure to share your request to the API product team.

Thanks

@PeterTakahashi
Copy link
Author

Hi
response Thanks

@BilalKhan1998
Copy link

Hi! What is Process-Payment in the code?

@StephenJosey
Copy link

Hi @BilalKhan1998 can you clarify what you mean? process-payment is the route where you actually create the payment in Square's APIs: https://github.com/square/sqpaymentform-nodejs-starterkit/blob/master/server.js#L35.

@BilalKhan1998
Copy link

Hi @BilalKhan1998 can you clarify what you mean? process-payment is the route where you actually create the payment in Square's APIs: https://github.com/square/sqpaymentform-nodejs-starterkit/blob/master/server.js#L35.

I am creating Application in Webform Asp.net not in Mvc , But i am stuck where it use Fetch api, In word Fetch it wrotes Process-Payments, What was that ?i didn't see any code of Process-Payment, IF THAT WAS a page where is that? what we have to code there?
can you please explain

@BilalKhan1998
Copy link

Hi @BilalKhan1998 can you clarify what you mean? process-payment is the route where you actually create the payment in Square's APIs: https://github.com/square/sqpaymentform-nodejs-starterkit/blob/master/server.js#L35.

https://github.com/square/sqpaymentform-nodejs-starterkit/blob/master/server.js#L35
check this code please , i am taking help from this

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants