GithubHelp home page GithubHelp logo

tristansokol / vue-square Goto Github PK

View Code? Open in Web Editor NEW
24.0 3.0 8.0 39 KB

An example of using Vue.js with the Square payment form

JavaScript 38.73% HTML 0.71% Vue 60.56%
vue vuejs square payments ecommerce

vue-square's Introduction

vue-square

A example of using the Square Payment Form with Vue.js. Please read the full description in this blog post.

To try it out, first clone the repo and then run npm run dev to start up the development server.

This example was made with the vue-cli, so most of the boilerplate is from the default 'webpack' project.

Other things you might be interested in:

Other Commands

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report

vue-square's People

Contributors

jacobus avatar kaangokdemir avatar tristansokol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vue-square's Issues

After using Audit fix, site no longer works

I ran

npm audit fix

When I try to run it, I get

Vue warn]: Error in v-on handler: "TypeError: Cannot read property 'requestCardNonce' of undefined"

found in

---> <PaymentForm> at src/components/paymentForm.vue
       <Product> at src/components/product.vue
         <Store> at src/components/store.vue
           <App> at src/App.vue
             <Root>
warn @ vue.esm.js?efeb:628
logError @ vue.esm.js?efeb:1893
globalHandleError @ vue.esm.js?efeb:1888
handleError @ vue.esm.js?efeb:1848
invokeWithErrorHandling @ vue.esm.js?efeb:1871
invoker @ vue.esm.js?efeb:2188
original._wrapper @ vue.esm.js?efeb:7565
vue.esm.js?efeb:1897 TypeError: Cannot read property 'requestCardNonce' of undefined
    at VueComponent.requestCardNonce (paymentForm.vue?edb5:166)
    at click (eval at ./node_modules/vue-loader/lib/template-compiler/index.js?{"id":"data-v-1a27c10a","hasScoped":false,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/components/paymentForm.vue (app.js:954), <anonymous>:140:24)
    at invokeWithErrorHandling (vue.esm.js?efeb:1863)
    at HTMLButtonElement.invoker (vue.esm.js?efeb:2188)
    at HTMLButtonElement.original._wrapper (vue.esm.js?efeb:7565)

Screen Shot 2020-04-19 at 9 38 13 PM

Gridsome

Would you do another tutorial with gridsome? I'm having trouble integrating square with it

Remove async from payment form script tag

The script tag in index.html for the paymentform library is like this:

<script async type="text/javascript" src="https://js.squareup.com/v2/paymentform"></script>

However, this causes an SqPaymentForm is not defined error when loading the form, because paymentform is not loaded when it's called within the mounted hook. Removingh the asyanc from the tag like so

<script type="text/javascript" src="https://js.squareup.com/v2/paymentform"></script>

fixes the problem (this was pointed out to me by a Square engineer).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.