Thread Options
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Hi,
I followed your tutorial on how to create the sqpayment form and was able to successfully charge a card using sandbox credentials.
My question is, is it okay to submit the form to the backend using ajax instead of
Here's the code from the sqpaymentform-basic.js, I am planning to replace this code document.getElementById('nonce-form').submit(); to a ajax POST request to our backend. My reason is that I do not want the user to go to another page, instead stay on the same page and render the successful/failure charge there.
cardNonceResponseReceived: function (errors, nonce, cardData) { if (errors) { // Log errors from nonce generation to the Javascript console console.log("Encountered errors:"); errors.forEach(function (error) { console.log(' ' + error.message); alert(error.message); }); return; } // Assign the nonce value to the hidden form field document.getElementById('card-nonce').value = nonce; // POST the nonce form to the payment processing page document.getElementById('nonce-form').submit(); }
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
0 REPLIES 0