Coder Social home page Coder Social logo

vue-stripe-elements's Introduction

⚠️ Deprecated ⚠️

This package is no longer maintained. Vue 2 reached its end-of-life on December 31st, 2023.

Vue Stripe Elements

Quickstart

1. Install package:

# npm
npm i vue-stripe-elements-plus --save-dev

# yarn
yarn add vue-stripe-elements-plus --dev

2. Add Stripe.js library to the page:

<script src="https://js.stripe.com/v3/"></script>

Alternatively, you can load Stripe library dynamically. Just make sure it's ready before your components mount.

3. Use built-in components

Create card

<template>
  <div class="payment-simple">
    <StripeElements
      :stripe-key="stripeKey"
      :instance-options="instanceOptions"
      :elements-options="elementsOptions"
      #default="{ elements }" // attention: important part!
      ref="elms"
    >
      <StripeElement
        type="card"
        :elements="elements"
        :options="cardOptions"
        ref="card"
      />
    </StripeElements>
    <button @click="pay" type="button">Pay</button>
  </div>
</template>

<script>
import { StripeElements, StripeElement } from 'vue-stripe-elements-plus'

export default {
  name: 'PaymentSimple',

  components: {
    StripeElements,
    StripeElement
  },

  data () {
    return {
      stripeKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', // test key, don't hardcode
      instanceOptions: {
        // https://stripe.com/docs/js/initializing#init_stripe_js-options
      },
      elementsOptions: {
        // https://stripe.com/docs/js/elements_object/create#stripe_elements-options
      },
      cardOptions: {
        // reactive
        // remember about Vue 2 reactivity limitations when dealing with options
        value: {
          postalCode: ''
        }
        // https://stripe.com/docs/stripe.js#element-options
      }
    }
  },

  methods: {
    pay () {
      // ref in template
      const groupComponent = this.$refs.elms
      const cardComponent = this.$refs.card
      // Get stripe element
      const cardElement = cardComponent.stripeElement

      // Access instance methods, e.g. createToken()
      groupComponent.instance.createToken(cardElement).then(result => {
        // Handle result.error or result.token
      })
    }
  }
}
</script>

4. Get advanced

Create multiple elements

<StripeElements
  :stripe-key="stripeKey"
  :instance-options="instanceOptions"
  :elements-options="elementsOptions"
  #default="{ elements }" // attention: important part!
>
  <StripeElement
    type="cardNumber"
    :elements="elements"
    :options="cardNumberOptions"
  />
  <StripeElement
    type="postalCode"
    :elements="elements"
    :options="postalCodeOptions"
  />
</StripeElements>

5. Go wild

You can even create multiple groups, don't ask me why. It's possible.

<StripeElements
  :stripe-key="stripeKey1"
  :instance-options="instanceOptions1"
  :elements-options="elementsOptions1"
  #default="{ elements }" // attention: important part!
>
  <StripeElement
    :elements="elements"
    :options="cardOptions"
  />
</StripeElements>
<StripeElements
  :stripe-key="stripeKey2"
  :instance-options="instanceOptions2"
  :elements-options="elementsOptions2"
  #default="{ elements }" // attention: important part!
>
  <StripeElement
    type="iban"
    :elements="elements"
    :options="ibanOptions"
  />
</StripeElements>

Styles

No base style included. Main reason: overriding it isn't fun. Style as you wish via element options: see details.

API Reference

StripeElements.vue

Think of it as of individual group of elements. It creates stripe instance and elements object.

import { StripeElements } from 'vue-stripe-elements-plus'

props

// https://stripe.com/docs/js/initializing#init_stripe_js-options
stripeKey: {
  type: String,
  required: true,
},
// https://stripe.com/docs/js/elements_object/create#stripe_elements-options
instanceOptions: {
  type: Object,
  default: () => ({}),
},
// https://stripe.com/docs/stripe.js#element-options
elementsOptions: {
  type: Object,
  default: () => ({}),
},

data

You can access instance and elements by adding ref to StripeElements component.

// data of StripeElements.vue
instance: {},
elements: {},

default scoped slot

Elegant solution for props. Really handy because you can make instance and elements available to all children without adding extra code.

<!-- Isn't it cool? I really like it! -->
<StripeElements #default="{elements, instance}">
  <StripeElement :elements="elements" />
  <CustomComponent :instance="instance" />
</StripeElements>

StripeElement.vue

Universal and type agnostic component. Create any element supported by Stripe.

props

// elements object
// https://stripe.com/docs/js/elements_object/create
elements: {
  type: Object,
  required: true,
},
// type of the element
// https://stripe.com/docs/js/elements_object/create_element?type=card
type: {
  type: String,
  default: () => 'card',
},
// element options
// https://stripe.com/docs/js/elements_object/create_element?type=card#elements_create-options
options: {
  type: [Object, undefined],
},

data

stripeElement
domElement

options

Element options are reactive. Recommendation: don't use v-model on StripeElement, instead pass value via options.

data() {
  return {
    elementOptions: {
      value: {
        postalCode: ''
      }
    }
  }
},

methods: {
  changePostalCode() {
    // will update stripe element automatically
    this.elementOptions.value.postalCode = '12345'
  }
}

events

Following events are emitted on StripeElement

  • change
  • ready
  • focus
  • blur
  • escape
<StripeElement
  :elements="elements"
  @blur="doSomething"
/>

Helpers

In case you like the manual gearbox. Check stripeElements.js for details.

import { initStripe, createElements, createElement } from 'vue-stripe-elements-plus'

vue-stripe-elements's People

Contributors

connor11528 avatar jorngeorg avatar mauricioklein avatar mikerogerz avatar nkoehring avatar normansander avatar paulpdaniels avatar samtsai avatar softbeehive avatar stevehayles avatar tsjason 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue-stripe-elements's Issues

Unable to use focus method PostalCode component

Hi,

I think you've missed add ref="element" in the PostalCode.vue file, which is causing an error on undefined stripe-element when you try to use focus() method on PostalCode component.

Cheers,
Kamil

PostalCode does not use the correct events

The PostalCode component has a bunch of events defined on it but none of them match up with what is being fired from the underlying StripeElement.

Most notably the "change" event is missing (instead there is complete but there doesn't appear to be any logic to actually emit that).

Also could you export the StripeElement as part of the lib build? It isn't part of the exports it is isn't even possible to create a custom StripeElement to work around the buggy PostalCode.

iOS Safari keyboard stays open

This is a follow-up of #38, I have the exact same issue where the keyboard stays open or reopen itself every time the screen is touched after the form is submitted.

There are useful information about this bug in stripe-archive/react-stripe-elements#174 but not enough for me to successfully work around it or provide a fix in the context of vue-stripe-elements. I asked more information there but in the meantime I thought an open issue to track this problem was the way to go.

Please make sure the Element you are attempting to use is still mounted

Hi,

Thanks so much for building this component. I'm using it in a project and it works fine on the first try. However, if do a vm.$router.push('/home') and then revisit the route that contains this component (e.g., <router-link to="/pay">), subsequent form submissions return this error.

IntegrationError
We could not retrieve data from the specified Element. Please make sure the Element you are attempting to use is still mounted.
{ "name": "IntegrationError" }

It appears that it's coming from the Stripe library, but I thought it might have something to do with the way you're mounting the Card element. I'm new to VueJS, so I'm not sure of the correct way to do things and thought it might be related to your post on Stack Overflow

I forked your repo and tried the first (and currently only) answer there, but received other errors.

I'd greatly appreciate any suggestions on how to prevent this issue.

Thanks!

Project lacks unit tests

Any good project comes with a set of tests that ensure all is well.

It would be great to have them with this project, would suggest Jest

Nuxt.js, <script> loaded, but throws "Cannot read property 'elements' of undefined"

The example from README doesn't work if you put it to a not the index page of a Nuxt.js project.

  • Create nuxt.js project
  • Add the README example to a not the index page
  • Navigate from index the that new page. -> console is full of errors.
TypeError: Cannot read property 'elements' of undefined
    at n (index.js:60)
    at r (index.js:65)
    at VueComponent.beforeMount (index.js:129)
    at callHook (vue.runtime.esm.js:2891)
    at mountComponent (vue.runtime.esm.js:2738)
    at VueComponent.webpackJsonp../node_modules/vue/dist/vue.runtime.esm.js.Vue$3.$mount (vue.runtime.esm.js:7891)
    at init (vue.runtime.esm.js:4061)
    at hydrate (vue.runtime.esm.js:5892)
    at VueComponent.patch [as __patch__] (vue.runtime.esm.js:6007)
    at VueComponent.Vue._update (vue.runtime.esm.js:2633)

I debugged it down to the init() function in src/stripeElements.js. If I put in it

console.log(window.Stripe)

then it prints the stripe factory. So, I'm 100% Stripe was loaded by that time. And I can see it in the <head>.

I cannot figure out how to fix initialization to make it work.

Any workarounds are welcome too.

Please, help.

Does configuration for fonts exists?

Apparently, this does not seem to do anything:

<template>
  <card
    class="StripeCard"
    :stripe="publicKey"
    :options="options"
    @change="checkForErrors"
    :fonts="[{
      cssSrc: 'https://fonts.googleapis.com/css?family=Roboto+Condensed:700'
    }]"
  />
</template>

<script>
  import { Card } from 'vue-stripe-elements-plus'

  export default {
    components: {
      Card
    },

    data () {
      return {
        publicKey: '',
        options: {
          style: {
            base: {
              color: '#9AA7C0',
              fontSmoothing: 'antialiased',
              fontSize: '16px',
              fontWeight: 700,
              fontFamily: 'Roboto Condensed'
            }
          },
          hidePostalCode: true
        }
      }
    },

    methods: {
      checkForErrors (event) {
        this.errors.remove('card')

        if (!event.error) {
          return
        }

        this.errors.add({
          field: 'card',
          msg: event.error.message
        })
      }
    }
  }
</script>

And if I try to add fonts in the options object... This comes up in console:

Error in beforeMount hook: "IntegrationError: Invalid value for create(): fonts should be used in elements() instead. You specified: [object Object]."

Is this currently unsupported or I'm doing something wrong?

`createToken` error with multiple elements example

Hi!

I'm having issues creating a token when implementing multiple elements. Rendering and validation are fine, but when I trigger the request it reports that I have an invalid number. It seems like the request is not sending the full set of details.

Request:
card[cvc]:123
...

Response:

{
  "error": {
    "message": "The card object must have a value for 'number'.",
    "type": "card_error",
    "param": "number",
    "code": "invalid_number"
  }
}

I've been comparing the request sent in Stripe's example here: https://jsfiddle.net/ywain/o2n3js2r/
and their request correctly passes the other values: card[number], card[exp_month], card[exp_year].

Loaded event

Any chances you can add 'loaded' event to the elements? Right now I can see a blink between the time the component shows up and gets its placeholders filled in.

How show card icon with single element

Hello,

When I use ,I can see the Icon of the CardNumber (visa, master card,...)
But if I use each element , there is no Icon of the CardNumber for the card-number element.

Is it possible to show it ?

Fabien

Card Number placeholder

Hello,

Is there support for cardNumber, cardExpiry, cardCvc? I want to customize placeholder text.

Thanks in advance!

iframe buildup

similar to stripe-archive/react-stripe-elements#99 the vue implementation allows iframes to build up.

in a SPA, using these components keeps injecting iframes to the dom. Is there a way to destroy them?

I'm using this for now in the wrapping component

  destroyed() {
    document.querySelectorAll('iframe').forEach(iframe => {
      if (iframe.getAttribute('src').includes('stripe')) {
        iframe.parentNode.removeChild(iframe);
      }
    });
  },

Please clarify all variables.

Perhaps I'm simply missing something, but to what does the stripe string and the options object correspond?

Update:
Nevermind, it appears that stripe is the key and options correspond to "random" options in the docs. 🤔

stripeConfig.json

Hello,

I have hard time to figure out what include in stripeConfig.jsonand what is the correct structure.

Could you help me out ?

Thank you

Unable to create token if component is unmounted and then mounted again

My component is shown within a modal overlay (which is shown or not based on other page actions), and when opening the modal after the first time, the token can't be created since the element is undefined (the card entry field is displayed correctly, which means Stripe is loaded correctly). Just to be clear, the token is correctly generated on the first display of the component.

Once thing I already tried was dynamically loading the component when the modal is displayed, but that resulted in the same behaviour. I thought that might help to remount the Stripe element and reset everything.

Update:
Reference pull request: #3

Load in Stripe V3 js for components

Thanks for developing these components for Vue.

I have a rather large and complex application. I much prefer to lazy load in the components. Having anything in index.html is out of scope for me.

Would it be possible to have the Stripe JS load in and be available to the components?

Or perhaps there is a better way of doing this?

<template>
	<div>
		<div class='credit-card-inputs'>
			<async-component1></async-component1>
			<card-number 
				class='stripe-element card-number'
				ref='cardNumber'
				:stripe='stripe'
				:options='options'
			/>
			<card-expiry class='stripe-element card-expiry'
				ref='cardExpiry'
				:stripe='stripe'
				:options='options'
			/>
			<card-cvc class='stripe-element card-cvc'
				ref='cardCvc'
				:stripe='stripe'
				:options='options'
		    />
		</div>
	</div>
</template>

<script>
	const AsyncComponent1 = () => ({
		component: new Promise((resolve, reject) => {
			let script = document.createElement('script')
			script.src = 'https://js.stripe.com/v3/'
			document.head.appendChild(script)
		})
	})

	const CardNumber = () => ({
		component: new Promise((resolve, reject) => {
			setTimeout(() => {
				resolve(require('../../../../../node_modules/vue-stripe-elements-plus/src/CardNumber.vue'))
			}, 1000)
		})
	})

	const CardExpiry = () => ({
		component: new Promise((resolve, reject) => {
			setTimeout(() => {
				resolve(require('../../../../../node_modules/vue-stripe-elements-plus/src/CardExpiry.vue'))
			}, 1000)
		})
	})

	const CardCvc = () => ({
		component: new Promise((resolve, reject) => {
			setTimeout(() => {
				resolve(require('../../../../../node_modules/vue-stripe-elements-plus/src/CardCvc.vue'))
			}, 1000)
		})
	})

	export default {
		name: 'CreditCardForm',
		props: [ 'stripe', 'options' ],
		data () {
			return {
				complete: false,
				number: false,
			}
		},
		components: {
			'async-component1': AsyncComponent1,
			'card-number': CardNumber,
			'card-expiry': CardExpiry,
			'card-cvc': CardCvc			
		},
		methods: {				
			
		},
		watch: {
			
		}
	}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>

createSource type three_d_secure

Hello,

there is an error : Uncaught (in promise) Error: Invalid value for type: value should be one of the following strings: card. You specified: three_d_secure.

in line 52 of stripeElements.js you do :
" Stripe.createSource = (options) => Stripe.instance.createSource(element, options) "
but there are 2 functions fore creating Sources :
stripe.createSource(element, sourceData) and stripe.createSource(sourceData)
doc : https://stripe.com/docs/stripe-js/reference#stripe-create-source

I corrected my code by accessing the instance to use the 2nd function

import { CardNumber, CardExpiry, CardCvc, createSource, instance } from 'vue-stripe-elements-plus'
create the card with first function: createSource(ownerInfo).then( ...
create three_d_secure with 2nd function: instance.createSource({ type: 'three_d_secure', ...

iOS Safari Keyboard stay open after payment redirect

Hi,

After payment and redirection with vue-route the keyboard with number remains open. Even when I click on "ok" to close it, it comes back.

Do I have to do something at the time of the destroy? When I leave my Buy.vue component?

I notice this only with Stripe Elements.

Add Shipping Address

Hi! just curious.. is there a way to add shipping address?

I've tried but the resulting object does not update.

<div class='credit-card-inputs' :class='{ complete }'>
        Enter Your Credit Card Details
        <input
          ref='stripeBillingAddressLine1'
          :stripe='stripe'
          :options='options'
          @change='number = $event.complete'
        />
        <card-number class='stripe-element card-number'
          ref='cardNumber'
          :stripe='stripe'
          :options='options'
          @change='number = $event.complete'
        />
        <card-expiry class='stripe-element card-expiry'
          ref='cardExpiry'
          :stripe='stripe'
          :options='options'
          @change='expiry = $event.complete'
        />
        <card-cvc class='stripe-element card-cvc'
          ref='cardCvc'
          :stripe='stripe'
          :options='options'
          @change='cvc = $event.complete'
        />

Error in mounted hook: "TypeError: Cannot read property 'mount' of undefined"

This error is currently occurring for [email protected] maybe a regression as I see it
reported and was fixed in the past.

vue.common.js:593 [Vue warn]: Error in mounted hook: "TypeError: Cannot read property 'mount' of undefined"

found in

---> <StripeElement> at /Users/fromatob/Projects/vue-stripe-elements/src/StripeElement.vue
       <CreditCard> at /Users/fromatob/Projects/vue-stripe-elements/src/Card.vue

CreateToken from multiple elements

Hello,

I'm trying to use your components (multiple elements) but the card isn't send to stripe when I call createToken()

Here is my template :

<div>
    <div class="row">
        <card-number class="stripe-element card-number"
          id="card-number"
          ref="cardNumber"
          :stripe="stripeKey"
          :options="elementOptions"
          @change="handleNumberChange"/>
    </div>

    <div class="row">
        <card-expiry class="stripe-element card-expiry"
          id="card-expiry"
          ref="cardExpiry"
          :stripe="stripeKey"
          :options="elementOptions"
          @change="handleExpiryChange"/>

        <card-cvc class="stripe-element card-cvc"
          id="card-cvc"
          ref="cardCvc"
          :stripe="stripeKey"
          :options="elementOptions"
          @change="handleCvcChange"/>
    </div>
    
    <submit-button
      @click.native="handleSubmitClick">
        Pay
    </submit-button>
</div>

I call stripe like this :

handleSubmitClick() {
    createToken().then(...)
}

the call is successfull and I receive a token but no card is saved on stripe's end:

image

I've also tried :
instance.createToken(this.$refs.cardNumber.$el)
and createToken(this.$refs.cardNumber.$el)

moreover instance.elements().elements is an empty array.

Bonus question :
How do I pass additionnal data such as zip code, when creating a token ?

Thank you very much 👍

Stripe PaymentIntent

First of all, thank you for this plugin!

Do you guys have any plan to implement or accept PR for the new PaymentIntent flow?
The repo looks not really maintained, and PR are just sitting there :/

Starting in September 2019, a new regulation called Strong Customer Authentication (SCA) will require businesses in Europe to request additional authentication for online payments. We recommend that all European businesses start building their Stripe integrations with either our PaymentIntents API or our new Checkout to be ready for these rule changes.

TypeError: Cannot read property 'elements' of undefined

Hi @nkoehring thank you for making this component! I am currently getting a type error for reading an elements property.

Error in console:

[Vue warn]: Error in beforeMount hook: "TypeError: Cannot read property 'elements' of undefined"

found in

---> <StripeElement>
       <Card>
         <Order> at /Users/connorleech/Projects/linemansmilestones-static/src/components/Order.vue
           <App> at /Users/connorleech/Projects/linemansmilestones-static/src/components/App.vue
             <Root>
warn @ 15:480
handleError @ 15:563
callHook @ 15:2668
...
(anonymous) @ build.js:712
15:567 TypeError: Cannot read property 'elements' of undefined
    at n (142:1)
    at o (142:1)
    at VueComponent.beforeMount (142:1)
    at callHook (15:2666)
    at mountComponent (15:2516)
    at VueComponent.Vue$3.$mount (15:7864)
    at VueComponent.Vue$3.$mount (15:10067)
    at init (15:3502)
    at createComponent (15:5148)
    at createElm (15:5091)

I have a component defined similar to the example. I am using vue-router to render this component:

<template>
    <div>
        <h1>Please give us your payment details:</h1>
        <card class='stripe-card'
          :class='{ complete }'
          :stripe='stripeKey'
          :options='stripeOptions'
          @change='complete = $event.complete'
        />
        <button class='pay-with-stripe' @click='pay' :disabled='!complete'>Pay with credit card</button>
    </div>

</template>

<script>
    import { Card, createToken } from 'vue-stripe-elements'

    export default {
      data () {
        return {
          complete: false,
          stripeKey: 'pk_test_Tro4UIRJbdwS1mR7qO8EQ73F',
          stripeOptions: {}
        }
      },

      components: { Card },

      methods: {
        pay () {
          createToken().then(data => console.log(data.token))
        }
      }
    }
</script>

<style>
.stripe-card {
  width: 300px;
  border: 1px solid grey;
}
.stripe-card.complete {
  border-color: green;
}
</style>

What am I doing wrong to render this component?

can't call methods in "mounted()" when using vue-stripe-elements

Hi!

I have a method called getPreferences() that loads up some user data I want to show in the view. Calling this function however, triggers the following error. When I remove the reference to this.getPreferences() in the mounted() function, all works fine.

mounted() {
            this.getPreferences();
},

[Vue warn]: Error in beforeMount hook: "IntegrationError: Can only create one Element of type card."

[Vue warn]: Error in mounted hook: "TypeError: Cannot read property 'mount' of undefined" found in ---> <StripeElement> <Card>

When I don't use the Card component, calling my own method in mounted() also works fine. Thanks for helping out!

amount of a paiement

Hello !

Thank you for your code.

I have a question about:

      stripeOptions: {
        // see https://stripe.com/docs/stripe.js#element-options for details
      }

I don't find the amount of the paiement in the document. Can you give me an example of a simple transaction ?

Thanks !

Allowing for @keyup events

If we use the standard js stripe elements as a form we can easily process the form by hitting the enter key as soon as the user enters all the data. This is because the enter key submits the form. With vue-stripe-elements there is no way to listen to the enter @keyup.enter or other keys.

Non standard module name.

most vue components are named with camel case where as this one is named with kebab case. This makes it harder and more obscure to use the regular javascript syntax, we would have to write the following

app = Vue(...

  components: {
     card: window['vue-stripe-elements'].Card,
...

as opposed to

app = Vue(...

  components: {
     card: VueStripeElements.Card,
...

How to make charges

Is it possible to create stripe charges with this library?
The way I see from the documentation, it only makes tokens (through createToken), and I want the test-payments to show up in my Stripe dashboard.

Support for the hidePostalCode option

Hello,

In the Stripe documentation, there's a "hidePostalCode" property on the "Card" Element, allowing you to disable the postal code input.

Is this currently supported? Or can it be?

Thanks in advance!

Hot Module Reloading tries to create another element

When using hot module reloading, vue-stripe-elements tries to create another StripeElelment on the page when you make a change:

[Vue warn]: Error in beforeMount hook: "IntegrationError: Can only create one Element of type card."

found in

---> <StripeElement>
       <Card>
            ...

Which is then followed by:

[Vue warn]: Error in mounted hook: "TypeError: this._element is undefined"

and the element is removed from the page.

Invalid API Key provided, but this key works in non-Vue project

I've done everything as intructed in Readme.

I'm using a stripe API key for test mode. When I fill in dummy credit card data and click pay

POST to https://api.stripe.com/v1/tokens

with data:

card[number]: 4242424242424242
card[cvc]: 222
card[exp_month]: 02
card[exp_year]: 22
card[address_zip]: 12345
guid: 162ec2ce-a4c1-4b5e-a0f1-5d875436dd79
muid: 43505269-2406-436f-acf2-52d1424beeac
sid: 506c0fac-4330-4116-9d23-4efd8055fc3d
payment_user_agent: stripe.js/061e956d; stripe-js-v3/061e956d
referrer: http://localhost:8000/dashboard/subscription-cost
key: (my key, censored)

returns 401 with response:

{
  "error": {
    "message": "Invalid API Key provided: pk_test_*******************kax7",
    "type": "invalid_request_error"
  }
}

The same key works when used in static html page implemented according to the stripe docs (by using <script src="https://checkout.stripe.com/checkout.js">).

Access to Stripe Error Message

Stripe produces error messages in it's realtime checking but there seems no way to access those:

i.e. is you enter 11/11 into the Expiry field Stripe error response is

Your card's expiration year is in the past.

Am I missing something or is this not implemented?

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.