Skip to main content

Transaction

Version: 1.0

Transactions are created for every order that results in an exchange of money.

There are five types of transactions:

  • Pending: Order wait for pay.
  • Authorization: represents an amount reserved against the cardholder's funding source. Money does not change hands until authorization is captured.
  • Sale: an authorization and capture performed together in a single step.
  • Capture: transfer of the money that was reserved during the authorization stage
  • Void: cancellation of a pending authorization or capture.
  • Refund: a partial or full return of captured funds to the cardholder. A refund can only happen after capture is processed.

Authenticated access scopes: com.read_orders, com.write_orders

What you can do with Transaction

The Haravan API lets you do the following with the Transaction resource.

Transaction properties


amount : number

"amount": 180000.0000

The amount of money that the transaction was for.

authorization : string

"authorization": null

The authorization code associated with the transaction.

created_at : string

"created_at": "2021-05-13T07:29:20.1Z"

The date and time (ISO 8601 format) when the transaction was created.

device_id : number

"device_id": null

The unique identifier for the device.

gateway : string

"gateway": "Thanh toán khi giao hàng (COD)"

The name of the gateway the transaction was issued through. A list of gateways can be found on haravan's Payment Gateway page.

id : number

"id": 1095862541

A unique numeric identifier for the transaction.

kind : string

"kind": "Capture"

The kind of transaction:

  • Pending: Order wait for pay.
  • Authorization: Money that the customer has agreed to pay. Authorization period lasts for up to 7 to 30 days (depending on your payment service) while a store awaits for a customer's capture.
  • Capture: Transfer of money that was reserved during the authorization of a shop.
  • Sale: The combination of authorization and capture, performed in one single step.
  • Void: The cancellation of a pending authorization or capture.
  • Refund: The partial or full return of the captured money to the customer.

order_id : number

"order_id": 1235924702

A unique numeric identifier for the order.

receipt : string

"receipt": null

Transaction receipt.

status : string

"status": "success"

The status of the transaction. Valid values are: pending, failure, success or error.

test : boolean

"test": false

The option to use the transaction for testing purposes. Valid values are "true" or "false".

user_id : number

"user_id": null

The unique identifier for the user.

location_id : number

"location_id": null

The unique identifier of product return location.

currency : string

"currency": "VND"

The three letter code (ISO 4217) for the currency used for the payment.

is_cod_gateway : boolean

"is_cod_gateway": false

It is true when gateway payment is COD

Retrieves a list transactions of order.

GET
https://apis.haravan.com/com/orders/{order_id}/transactions.json

Retrieves a list all transaction of order. You can filter resources by params.


fields

comma-separated list of fields to include in the response.


Retrieve all transation.

  • GET https://apis.haravan.com/com/orders/1235924702/transactions.json
Details

HTTP/1.1 200 OK
{
"transactions": [
{
"amount": 180000.0000,
"authorization": null,
"created_at": "2021-10-21T09:53:52.876Z",
"device_id": null,
"gateway": "Thanh toán khi giao hàng (COD)",
"id": 1095862541,
"kind": "Pending",
"order_id": 1235924702,
"receipt": null,
"status": "success",
"test": false,
"user_id": 0,
"location_id": 991324,
"payment_details": null,
"parent_id": null,
"currency": "VND",
"haravan_transaction_id": null,
"external_transaction_id": null,
"send_email": false,
"is_cod_gateway": false
}
]
}

Retrieves single transaction of the order.

GET
https://apis.haravan.com/com/orders/{order_id}/transactions/{transation_id}.json

Retrieves single transaction of order by ID.

  • GET https://apis.haravan.com/com/orders/1235924702/transactions/1095862541.json
Details

HTTP/1.1 200 OK
{
"transaction": {
"amount": 180000.0000,
"authorization": null,
"created_at": "2021-10-21T09:53:52.876Z",
"device_id": null,
"gateway": "Thanh toán khi giao hàng (COD)",
"id": 1095862541,
"kind": "Pending",
"order_id": 1235924702,
"receipt": null,
"status": "success",
"test": false,
"user_id": 0,
"location_id": 991324,
"payment_details": null,
"parent_id": null,
"currency": "VND",
"haravan_transaction_id": null,
"external_transaction_id": null,
"send_email": false,
"is_cod_gateway": false
}
}

Create a new transaction for an existing order.

POST
https://apis.haravan.com/com/orders/{order_id}/transactions.json

Create a transation for an existing Order.


amount

The amount of money that the transaction was for.


kind

The kind of transaction:

  • Pending: Order wait for pay.
  • Authorization: Money that the customer has agreed to pay. Authorization period lasts for up to 7 to 30 days (depending on your payment service) while a store awaits for a customer's capture.
  • Capture: Transfer of money that was reserved during the authorization of a shop.
  • Sale: The combination of authorization and capture, performed in one single step.
  • Void: The cancellation of a pending authorization or capture.
  • Refund: The partial or full return of the captured money to the customer.

Create a new transaction for an order.

  • POST https://apis.haravan.com/com/orders/1235924702/transactions.json
{
"transaction": {
"amount": 100000,
"kind": "Capture"
}
}
Details

HTTP/1.1 201 Created

{
"transaction": {
"amount": 100000.0,
"authorization": null,
"created_at": "2021-11-05T08:30:43.2513479Z",
"device_id": null,
"gateway": "Thanh toán khi giao hàng (COD)",
"id": 1097603368,
"kind": "Capture",
"order_id": 1235924702,
"receipt": null,
"status": "success",
"test": false,
"user_id": 200000792911,
"location_id": 991324,
"payment_details": null,
"parent_id": 1095862541,
"currency": "VND",
"haravan_transaction_id": null,
"external_transaction_id": "",
"send_email": false,
"is_cod_gateway": false
}
}