Payments

List

GET /invoices/#{invoice-id}/payments.(json|xml)
Returns a collection of payments that are attached to a given invoice of the authenticated user.

Sample JSON Response

Status: 200 OK
 
[
  {
    "payment": {
      "created_at": "2010-08-24T01:47:50Z",
      "updated_at": "2010-08-24T01:47:50Z",
      "payment_method": "cash",
      "amount": "50.00",
      "balance": "0.00",
      "date": "2010-09-25",
      "id": 25
    }
  },
  {
    "payment": {
      "created_at": "2010-09-30T01:47:50Z",
      "updated_at": "2010-09-30T01:47:50Z",
      "payment_method": "PayPal",
      "amount": "150.00",
      "balance": "0.00",
      "date": "2010-09-30",
      "id": 45
    }
  }
]

Sample XML Response

Status: 200 OK
 
<?xml version="1.0" encoding="UTF-8"?>
<payments type="array">
  <payment>
    <created-at>2010-08-24T01:47:50Z</created-at>
    <updated-at>2010-08-24T01:47:50Z</updated-at>
    <payment-method>cash</payment-method>
    <amount>50.00</amount>
    <balance>0.00</balance>
    <date>2010-09-25</date>
    <id type="integer">25</id>
  </payment>
  <payment>
    <created-at>2010-09-30T01:47:50Z</created-at>
    <updated-at>2010-09-30T01:47:50Z</updated-at>
    <payment-method>PayPal</payment-method>
    <amount>150.00</amount>
    <balance>0.00</balance>
    <date>2010-09-30</date>
    <id type="integer">45</id>
  </payment>
</payments>

Show Top

GET /invoices/#{invoice-id}/payments/#{id}.(json|xml)
Returns a single payment that belongs to the given invoice of the authenticated user.

Sample JSON Response

Status: 200 OK
 
{
  "payment": {
    "created_at": "2010-09-30T01:47:50Z",
    "updated_at": "2010-09-30T01:47:50Z",
    "payment_method": "PayPal",
    "amount": "150.00",
    "balance": "0.00",
    "date": "2010-09-30",
    "id": 45
  }
}

Sample XML Response

Status: 200 OK
 
<?xml version="1.0" encoding="UTF-8"?>
<payment>
  <created-at>2010-09-30T01:47:50Z</created-at>
  <updated-at>2010-09-30T01:47:50Z</updated-at>
  <payment-method>PayPal</payment-method>
  <amount>150.00</amount>
  <balance>0.00</balance>
  <date>2010-09-30</date>
  <id type="integer">45</id>
</payment>

Create Top

POST /invoices/#{invoice-id}/payments.(json|xml)
Creates a new payment for the given invoice of the authenticated user. Date and amount of the payment are required. Returns the created payment as the response.

Sample JSON Request

{
  "payment": {
    "date": "2010-09-30",
    "amount": "100.00",
    "payment_method": "PayPal"
  }
}

Sample JSON Response

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

Sample XML Request

<?xml version="1.0" encoding="UTF-8"?>
<payment>
   <date>2010-09-30</date>
   <amount>100.00</amount>
   <payment-method>PayPal</payment-method>
</payment>

Sample XML Response

Status: 201 Created
Location: http://example.curdbee.com/payments/#{id}
 
<payment>
  ...
</payment>

Update Top

PUT /invoices/#{invoice-id}/payments/#{id}.(json|xml)
Updates an existing payment that belongs to the given invoice of the authenticated user. Returns the updated payment.

Sample JSON Request

{
  "payment": {
    "amount": "150.00",
  }
}

Sample JSON Response

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

Sample XML Request

<payment>
  <amount>150.00</amount>
</payment>

Sample XML Response

Status: 200 OK
Location: http://example.curdbee.com/payments/#{id}
 
<payment>
  <id>#{id}</id>
  ...
</payment>

Delete Top

DELETE /invoices/#{invoice-id}/payments/#{id}.(json|xml)
Deletes an existing payment that belongs to the given invoice of the authenticated user.

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.