Transactions

A Transaction occurs when an order is placed or a refund is processed.

Attributes

Name Type Description Example
id uuid internal unique identifier of Transaction "01234567-89ab-cdef-0123-456789abcdef"
order_id string unique identifier of the order this transaction is associated with "01234567-89ab-cdef-0123-456789abcdef"
category string Type of the transaction [P (Purchase), R (Refund)] "P"
member:name:surname string surname of the person associated with the transaction "Jones"
member:name:initial string first initial of the person associated with the transaction "N"
member:name:salutation string Title of the person "Mr"
member:email email Email address "[email protected]"
member:membership_number number membership number
Range: 0 <= value <= 9999999999999999
1234567891234567
transaction_date date-time when transaction was performed by the client "2012-01-01T12:00:00Z"
product_description string descriptive text for the product being purchased "Pie and chips"
payment:amount number 40.0
payment:gst number 4.0
payment:total number 44.0
payment:card_type string "Mastercard"
vouchers array [{"id"=>"asd123", "category"=>"child", "expiry"=>"2012-01-01", "amount"=>11.0, "gst"=>1.1, "total"=>12.1}]
commission:rate number
Range: 0 <= value <= 100
30
commission:value number 18.25
delivery:gifted boolean true
delivery:giftee string "Joe Bloggs"
delivery:channel string Whether the items will be delivered by post (P) or email (E) "P"
delivery:address:line1 string "Building 1"
delivery:address:line2 string "123 Fake St"
delivery:address:suburb string "Fakington"
delivery:address:post_code number
Range: 800 <= value <= 7799
2000
delivery:address:city string "Sydney"
delivery:address:state string "NSW"
delivery:email email "[email protected]"

Transactions Create

Create a new transaction.

POST /transaction
    

Required Parameters

Name Type Description Example
order_id string unique identifier of the order this transaction is associated with "01234567-89ab-cdef-0123-456789abcdef"
category string Type of the transaction [P (Purchase), R (Refund)] "P"
member:name:surname string surname of the person associated with the transaction "Jones"
member:name:initial string first initial of the person associated with the transaction "N"
member:name:salutation string Title of the person "Mr"
member:email email Email address "[email protected]"
member:membership_number number membership number
Range: 0 <= value <= 9999999999999999
1234567891234567
transaction_date date-time when transaction was performed by the client "2012-01-01T12:00:00Z"
product_description string descriptive text for the product being purchased "Pie and chips"
payment:amount number 40.0
payment:gst number 4.0
payment:total number 44.0
payment:card_type string "Mastercard"
vouchers array [{"id"=>"asd123", "category"=>"child", "expiry"=>"2012-01-01", "amount"=>11.0, "gst"=>1.1, "total"=>12.1}]
commission:rate number
Range: 0 <= value <= 100
30
commission:value number 18.25
delivery:gifted boolean true
delivery:giftee string "Joe Bloggs"
delivery:channel string Whether the items will be delivered by post (P) or email (E) "P"
delivery:address:line1 string "Building 1"
delivery:address:line2 string "123 Fake St"
delivery:address:suburb string "Fakington"
delivery:address:post_code number
Range: 800 <= value <= 7799
2000
delivery:address:city string "Sydney"
delivery:address:state string "NSW"
delivery:email email "[email protected]"

Optional Parameters

Name Type Description Example
id uuid internal unique identifier of Transaction "01234567-89ab-cdef-0123-456789abcdef"

Curl Example

$ curl -n -X POST https://localhost:3000/transaction \
  -H "Content-Type: application/json" \
 \
  -d '{
  "id": "01234567-89ab-cdef-0123-456789abcdef",
  "order_id": "01234567-89ab-cdef-0123-456789abcdef",
  "category": "P",
  "member": {
    "name": {
      "surname": "Jones",
      "initial": "N",
      "salutation": "Mr"
    },
    "email": "[email protected]",
    "membership_number": 1234567891234567
  },
  "transaction_date": "2012-01-01T12:00:00Z",
  "product_description": "Pie and chips",
  "payment": {
    "amount": 40.0,
    "gst": 4.0,
    "total": 44.0,
    "card_type": "Mastercard"
  },
  "vouchers": [
    {
      "id": "asd123",
      "category": "child",
      "expiry": "2012-01-01",
      "amount": 11.0,
      "gst": 1.1,
      "total": 12.1
    }
  ],
  "commission": {
    "rate": 30,
    "value": 18.25
  },
  "delivery": {
    "gifted": true,
    "giftee": "Joe Bloggs",
    "channel": "P",
    "address": {
      "line1": "Building 1",
      "line2": "123 Fake St",
      "suburb": "Fakington",
      "post_code": 2000,
      "city": "Sydney",
      "state": "NSW"
    },
    "email": "[email protected]"
  }
}'
    

Response Example

HTTP/1.1 201 Created
    
{
  "id": "01234567-89ab-cdef-0123-456789abcdef",
  "order_id": "01234567-89ab-cdef-0123-456789abcdef",
  "category": "P",
  "member": {
    "name": {
      "surname": "Jones",
      "initial": "N",
      "salutation": "Mr"
    },
    "email": "[email protected]",
    "membership_number": 1234567891234567
  },
  "transaction_date": "2012-01-01T12:00:00Z",
  "product_description": "Pie and chips",
  "payment": {
    "amount": 40.0,
    "gst": 4.0,
    "total": 44.0,
    "card_type": "Mastercard"
  },
  "vouchers": [
    {
      "id": "asd123",
      "category": "child",
      "expiry": "2012-01-01",
      "amount": 11.0,
      "gst": 1.1,
      "total": 12.1
    }
  ],
  "commission": {
    "rate": 30,
    "value": 18.25
  },
  "delivery": {
    "gifted": true,
    "giftee": "Joe Bloggs",
    "channel": "P",
    "address": {
      "line1": "Building 1",
      "line2": "123 Fake St",
      "suburb": "Fakington",
      "post_code": 2000,
      "city": "Sydney",
      "state": "NSW"
    },
    "email": "[email protected]"
  }
}