Recurring Profiles

Note
In order to access these methods via the API, the CurdBee account used must have the Recurring Profile module enabled.

List

GET /recurring_profiles.(json|xml)
Returns a collection of recurring invoices that belong to the the authenticated user.. The results will be paginated. You can use the following optional parameters to traverse the results.

  • per_page – Number of results per page (default: 20)
  • page – Page in result-set
  • client – ID of the client to scope the recurring profiles

Sample JSON Response

Status: 200 OK
 
[
  {
    "recurring_profile": {
      "shipping_amount": "₴0.00",
      "created_at": "2010-09-22T19:22:27Z",
      "total_billed": "₴1600.00",
      "line_items": [
        {
          "price": "60.00",
          "name_and_description": "Site Revamp",
          "quantity": 25.0,
          "sort_order": null,
          "total": "1500.00",
          "id": 32677,
          "unit": "hour"
        },
        {
          "price": "10.00",
          "name_and_description": "Domain Registration",
          "quantity": 10.0,
          "sort_order": null,
          "total": "100.00",
          "id": 32678,
          "unit": "domain"
        }
      ],
      "notes": "Please write a cheque in favor of MyCompany Inc.",
      "tax2_compound": null,
      "updated_at": "2010-09-22T19:22:28Z",
      "discount_amount": "₴0.00",
      "date": "2010-09-23",
      "id": 9297,
      "tax_amount": "₴0.00",
      "client": {
        "name": "ABC Inc.",
        "id": 6470
      },
      "payment_options": null,
      "total_due": "₴1600.00",
      "tax2_amount": "₴0.00",
      "sub_total": "₴1600.00",
      "paid_total": "₴0.00",
      "invoice_no": "IN-0001",
      "start_date":"2010-09-21",
      "save_as_draft":false,
      "next_billing_date":"2010-09-21",
      "payment_due_term":"Custom",
      "profile_name":"RP-Test",
      "iteration_no":2,
      "occurences":3,
      "frequency_term":"Daily"
    }
  }
]

Sample XML Response

Status: 200 OK
 
<?xml version="1.0" encoding="UTF-8"?>
<recurring-profiles type="array">
  <recurring-profile>
    <shipping-amount>&#8372;0.00</shipping-amount>
    <created-at>2010-09-22T19:22:27Z</created-at>
    <total-billed>&#8372;1600.00</total-billed>
    <line-items type="array">
      <line-item>
        <price>60.00</price>
        <name-and-description>Site Revamp</name-and-description>
        <quantity type="float">25.0</quantity>
        <sort-order nil="true"></sort-order>
        <total>1500.00</total>
        <id type="integer">32677</id>
        <unit>hour</unit>
      </line-item>
      <line-item>
        <price>10.00</price>
        <name-and-description>Domain Registration</name-and-description>
        <quantity type="float">10.0</quantity>
        <sort-order nil="true"></sort-order>
        <total>100.00</total>
        <id type="integer">32678</id>
        <unit>domain</unit>
      </line-item>
    </line-items>
    <notes>Please write a cheque in favor of MyCompany Inc.</notes>
    <tax2-compound nil="true"></tax2-compound>
    <updated-at>2010-09-22T19:22:28Z</updated-at>
    <discount-amount>&#8372;0.00</discount-amount>
    <date>2010-09-23</date>
    <id type="integer">9297</id>
    <tax-amount>&#8372;0.00</tax-amount>
    <client>
      <name>ABC Inc.</name>
      <id type="integer">6470</id>
    </client>
    <payment-options nil="true"></payment-options>
    <total-due>&#8372;1600.00</total-due>
    <tax2-amount>&#8372;0.00</tax2-amount>
    <sub-total>&#8372;1600.00</sub-total>
    <paid-total>&#8372;0.00</paid-total>
    <invoice-no>IN-0001</invoice-no>
    <save-as-draft type="boolean">false</save-as-draft>
    <start-date>2010-09-21</start-date>
    <next-billing-date>2010-09-21</next-billing-date>
    <iteration-no type="integer">2</iteration-no>
    <profile-name>RP-Test</profile-name>
    <frequency-term>Daily</frequency-term>
    <payment-due-term>Custom</payment-due-term>
    <occurrences type="integer">3</occurrences>
  </recurring-profile>
</recurring-profiles>

Show Top

GET /recurring_profiles/#{id}.(json|xml)
Returns a single recurring profile that belongs to the authenticated user’s account.

Sample JSON Response

Status: 200 OK
 
{
    "recurring_profile": {
      "shipping_amount": "₴0.00",
      "created_at": "2010-09-22T19:22:27Z",
      "total_billed": "₴1600.00",
      "line_items": [
        {
          "price": "60.00",
          "name_and_description": "Site Revamp",
          "quantity": 25.0,
          "sort_order": null,
          "total": "1500.00",
          "id": 32677,
          "unit": "hour"
        },
        {
          "price": "10.00",
          "name_and_description": "Domain Registration",
          "quantity": 10.0,
          "sort_order": null,
          "total": "100.00",
          "id": 32678,
          "unit": "domain"
        }
      ],
      "notes": "Please write a cheque in favor of MyCompany Inc.",
      "tax2_compound": null,
      "updated_at": "2010-09-22T19:22:28Z",
      "discount_amount": "₴0.00",
      "date": "2010-09-23",
      "id": 9297,
      "tax_amount": "₴0.00",
      "client": {
        "name": "ABC Inc.",
        "id": 6470
      },
      "payment_options": null,
      "total_due": "₴1600.00",
      "tax2_amount": "₴0.00",
      "sub_total": "₴1600.00",
      "paid_total": "₴0.00",
      "invoice_no": "IN-0001",
      "start_date":"2010-09-21",
      "save_as_draft":false,
      "next_billing_date":"2010-09-21",
      "payment_due_term":"Custom",
      "profile_name":"RP-Test",
      "iteration_no":2,
      "occurrences":3,
      "frequency_term":"Daily"
  }
}

Sample XML Response

Status: 200 OK
 
<?xml version="1.0" encoding="UTF-8"?>
<recurring-profiles type="array">
  <recurring-profile>
    <shipping-amount>&#8372;0.00</shipping-amount>
    <created-at>2010-09-22T19:22:27Z</created-at>
    <total-billed>&#8372;1600.00</total-billed>
    <line-items type="array">
      <line-item>
        <price>60.00</price>
        <name-and-description>Site Revamp</name-and-description>
        <quantity type="float">25.0</quantity>
        <sort-order nil="true"></sort-order>
        <total>1500.00</total>
        <id type="integer">32677</id>
        <unit>hour</unit>
      </line-item>
      <line-item>
        <price>10.00</price>
        <name-and-description>Domain Registration</name-and-description>
        <quantity type="float">10.0</quantity>
        <sort-order nil="true"></sort-order>
        <total>100.00</total>
        <id type="integer">32678</id>
        <unit>domain</unit>
      </line-item>
    </line-items>
    <notes>Please write a cheque in favor of MyCompany Inc.</notes>
    <tax2-compound nil="true"></tax2-compound>
    <updated-at>2010-09-22T19:22:28Z</updated-at>
    <discount-amount>&#8372;0.00</discount-amount>
    <date>2010-09-23</date>
    <id type="integer">9297</id>
    <tax-amount>&#8372;0.00</tax-amount>
    <client>
      <name>ABC Inc.</name>
      <id type="integer">6470</id>
    </client>
    <payment-options nil="true"></payment-options>
    <total-due>&#8372;1600.00</total-due>
    <tax2-amount>&#8372;0.00</tax2-amount>
    <sub-total>&#8372;1600.00</sub-total>
    <paid-total>&#8372;0.00</paid-total>
    <invoice-no>IN-0001</invoice-no>
    <save-as-draft type="boolean">false</save-as-draft>
    <start-date>2010-09-21</start-date>
    <next-billing-date>2010-09-21</next-billing-date>
    <iteration-no type="integer">2</iteration-no>
    <profile-name>RP-Test</profile-name>
    <frequency-term>Daily</frequency-term>
    <payment-due-term>Custom</payment-due-term>
    <occurrences type="integer">3</occurrences>
  </recurring-profile>
</recurring-profiles>

Create Top

POST /recurring_profiles.(json|xml)
Creates a new recurring profile under the authenticated user’s account. The start_date, invoice_no, client_id, frequency, occurrences, profile_name are required. Returns the created recurring profile as the response.

Sample JSON Request

{
  "recurring_profile": {
    "start_date": "2010/09/26",
    "tax": "25.00",
    "line_items_attributes": [
      {
        "name_and_description": "Sample Item",
        "price": 25.0,
        "quantity": 1,
        "unit": "hour"
      },
      {
        "name_and_description": "Another Entry",
        "price": 150.0,
        "quantity": 1,
        "unit": "KM"
      }
    ],
    "discount": "10%",
    "notes": "We can add notes too",
    "custom_frequency": "10",
    "profile_name": "test profile",
    "shipping": "10.00",
    "client_id": 4,
    "frequency": "0",
    "occurrences": "0",
    "invoice_no": "RP-NEW",
    "payment_options": ["paypal", "gcheckout", "twocheckout", "authorizenet"]
  }
}

Sample JSON Response

Status: 201 Created
Location: http://example.curdbee.com/recurring_profiles/#{id}
 
{
  "recurring_profile": {
    "id":  #{id},
    ...
  }
}

Sample XML Request

<recurring-profile>
  <tax>25.00</tax>
  <start-date type="date">2010-09-26</start-date>
  <discount>10%</discount>
  <line-items-attributes type="array">
    <line-items-attribute>
      <price type="float">25.0</price>
      <name-and-description>Sample Item</name-and-description>
      <quantity type="integer">1</quantity>
      <unit>hour</unit>
    </line-items-attribute>
    <line-items-attribute>
      <price type="float">150.0</price>
      <name-and-description>Another Entry</name-and-description>
      <quantity type="integer">1</quantity>
      <unit>KM</unit>
    </line-items-attribute>
  </line-items-attributes>
  <notes>We can add notes too</notes>
  <shipping>10.00</shipping>
  <profile-name>test profile</profile-name>
  <custom-frequency>10</custom-frequency>
  <client-id type="integer">4</client-id>
  <occurrences>0</occurrences>
  <frequency>0</frequency>
  <invoice-no>RP-NEW</invoice-no>
  <payment_options>
         <payment_option>paypal</payment_option>
         <payment_option>gcheckout</payment_option>
         <payment_option>twocheckout</payment_option>
         <payment_option>authorizenet</payment_option>
  <payment_options>
</recurring-profile>

Sample XML Response

Status: 201 Created
Location: http://example.curdbee.com/recurring_profiles/#{id}
 
<recurring-profile>
  ...
</recurring-profile>

Update Top

PUT /recurring_profiles/#{id}.(json|xml)
Updates an existing recurring profile that belongs to the authenticated user’s account. Returns the updated recurring profile.

Sample JSON Request

{
  "recurring_profile": {
    "line_items_attributes": [
      {
        "_delete": true,
        "id": 25
      },
      {
        "price": 76.0,
        "name_and_description": "Another Entry:Modified",
        "id": 26
      },
      {
        "price": 150.0,
        "name_and_description": "New Entry: Appending to the existing recurring profile",
        "quantity": 1,
        "unit": "hourly"
      }
    ],
    "custom_frequency": "25",
    "profile_name": "edited profile",
    "frequency": "0",
    "occurrences": "5",
  }
}

Sample JSON Response

Status: 200 OK 
Location: http://example.curdbee.com/recurring_profiles/#{id}
 
{
  "recurring_profile": {
    "id":  #{id},
    ...
  }
}

Sample XML Request

<?xml version="1.0" encoding="UTF-8"?>
<recurring-profile>
  <line-items-attributes type="array">
    <line-items-attribute>
      <-delete type="boolean">true</-delete>
      <id type="integer">25</id>
    </line-items-attribute>
    <line-items-attribute>
      <price type="float">76.0</price>
      <name-and-description>Another Entry:Modified</name-and-description>
      <id type="integer">26</id>
    </line-items-attribute>
    <line-items-attribute>
      <price type="float">150.0</price>
      <name-and-description>New Entry: Appending to the existing recurring profile</name-and-description>
      <quantity type="integer">1</quantity>
      <unit>hourly</unit>
    </line-items-attribute>
  </line-items-attributes>
  <custom_frequency>25</custom_frequency>
  <profile_name>edited profile</profile_name>
  <frequency>0<frequency>
  <occurrences>5<occurrences>
</recurring-profile>

Sample XML Response

Status: 200 OK
Location: http://example.curdbee.com/recurring_profiles/#{id}
 
<recurring-profile>
  <id>#{id}</id>
  ...
</recurring-profile>

Delete Top

DELETE /recurring_profiles/#{id}.(json|xml)
Deletes an existing recurring profile that belongs to the authenticated user’s account.

Sample JSON/XML Response

Status: 200 OK

Vesess Web design & web application development - Sri Lanka

All text and design is copyright © 2008 - 2012 Vesess. All rights reserved.