Payment Information

In this document we are going to show you how to collect, store, and use payment information on Invoiced through your own website or application.

Introduction

When implementing Invoiced into your app or website you often want control over the billing and payment UIs in order to provide customers with a seamless experience. Invoiced allows you to collect and vault payment information using your own forms while still relying on Invoiced to manage payments. As a result of letting Invoiced handle payment information you can also enjoy simplified PCI compliance.

The way that it works is that within your customer's web browser you can tokenize your customer's payment information that can later be passed to our API in order to save the payment information for future billing or payments.

The key to a secure implementation is to use either the Invoiced tokenization scheme or your payment gateway's tokenization scheme (if there is one). Tokenization gives you a randomly generated token ID that you can pass to your servers that references the payment information collected. The benefit of this approach is to prevent you from directly handling sensitive payment information.

With tokenization the payment information is sent to Invoiced on the client-side using our Javascript library. When the payment information is sent in you receive a short-lived, single-use token that references the captured payment information, which can be a card or bank account. You can then use that payment info token in our API to vault it on a customer's account or use it to process a payment.

It's important to consider that payment info tokens will only work with your Invoiced account and last for a maximum of 2 hours. Once a token is used it cannot be re-used. As such you should not be storing tokens on your end.

Prerequisites

  1. You have built your own form to capture payment information.
  2. Include the invoiced.js library on your payment page:
  3. Obtain your publishable key from SettingsDevelopers.

Storing credit card information

1. Tokenize credit card

HTML

2. Add card to the customer

If this is a new customer then you can pass in the Invoiced token like below:

Curl
Java
PHP
Python
Ruby

Or if this is an existing customer then you can make a similar call to update the customer (assuming you have already retrieved the customer):

Curl
Java
PHP
Python
Ruby

Storing bank account information

You can also capture bank account information for ACH debits.

1. Tokenize bank account

HTML

2. Add bank account to the customer

If this is a new customer then you can pass in the Invoiced token like below:

Curl
Java
PHP
Python
Ruby

Or if this is an existing customer then you can make a similar call to update the customer (assuming you have already retrieved the customer):

Curl
Java
PHP
Python
Ruby