Hey there,

So you're looking to tokenize a credit card and add it to a recurring profile or invoice, eh? Well you've come to the right spot.

To get started you will need:

Let's make a quick example of why you would need to use this tutorial? Let's say you own a mountain biking rental business and people reach out to you seeing if they can rent directly from you or your site. Of course they can!

You want to be able to lead them to your website, have them enter in their credit card information and save it to an invoice profile in your FreshBooks account.

The problem with mountain biking rentals, is that they can get a little tricky. One customer wants a full-suspension bike while another just wants a cruiser to travel around town. Dominic needs to rent a helmet but Lucy brought her own. Furthermore, if Dominic brings back his full-suspension bike in three separate pieces, you're likely going to need to charge him for the damages to the bike and you don't want to have to send another invoice hoping Dom willingly pays for his damages. BUT! you don't want to have to store a credit card on a piece of paper because that's incredibly dangerous (ahem, and not PCI-compliant). We need to give FreshBooks the client's credit card number and save it to an invoice profile so it can be stored securely and used easily with consent.

In this tutorial, we're going to assume you've already made the interface with the customer and are just looking for a place to send the customer's credit card information.

NOTE: You will need Advanced Payments on New FreshBooks to enable this. If you don't have it you can click on Add-on's in the left side panel, look for "Advanced Payments" and click "Get Add-on" or you can call our friendly account managers at 1.833.333.1128

We're going to follow four basic steps with two payment processors (FreshBooks Payments and Stripe).

1. Setting up an Invoice Profile

You will need to create an invoice profile (and a client for that profile) before you can apply a payment to it.

In this case, I'm making a simple invoice profile that starts today, recurs monthly and will continue to recur for 3 months, since Dom wanted to rent the bike for the summer. I am only going to put two line items on it, but you can edit the invoice profile at a later date if Dom comes back for a mid-month tune-up (one-time payment) or wants to rent knee pads (recurring) and wants you to just charge his card.

I'm going to make a POST request to https://api.freshbooks.com/accounting/account/{{ACCOUNT_ID}}/invoice_profiles/invoice_profiles

Fields