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 |
at | string | The account balance at a certain time. For example, if the balance is 1000, with the |
created_at | string | UTC datetime of balance creation in ISO 8601 format ( |
currency | string | 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();
const omise = require('omise')({ secretKey: 'skey_test_no1t4tnemucod0e51mo', }); const balance = await omise.balance.retrieve(); console.log(balance);
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
client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.Balance{} err := client.Do(result, &operations.RetrieveBalance{}) if err != nil { log.Fatalln(err) } log.Println(result)
Omise.configure(secret_key: "skey_test_4xs8breq3htbkj03d2x") Omise.Balance.retrieve