The Update a Transaction service changes the details for a given transaction.
{base_url}/transaction/{id}
PUT
None
Path parameters:
Name | Type | Mandatory? | Constraints | Notes |
---|---|---|---|---|
id | int | yes | Internal unique ID assigned by the system. |
Name | Type | Mandatory? | Constraints | Notes |
---|---|---|---|---|
transaction_id | string | yes | - | Unique ID. |
user_id | string | yes | - | The user who made the purchase. |
amazon_id | string | yes | - | The user’s Amazon account ID. |
product_id | string | yes | - | Product catalog number provided by the manufacturer. |
card_id | string | yes | - | Unique ID of the payment card used for the purchase. |
amount | float | yes | - | - |
status | string | yes | Must be one of: {COMPLETED, REJECTED} | - |
balance_check | boolean | yes | Must be one of: {TRUE, FALSE} | Did the card have enough money to pay for the purchase? |
message | string | no | - | - |
A successful request returns the data you submitted plus the transaction’s unique id
:
Name | Type | Mandatory? | Constraints | Notes |
---|---|---|---|---|
id | int | yes | - | Unique internal ID generated by the system. |
transaction_id | string | yes | - | Unique ID generated by the system. |
user_id | string | yes | - | The user who made the purchase. |
amazon_id | string | yes | - | The user’s Amazon account ID. |
product_id | string | yes | - | Product catalog number provided by the manufacturer. |
card_id | string | yes | - | Unique ID of the payment card used for the purchase. |
amount | float | yes | - | - |
status | string | yes | Must be one of: {COMPLETED, REJECTED} | - |
balance_check | boolean | yes | Must be one of: {TRUE, FALSE} | Did the card have enough money to pay for the purchase? |
message | string | no | - | - |
Code | Description | Notes |
---|---|---|
200 | OK | - |
The following example updates the message
for transaction id
5:
Request:
curl -XPUT -H "Content-type: application/json" -d ' {
"transaction_id": "txn005",
"user_id": "user004",
"amazon_id": "amz98765",
"product_id": "hanes-underwear-001",
"card_id": "hanes-gc-001",
"amount": 15.99,
"status": "Completed",
"balance_check": true,
"message": "Applied 10% rebate to transaction."
}' 'http://localhost:3000/transactions/5'
Response:
{
"transaction_id": "txn005",
"user_id": "user004",
"amazon_id": "amz98765",
"product_id": "hanes-underwear-001",
"card_id": "hanes-gc-001",
"amount": 15.99,
"status": "Completed",
"balance_check": true,
"message": "Applied 10% rebate to transaction.",
"id": 5
}