Skip to content

funnelkake/stripe-payment-modal-vue-example

main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 

Stripe Payment Modal Vue Demo

This sample project shows how to implement Stripe payments & subscriptions within a modal dialog using PaymentModal and Vue CLI.

Demo

See a hosted version of the Next JS sample project here.

The hosted demo is running in Stripe test mode. Use 4242424242424242 as a test card number with any CVC + future expiration date.

Getting Started

This is a Vue.js project bootstrapped with Vue CLI.

Installation

To see the Stripe modals in action, you need to create a free PaymentModal account.

  1. Create a PaymentModal site.
  2. Clone this repo
  3. In the project directory, run cp .env.local.sample .env.local
  4. Open .env.local and update VUE_APP_PAYMENT_MODAL_SITE_ID with your PaymentModal site id.
  5. Run yarn to download npm packages.
  6. Run yarn start to open the Vue app in development mode.
  7. Open http://localhost:8080 to view it in the browser.
  8. Update the Demo.vue in src/components to use any HTML element attributes to attach click listeners to open your modals.

This sample and hosted demo project uses the following HTML element attributes, but you can use any valid HTML selector. Be sure to update the selectors in your PaymentModal account.

  • id="pm-payment-amount" creates a modal with a Stripe payment intent using an amount.
  • class="pm-payment-stripeid" creates a modal with a Stripe payment intent using a Stripe price id.
  • data-subscription-checkout="true" creates a modal with a Stripe subscription using a Stripe price id.

Learn More

You can learn more about configuring Stripe modal properties in the PaymentModal documentation.

You can learn more about the Vue app in the Vue.js and Vue CLI.

Get Support

If you found a bug or want to suggest a new [feature/use case/sample], please file an issue.

If you have questions, comments, or need help with the code, we're here to help:

on Twitter at @paymentmodal on Stack Overflow at the stripe-modal tag by email