Transaction API
Transaction API ใช้เพื่อเรียกข้อมูลรายการที่เกิดขึ้นในบัญชีผู้ใช้โอมิเซะ “รายการ” จะเกิดขึ้นก็ต่อเมื่อการทำธุรกรรมระหว่างผู้ซื้อและผู้ขายสำเร็จ ตัวอย่างเช่นรายการรับชำระเงินที่ดำเนินการสำเร็จจะเกิดเป็นหนึ่งรายการจัดอยู่ในหมวด “credit”
Attributes
Name | Type | Description |
---|---|---|
object | string | The string |
id | string | The transaction identifier matching |
livemode | boolean | Whether this is a live ( |
location | string | API path to retrieve the current |
amount | integer | Transaction amount in smallest unit of transaction currency. |
created_at | string | UTC datetime of transaction creation in ISO 8601 format ( |
currency | string | Currency for transaction as three-letter ISO 4217 code. |
direction | string | One of |
key | string | Transaction detail (e.g. |
origin | string | Origin for transaction. One of charge, refund, transfer, dispute, or receipt (identifier). |
transferable_at | string | UTC datetime of when transaction amount becomes part of available balance in ISO 8601 format ( |
Example
-
JSON Response
{ "object": "transaction", "id": "trxn_test_no1t4tnemucod0e51mo", "livemode": false, "currency": "THB", "amount": 11862, "location": "/transactions/trxn_test_no1t4tnemucod0e51mo", "direction": "credit", "key": "charge.captured.net", "origin": "chrg_test_no1t4tnemucod0e51mo", "transferable_at": "2019-12-31T12:59:59Z", "created_at": "2019-12-31T12:59:59Z" }
List transactions
- GET https://api.omise.co/transactionsReturns a list of transactions belonging to your account.
Request Parameters
Name | Type | Description |
---|---|---|
from | string | (optional, default: |
limit | integer | (optional, default: |
offset | integer | (optional, default: |
order | string | (optional, default: |
to | string | (optional) Latest UTC datetime for returned records in ISO 8601 format ( |
Example
-
List all transactions
- curl
- php
- node.js
- ruby
- C#
- java
- python
- go
- elixir
curl https://api.omise.co/transactions \ -u $OMISE_SECRET_KEY:
<?php $transactions = OmiseTransaction::retrieve();
const omise = require('omise')({ secretKey: 'skey_test_no1t4tnemucod0e51mo', }); const customer = await omise.transactions.list(); console.log(customer);
require "omise" Omise.secret_api_key = "skey_test_4xs8breq3htbkj03d2x" transactions = Omise::Transaction.retrieve
var transactions = await Client.Transactions.GetList(order: Ordering.ReverseChronological); Console.WriteLine($"total transactions to-date: {transactions.Total}");
Request<ScopedList<Transaction>> request = new Transaction.ListRequestBuilder().build(); ScopedList<Transaction> transactions = client().sendRequest(request); System.out.printf("Total no. of transactions: %d", transactions.getTotal());
import omise omise.api_secret = "skey_test_no1t4tnemucod0e51mo" transactions = omise.Transaction.retrieve()
client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.TransactionList{} err := client.Do(result, &operations.ListTransactions{ operations.List{ Limit: 100, From: time.Now().Add(-1 * time.Hour), }, }) if err != nil { log.Fatalln(err) } log.Println(result)
Omise.configure(secret_key: "skey_test_4xs8breq3htbkj03d2x") Omise.Transaction.list
Retrieve a transaction
- GET https://api.omise.co/transactions/{id}Returns the transaction matching :id
.
Example
-
Retrieve a transaction
- curl
- php
- node.js
- ruby
- C#
- java
- python
- go
- elixir
curl https://api.omise.co/transactions/trxn_test_5fzo4nqrnop03djdde1 \ -u $OMISE_SECRET_KEY:
<?php $transactions = OmiseTransaction::retrieve('trxn_test_4xuy2z4w5vmvq4x5pfs');
const omise = require('omise')({ secretKey: 'skey_test_no1t4tnemucod0e51mo', }); const customer = await omise.transactions.retrieve('trxn_test_no1t4tnemucod0e51mo'); console.log(customer);
require "omise" Omise.secret_api_key = "skey_test_4xs8breq3htbkj03d2x" transaction = Omise::Transaction.retrieve("trxn_test_4xuy2z4w5vmvq4x5pfs")
var transactionId = "trxn_test_58fmj4hion95mndc96d"; var transaction = await Client.Transactions.Get(transactionId); Console.WriteLine($"transaction amount: {transaction.Amount}");
Request<Transaction> request = new Transaction.GetRequestBuilder("trxn_test_4xuy2z4w5vmvq4x5pfs").build(); Transaction transaction = client().sendRequest(request); System.out.printf("Transaction amount: %d", transaction.getAmount());
import omise omise.api_secret = "skey_test_no1t4tnemucod0e51mo" transaction = omise.Transaction.retrieve("trxn_test_no1t4tnemucod0e51mo")
client, _ := omise.NewClient( "pkey_test_5no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.Transaction{} err := client.Do(result, &operations.RetrieveTransaction{ TransactionID: "trxn_test_no1t4tnemucod0e51mo", }) if err != nil { log.Fatalln(err) } log.Println(result)
Omise.configure(secret_key: "skey_test_4xs8breq3htbkj03d2x") Omise.Transaction.retrieve("trxn_test_4xuy2z4w5vmvq4x5pfs")