Skip to Main Content
×
Freshbooks
Official App
Free – Google Play
Get it
FreshBooks is Loved by American Small Business Owners
FreshBooks is Loved by Canadian Small Business Owners
FreshBooks is Loved by Small Business Owners in the UK
Dev Blog

Credit cards now accepted through the API

by Sunir on February 23/2010

If you’re using FreshBooks for subscription billing, your work-flow just got easier. You can now capture credit cards from inside your own application and send them to FreshBooks over the recurring profiles API.

If you are using an auto-bill capable payment gateway, you can automatically charge your clients credit card by supplying the autobill element when calling recurring.create and recurring.update.

Request

<?xml version="1.0" encoding="utf-8"?>
<request method="recurring.create">
<recurring>
...
<autobill>
<gateway_name>Authorize.net</gateway_name>  <!-- Case insensitive gateway name from gateway.list -->
<card>
<number>4111 1111 1111 1111</number>  <!-- Can include spaces, hyphens and other punctuation marks -->
<name>John Smith</name>
<expiration>
<month>3</month>
<year>2012</year>
</expiration>
</card>
</autobill>
...
</recurring>
</request>

Additionally, the response generated by the recurring.list and recurring.get methods include an autobill element. If credit card auto-billing is enabled on a recurring profile then a response will be returned in the following format:

Response

<?xml version="1.0" encoding="utf-8"?>
<response xmlns="https://www.freshbooks.com/api/" status="ok">
<recurrings page="1" per_page="10" pages="5" total="48">
<recurring>
<recurring_id>00000000001</recurring_id>
...
<autobill>
<gateway_name>Authorize.Net</gateway_name>
<card>
<number>************1111</number>
<name>John Smith</name>
<expiration>
<month>03</month>
<year>2012</year>
</expiration>
</card>
</autobill>
...
</recurring>
...
</recurrings>
</response>

We’ve also added a gateway.list method which returns a list of gateways enabled in your FreshBooks account that can process credit card transactions.

This is a big week for FreshBooks API users! This post is 2 of 3 on new goodies we’re providing with the latest release. On Tuesday we told you how to keep in sync with FreshBooks Webhooks. Next, we’ll explain how to manage your application’s or service’s billing on the FreshBooks API.