Collecting Payment Information

Collecting Bank Information

🚧

Plaid support has been removed as of Nov 2023. We are planning to release Stripe Financial Connections in 2024.

We allow collecting of bank information by manually entering bank account and bank routing information.

This can be done easily using stripe.js to tokenize patient's account and routing numbers.

When manually collecting bank information ensure you are doing the following:

  1. You are requiring dual entry of account number by the patient (obscure the first entry so it can’t be seen when confirming the number the 2nd time) before sending it to stripe OR Hint. This significantly reduces typos which can result in fines or other consequences if the wrong account is debited.
  2. You are collecting at least bank routing, account number, account holder name, and account type (individual or company)
  3. You get authorization from bank account owner to debit the account as part of your form.
  4. You are using Hint’s public keys

more info on authorization requirements

👍

Use Hint's Public Keys

Stripe Production Public Key: pk_live_ImPWqYGkbMfjwg22MiAmB6u4
Stripe Test Public Key: pk_test_Y7byiIyWmjqy4Xy7fjArJdPl

var stripe = Stripe('pk_test_Y7byiIyWmjqy4Xy7fjArJdPl');

stripe
  .createToken('bank_account', {
    country: 'US',
    currency: 'usd',
    routing_number: '110000000',
    account_number: '000123456789',
    account_holder_name: 'Jenny Rosen',
    account_holder_type: 'individual',
  })
  .then(function(token) {
     post('/bank_accounts', {
       stripe_token: token.id,
       last_four: token.bank_account.last4
     });
  });

Posting the data to Hint

You must attach this payment information to a patient. When posting a bank account we require the stripe_token .

Testing Bank Accounts / ACH

You can mimic successful and failed ACH charges using the following bank routing and account numbers:

  • Routing number: 110000000
  • Account number:
    • 000123456789 (success)
    • 000111111116 (failure upon use)
    • 000111111113 (account closed)
    • 000222222227 (NSF/insufficient funds)
    • 000333333335 (debit not authorized)
    • 000444444440 (invalid currency)

Collecting Card Information

In order to collect credit or debit card information you will use Stripe Elements. It will create the input fields, tokenize the card, and return information to you via javascript.

// Stripe Production Public Key: 'pk_live_ImPWqYGkbMfjwg22MiAmB6u4'
// Stripe Test Public Key: 'pk_test_Y7byiIyWmjqy4Xy7fjArJdPl'
// Test card/bank numbers: https://stripe.com/docs/testing#cards
// Code Example Adapted From: https://stripe.com/docs/payments/cards/collecting/web
// https://stripe.com/payments/elements
// https://stripe.dev/elements-examples/


// Create a Stripe client.
var stripe = Stripe('pk_test_TYooMQauvdEDq54NiTphI7jx');

// Create an instance of Elements.
var elements = stripe.elements();

// Custom styling can be passed to options when creating an Element.
// (Note that this demo uses a wider set of styles than the guide below.)
var style = {
  base: {
    color: '#32325d',
    fontFamily: '"Helvetica Neue", Helvetica, sans-serif',
    fontSmoothing: 'antialiased',
    fontSize: '16px',
    '::placeholder': {
      color: '#aab7c4'
    }
  },
  invalid: {
    color: '#fa755a',
    iconColor: '#fa755a'
  }
};

// Create an instance of the card Element.
var card = elements.create('card', {style: style});

// Add an instance of the card Element into the `card-element` <div>.
card.mount('#card-element');

// Handle real-time validation errors from the card Element.
card.addEventListener('change', function(event) {
  var displayError = document.getElementById('card-errors');
  if (event.error) {
    displayError.textContent = event.error.message;
  } else {
    displayError.textContent = '';
  }
});

// Handle form submission.
var form = document.getElementById('payment-form');
form.addEventListener('submit', function(event) {
  event.preventDefault();

  // Billing Details hash is optional - https://stripe.com/docs/api/payment_methods/create#create_payment_method-billing_details
  stripe.createPaymentMethod(type: 'card', card: card, billing_details: extraParams).then(function(result) {
    if (result.error) {
      // Inform the user if there was an error.
      var errorElement = document.getElementById('card-errors');
      errorElement.textContent = result.error.message;
    } else {
      // Send the stripe_id to Hint's server.
      post('/payment_methods', {
        stripe_id: stripe_id
      });
    }
  });
});

❗️

Do Not Send Hint Sensitive Payment Details

Sensitive payment details like card numbers and bank account numbers should never be sent to Hint. If you are collecting payment details, they should always be sent to Stripe first, so they can be tokenized, and then you send the token to Hint.

Unless you are PCI compliant, you probably don't want card/bank numbers to hit your servers either, which is why the Stripe Elements library sends this information from the user's client directly to Stripe (more detail here: https://stripe.com/docs/security)


What’s Next