KISO Docs

Javascript

#Overview

KISO Stripe Payments ships with a small amount of Javascript to allow for a smooth client side experience when using the Stripe Transaction Button. You will find it located in app/javascripts/kiso_stripe_payments and contains the following files:
app/javascript/kiso_stripe_payments
├── admin
│   └── plans.js
├── index.js
├── kiso_stripe_payments_config.js
├── kiso_stripe_payments_error_handler.js
├── kiso_stripe_payments_poller.js
├── kiso_stripe_payments_success_handler.js
├── kiso_stripe_payments_utils.js
└── stripe_checkout_buttons.js

#kiso_stripe_payments_config

This file contains a basic config object:
var KisoStripePaymentsConfig = {

  // Show payment errors as a either div or redirect
  showPaymentErrorAs: 'div',

  // The CSS class of a div on your page to show a payment failure
  errorDivClass: '.stripe-transaction-error',

  // The path to redirect to on payment failure
  redirectAfterFailurePath: '/sorry',

  // Show payment successes as a redirect to another page (will receive the
  // Stripe TX id as a query parameter `tx`)
  showPaymenSuccessAs: 'redirect',

  // The CSS class of a div on your page to show a payment success
  successDivClass: '.stripe-transaction-success',

  // The path to redirect to on a payment success
  redirectAfterSuccessPath: '/success',

  // The path to poll the transaction status (inbuilt to KISO Stripe Payments)
  transactionStatusPollUrl: '/kiso_stripe_payments/transaction_status',

}

export default KisoStripePaymentsConfig
There are two basic modes of hanling Stripe payment errors and successes: as a redirect to another page including the Stripe Transaction ID in the query string as the param tx, or by displaying a message in a div on the page.