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

Transaction properties

amount

"amount":180000.0000

The amount of money that the transaction was for.

authorization

"authorization":null

The authorization code associated with the transaction.

created_at

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

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

device_id

"device_id":null

The unique identifier for the device.

gateway

"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

"id":1095862541

A unique numeric identifier for the transaction.

kind

"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

"order_id":1235924702"

A unique numeric identifier for the order.

receipt

"receipt":null

transaction receipt

status

"status":"success"

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

test

"test":false

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

user_id

"user_id":null

The unique identifier for the user.

location_id

"location_id":null

The unique identifier of product return location.

currency

"currency":"VND"

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

is_cod_gateway

"is_cod_gateway":false

It is true when gateway payment is COD

Endpoints

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

View response

				

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 } ] }
GET https://apis.haravan.com/com/orders/{order_id}/transactions/{transation_id}.json 

Retrieve a transaction of order by specifying the ID.

Retrieves single transaction of order by ID.

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

View response

				

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 } }
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"
    }
}

View response

                

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 } }