Balance API
Balance API สามารถใช้เพื่อเรียกดูยอดเงินทั้งหมดในบัญชีผู้ใช้โอมิเซะ จำนวนเงินที่แสดงจะอยู่ในหน่วยย่อยที่สุดของสกุลเงินนั้นๆ ตัวอย่างเช่น สกุลเงินบาทจะแสดงเป็นสตางค์
Attributes
Name | Type | Description |
---|---|---|
object | string | The string |
livemode | boolean | Whether this is a live ( |
location | string | API path to retrieve the current |
created_at | datetime | UTC datetime of balance creation in ISO 8601 format ( |
currency | currency | Currency for balance as three-letter ISO 4217 code. |
reserve | integer | Amount reserved. |
total | integer | Total balance after deducted fees. |
transferable | integer | Amount available to be transferred. |
Example
-
JSON Response
{ "object": "balance", "livemode": false, "location": "/balance", "currency": "THB", "total": 0, "transferable": 0, "reserve": 0, "created_at": "2019-12-31T12:59:59Z" }
Retrieve the balance
- GET https://api.omise.co/balanceReturns the current balance of the account.
Example
-
Retrieve the balance
- curl
- php
- node.js
- ruby
- C#
- java
- python
- go
- elixir
curl https://api.omise.co/balance \ -u $OMISE_SECRET_KEY:
<?php $balance = OmiseBalance::retrieve(); // After retrieving it, the balance can be refreshed: $balance->reload();
omise.balance.retrieve(function(error, balance) { /* Response. */ });
require "omise" Omise.secret_api_key = "skey_test_4xs8breq3htbkj03d2x" balance = Omise::Balance.retrieve # After retrieving it, the balance can be refreshed: balance.reload
var balance = await Client.Balance.Get(); Console.WriteLine($"available balance: {balance.Available}"); Console.WriteLine($"total balance: {balance.Total}");
Request<Balance> request = new Balance.GetRequestBuilder().build(); Balance balance = client().sendRequest(request); System.out.printf("Transferable balance: %d", balance.getTransferable());
import omise omise.api_secret = "skey_test_no1t4tnemucod0e51mo" balance = omise.Balance.retrieve() balance.total
balance := &omise.Balance{} if e := client.Do(balance, &operations.RetrieveBalance{}); e != nil { log.Fatalln(e) } log.Println("available balance: ", balance.Available)
Omise.configure(secret_key: "skey_test_4xs8breq3htbkj03d2x") Omise.Balance.retrieve