RSS feed
FreshBooks API Guide

Payments

Staff access

Staff do not have access to the API calls listed below.

payment.create

Create a new payment and returns the corresponding payment_id.

This function can have one of three possible effects depending on the presence of invoice_id and client_id:

  • If you specify an invoice_id only, the payment will be recorded as an invoice payment.
  • If you specify a client_id only, the payment will be recorded as a client credit.
  • If you specify both an invoice_id and client_id, the payment will be recorded as an invoice payment, and the amount will be subtracted from the client’s credit.

Payment type must be one of: ‘Check’, ‘Credit’, ‘Bank Transfer’, ‘PayPal’, ‘2Checkout’, ‘VISA’, ‘MASTERCARD’, ‘DISCOVER’, ‘NOVA’, ‘AMEX’, ‘DINERS’, ‘EUROCARD’, ‘JCB’ or ‘ACH’.

Request

<?xml version="1.0" encoding="utf-8"?>
<request method="payment.create">
  <payment>
    <client_id>13</client_id>
    <invoice_id>207</invoice_id>      # Associate this payment with an invoice (Optional)
    <date>2007-05-30</date>           # Default value is today's date (Optional)
    <amount>129.88</amount>           # Default is zero (Optional)
    <type>Check</type>                # Default is Check (Optional)
    <notes>Prompt payment!</notes>    # (Optional)
  </payment>
</request>

Response

<?xml version="1.0" encoding="utf-8"?>
<response status="ok">
  <payment_id>103</payment_id>
</response>

payment.update

Update an existing payment. All fields besides payment_id are optional — unpassed fields will retain their existing value.

Where’s payment.delete?

Right now there isn’t a way to explicitly delete payments, but you can update a payment’s amount to $0.00.

Request

<?xml version="1.0" encoding="utf-8"?>
<request method="payment.update">
  <payment>
    <payment_id>103</payment_id>
    <amount>0.00</amount>
    <notes>Payment refunded.</notes>
  </payment>
</request>

Response

<?xml version="1.0" encoding="utf-8"?>
<response status="ok"/>

payment.get

Retrieve payment details according to payment_id.

Request

<?xml version="1.0" encoding="utf-8"?>
<request method="payment.get">
  <payment_id>322</payment_id>
</request>

Response

<?xml version="1.0" encoding="utf-8"?>
<response status="ok">
  <payment>
    <payment_id>109</payment_id>
    <client_id>13</client_id>
    <invoice_id>207</invoice_id>
    <date>2007-05-30 00:00:00</date>
    <amount>129.88</amount>
    <type>Check</type>
    <notes>Prompt payment!</notes>
  </payment>
</response>

payment.list

Returns a list of recorded payments. You can optionally filter by invoice_id or client_id.

Request

<?xml version="1.0" encoding="utf-8"?>
<request method="payment.list">
  <client_id>3</client_id>            # Filter by client (Optional)
  <invoice_id>133</invoice_id>        # Filter by invoice (Optional)
  <date_from>2007-01-01</date_from>   # Return payments dated after this arg (Optional)
  <date_to>2007-04-01</date_to>       # Return payments dated before this arg (Optional)

  <page>1</page>                      # Page number to return, default is 1 (Optional)
  <per_page>10</per_page>             # Number of results per page, default is 25 (Optional)
</request>

Response

<?xml version="1.0" encoding="utf-8"?>
<response status="ok">
  <payments page="1" per_page="10" pages="23" total="221">
    <payment>
      <payment_id>165</payment_id>
      <invoice_id>203</invoice_id>
      <date>2007-03-02 12:04:11</date>
      <type>Cash</type>
      <note></note>
      <client_id>43</client_id>
    </payment>
    ...
  </payments>
</response>