Difference between revisions of "API Transaction"
From Spiffy Stores Knowledge Base
(4 intermediate revisions by the same user not shown) | |||
Line 11: | Line 11: | ||
== Transaction Properties == | == Transaction Properties == | ||
− | + | {| class="reference" | |
− | + | !id | |
− | |||
− | |||
− | |||
− | {| class=" | ||
− | |||
|<code>{ "id" : 123456789 }</code><br/> | |<code>{ "id" : 123456789 }</code><br/> | ||
A unique numeric identifier for the transaction. This ID is only used with the API interface. | A unique numeric identifier for the transaction. This ID is only used with the API interface. | ||
|- | |- | ||
− | + | !order_id | |
|<code>{ "order_id" : 452983 }</code><br/> | |<code>{ "order_id" : 452983 }</code><br/> | ||
The internal ID of the associated order. | The internal ID of the associated order. | ||
|- | |- | ||
− | + | !order_number | |
|<code>{ "order_number" : 1045 }</code><br/> | |<code>{ "order_number" : 1045 }</code><br/> | ||
A unique numeric identifier for the order that is used as a reference number for the store owner and customers. This is not the same as the internal ID of the order, which is only used to refer to orders within the API. | A unique numeric identifier for the order that is used as a reference number for the store owner and customers. This is not the same as the internal ID of the order, which is only used to refer to orders within the API. | ||
|- | |- | ||
− | + | !order_name | |
|<code>{ "order_name" : "#001045" }</code><br/> | |<code>{ "order_name" : "#001045" }</code><br/> | ||
This is the order_number, formatted according the the store preferences for order number formatting. | This is the order_number, formatted according the the store preferences for order number formatting. | ||
|- | |- | ||
− | + | !sequence | |
|<code>{ "sequence" : 1 }</code><br/> | |<code>{ "sequence" : 1 }</code><br/> | ||
The sequence number of the transaction. | The sequence number of the transaction. | ||
|- | |- | ||
− | + | !amount | |
|<code>{ "amount" : 54.53 }</code><br/> | |<code>{ "amount" : 54.53 }</code><br/> | ||
The value of the transaction. | The value of the transaction. | ||
|- | |- | ||
− | |authorization | + | !fee |
+ | |<code>{ "fee" : 0.55 }</code><br/> | ||
+ | The value of the merchant fee associated with the transaction, if provided by the gateway. | ||
+ | |- | ||
+ | !authorization | ||
|<code>{ "authorization" : "A235467-239934" }</code><br/> | |<code>{ "authorization" : "A235467-239934" }</code><br/> | ||
The authorization code associated with the transaction. | The authorization code associated with the transaction. | ||
|- | |- | ||
− | + | !transaction_id | |
|<code>{ "transaction_id" : "823048203" }</code><br/> | |<code>{ "transaction_id" : "823048203" }</code><br/> | ||
The transaction id that has been returned by the payment gateway. | The transaction id that has been returned by the payment gateway. | ||
|- | |- | ||
− | + | !created_at | |
|<code>{ "created_at" : "2015-10-24T18:26:31Z" }</code><br/> | |<code>{ "created_at" : "2015-10-24T18:26:31Z" }</code><br/> | ||
The date and time when the transaction was created. The timestamp is in ISO 8601 format. | The date and time when the transaction was created. The timestamp is in ISO 8601 format. | ||
|- | |- | ||
− | + | !gateway | |
|<code>{ "gateway" : "Big Bank" }</code><br/> | |<code>{ "gateway" : "Big Bank" }</code><br/> | ||
The name of the payment gateway which processed the transaction. | The name of the payment gateway which processed the transaction. | ||
|- | |- | ||
− | |kind | + | !|kind |
|<code>{ "kind" : "sale" }</code><br/> | |<code>{ "kind" : "sale" }</code><br/> | ||
The kind of transaction.<br/> | The kind of transaction.<br/> | ||
The following values can be returned: '''sale''', '''authorization''', '''capture''', '''void''' and '''refund'''. | The following values can be returned: '''sale''', '''authorization''', '''capture''', '''void''' and '''refund'''. | ||
|- | |- | ||
− | + | !status | |
|<code>{ "status" : "success" }</code><br/> | |<code>{ "status" : "success" }</code><br/> | ||
The status of the transaction.<br/> | The status of the transaction.<br/> | ||
The following values can be returned: '''pending''', '''failure''', '''succes''' and '''error'''. | The following values can be returned: '''pending''', '''failure''', '''succes''' and '''error'''. | ||
|- | |- | ||
− | + | !description | |
|<code>{ "description" : "Additional information about the transaction" }</code><br/> | |<code>{ "description" : "Additional information about the transaction" }</code><br/> | ||
In some cases some additional information may be returned by the payment gateway. | In some cases some additional information may be returned by the payment gateway. | ||
|- | |- | ||
− | + | !source_name | |
|<code>{ "source_name" : "web" }</code><br/> | |<code>{ "source_name" : "web" }</code><br/> | ||
The origin of the transaction. Currently, only '''web''' is returned. | The origin of the transaction. Currently, only '''web''' is returned. | ||
|- | |- | ||
− | + | !currency | |
|<code>{ "currency" : "AUD" }</code><br/> | |<code>{ "currency" : "AUD" }</code><br/> | ||
The currency used for the transaction. | The currency used for the transaction. | ||
|- | |- | ||
− | + | !payment_details | |
|<code>{ "payment_details" : { | |<code>{ "payment_details" : { | ||
"avs_result_code" : null, | "avs_result_code" : null, | ||
Line 113: | Line 112: | ||
==== Optional Parameters ==== | ==== Optional Parameters ==== | ||
− | {| class=" | + | {| class="reference" |
− | + | !limit | |
|Number of results returned. The default is 30, with a maximum of 50 in a single request. | |Number of results returned. The default is 30, with a maximum of 50 in a single request. | ||
|- | |- | ||
− | + | !page | |
|The number of the page to return. The number of results per page is set by the <code>limit</code> parameter. If more results are required, then submit the request again, increasing the page number each time. | |The number of the page to return. The number of results per page is set by the <code>limit</code> parameter. If more results are required, then submit the request again, increasing the page number each time. | ||
|- | |- | ||
− | + | !ids | |
|A comma-separated list of transaction ids. | |A comma-separated list of transaction ids. | ||
|- | |- | ||
− | + | !since_id | |
|Limit the results to only include objects which have an id greater than the given value. | |Limit the results to only include objects which have an id greater than the given value. | ||
|- | |- | ||
− | + | !created_at_min | |
|Return only the transactions created after the given date and time. Use the format "2014-12-31 12:00". | |Return only the transactions created after the given date and time. Use the format "2014-12-31 12:00". | ||
|- | |- | ||
− | + | !created_at_max | |
|Return only the transactions created before the given date and time. Use the format "2014-12-31 12:00". | |Return only the transactions created before the given date and time. Use the format "2014-12-31 12:00". | ||
|- | |- | ||
− | + | !order_id | |
|Return all the transactions belonging to the specified order. | |Return all the transactions belonging to the specified order. | ||
|- | |- | ||
− | + | !fields | |
|A comma-separated list of fields to return in the response. | |A comma-separated list of fields to return in the response. | ||
|} | |} | ||
Line 184: | Line 183: | ||
==== Optional Parameters ==== | ==== Optional Parameters ==== | ||
− | {| class=" | + | {| class="reference" |
− | + | !since_id | |
|Limit the results to only include objects which have an id greater than the given value. | |Limit the results to only include objects which have an id greater than the given value. | ||
|- | |- | ||
− | + | !created_at_min | |
|Return only the transactions created after the given date and time. Use the format "2014-12-31 12:00". | |Return only the transactions created after the given date and time. Use the format "2014-12-31 12:00". | ||
|- | |- | ||
− | + | !created_at_max | |
|Return only the transactions created before the given date and time. Use the format "2014-12-31 12:00". | |Return only the transactions created before the given date and time. Use the format "2014-12-31 12:00". | ||
|- | |- | ||
− | + | !order_id | |
|Return all the transactions belonging to the specified order. | |Return all the transactions belonging to the specified order. | ||
|} | |} | ||
Line 224: | Line 223: | ||
==== Optional Parameters ==== | ==== Optional Parameters ==== | ||
− | {| class=" | + | {| class="reference" |
− | + | !fields | |
|A comma-separated list of fields to return in the response. | |A comma-separated list of fields to return in the response. | ||
|} | |} |
Latest revision as of 16:13, 6 June 2018
The Spiffy Stores API Transaction object represents a transaction that has been applied to an order.
There are five types of transactions that can be applied to an order.
- Sale: The amount of money transferred from the cardholder's account to pay the outstanding order.
- Authorization: This represents the amount which has been reserved against the cardholder's account. No money changes hands until an authorization is captured.
- Capture: This occurs only after an authorization has been approved, and records the actual transfer of funds from the cardholder's account.
- Void: This represents the cancellation of a pending authorization or capture.
- Refund: A full or partial return of captured funds to the cardholder can occur. A refund can only happen after a capture or sale is processed.
Contents
- 1 Transaction Properties
- 2 Endpoints
- 3 Further Reference
Transaction Properties
id | { "id" : 123456789 } A unique numeric identifier for the transaction. This ID is only used with the API interface. |
---|---|
order_id | { "order_id" : 452983 } The internal ID of the associated order. |
order_number | { "order_number" : 1045 } A unique numeric identifier for the order that is used as a reference number for the store owner and customers. This is not the same as the internal ID of the order, which is only used to refer to orders within the API. |
order_name | { "order_name" : "#001045" } This is the order_number, formatted according the the store preferences for order number formatting. |
sequence | { "sequence" : 1 } The sequence number of the transaction. |
amount | { "amount" : 54.53 } The value of the transaction. |
fee | { "fee" : 0.55 } The value of the merchant fee associated with the transaction, if provided by the gateway. |
authorization | { "authorization" : "A235467-239934" } The authorization code associated with the transaction. |
transaction_id | { "transaction_id" : "823048203" } The transaction id that has been returned by the payment gateway. |
created_at | { "created_at" : "2015-10-24T18:26:31Z" } The date and time when the transaction was created. The timestamp is in ISO 8601 format. |
gateway | { "gateway" : "Big Bank" } The name of the payment gateway which processed the transaction. |
kind | { "kind" : "sale" } The kind of transaction. |
status | { "status" : "success" } The status of the transaction. |
description | { "description" : "Additional information about the transaction" } In some cases some additional information may be returned by the payment gateway. |
source_name | { "source_name" : "web" } The origin of the transaction. Currently, only web is returned. |
currency | { "currency" : "AUD" } The currency used for the transaction. |
payment_details | { "payment_details" : {
The following properties are supported:
|
Endpoints
GET /api/orders/ORDER_ID/transactions.json
Return a list of transactions belonging to a specific order. Use the optional parameters to return specific transactions.
GET /api/transactions.json
Return a list of transactions belonging to a store. Use the optional parameters to return specific transactions.
Optional Parameters
limit | Number of results returned. The default is 30, with a maximum of 50 in a single request. |
---|---|
page | The number of the page to return. The number of results per page is set by the limit parameter. If more results are required, then submit the request again, increasing the page number each time.
|
ids | A comma-separated list of transaction ids. |
since_id | Limit the results to only include objects which have an id greater than the given value. |
created_at_min | Return only the transactions created after the given date and time. Use the format "2014-12-31 12:00". |
created_at_max | Return only the transactions created before the given date and time. Use the format "2014-12-31 12:00". |
order_id | Return all the transactions belonging to the specified order. |
fields | A comma-separated list of fields to return in the response. |
Example Request and Response
GET /api/transactions.json HTTP/1.1 200 OK { "transactions": [ { "id": 34169, "order_id": 768969, "sequence": 1, "amount": "123.50", "kind": "sale", "gateway": "bogus", "status": "success", "description": null, "created_at": "2015-08-05T12:59:12-04:00", "authorization": "123456789", "transaction_id": "A3w47983", "currency": "AUD", "source_name": "web" }, ... ] } Examples using filters GET /api/orders/234234/transactions.json?limit=10 GET /api/transactions.json?order_id=2322
GET /api/orders/ORDER_ID/transactions/count.json
Return a count of transactions belonging to an order.
GET /api/transactionss/count.json
Return a count of transactions belonging to a store.
Optional Parameters
since_id | Limit the results to only include objects which have an id greater than the given value. |
---|---|
created_at_min | Return only the transactions created after the given date and time. Use the format "2014-12-31 12:00". |
created_at_max | Return only the transactions created before the given date and time. Use the format "2014-12-31 12:00". |
order_id | Return all the transactions belonging to the specified order. |
Example Request and Response
GET /api/orders/12345/transactions/count.json HTTP/1.1 200 OK { "count": 3 } Examples using filters GET /api/transactions/count.json?order_id=2322
GET /api/orders/ORDER_ID/transactions/TRANSACTION_ID.json
Return a single transaction belonging to an order.
GET /api/transactions/TRANSACTION_ID.json
Return a single transaction belonging to a store.
Optional Parameters
fields | A comma-separated list of fields to return in the response. |
---|
Example Request and Response
GET /api/transactions/443169.json HTTP/1.1 200 OK { "transaction": { "id": 34169, "order_id": 768969, "sequence": 1, "amount": "123.50", "kind": "sale", ... } }