Android™ Stripe: Retrieve a Balance Transaction

Back to Index

Retrieves the balance transaction with the given ID.

Documentation: https://stripe.com/docs/api/curl#balance_transaction_retrieve

CURL Command

curl https://api.stripe.com/v1/balance/history/txn_1BnETJGswQrCoh0XxO2tGYr7 \
   -u STRIPE_SECRET_KEY:

Android™ Example

// Important: Don't forget to include the call to System.loadLibrary
// as shown at the bottom of this code sample.
package com.test;

import android.app.Activity;
import com.chilkatsoft.*;

import android.widget.TextView;
import android.os.Bundle;

public class SimpleActivity extends Activity {

  private static final String TAG = "Chilkat";

  // Called when the activity is first created.
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    CkRest rest = new CkRest();
    boolean success;

    //  URL: https://api.stripe.com/v1/balance/history/txn_1BnETJGswQrCoh0XxO2tGYr7
    boolean bTls = true;
    int port = 443;
    boolean bAutoReconnect = true;
    success = rest.Connect("api.stripe.com",port,bTls,bAutoReconnect);
    if (success != true) {
        Log.i(TAG, "ConnectFailReason: " + String.valueOf(rest.get_ConnectFailReason()));
        Log.i(TAG, rest.lastErrorText());
        return;
        }

    rest.SetAuthBasic("STRIPE_SECRET_KEY","");

    CkStringBuilder sbResponseBody = new CkStringBuilder();
    success = rest.FullRequestNoBodySb("GET","/v1/balance/history/txn_1BnETJGswQrCoh0XxO2tGYr7",sbResponseBody);
    if (success != true) {
        Log.i(TAG, rest.lastErrorText());
        return;
        }

    CkJsonObject jsonResponse = new CkJsonObject();
    jsonResponse.LoadSb(sbResponseBody);

    String id;
    String object;
    int amount;
    int available_on;
    int created;
    String currency;
    boolean description;
    boolean exchange_rate;
    int fee;
    int net;
    String source;
    String status;
    String type;
    int i;
    int count_i;

    id = jsonResponse.stringOf("id");
    object = jsonResponse.stringOf("object");
    amount = jsonResponse.IntOf("amount");
    available_on = jsonResponse.IntOf("available_on");
    created = jsonResponse.IntOf("created");
    currency = jsonResponse.stringOf("currency");
    description = jsonResponse.IsNullOf("description");
    exchange_rate = jsonResponse.IsNullOf("exchange_rate");
    fee = jsonResponse.IntOf("fee");
    net = jsonResponse.IntOf("net");
    source = jsonResponse.stringOf("source");
    status = jsonResponse.stringOf("status");
    type = jsonResponse.stringOf("type");
    i = 0;
    count_i = jsonResponse.SizeOfArray("fee_details");
    while (i < count_i) {
        jsonResponse.put_I(i);
        i = i + 1;
        }


  }

  static {
      System.loadLibrary("chilkat");

      // Note: If the incorrect library name is passed to System.loadLibrary,
      // then you will see the following error message at application startup:
      //"The application <your-application-name> has stopped unexpectedly. Please try again."
  }
}

Sample JSON Response Body

{
  "id": "txn_1BnETJGswQrCoh0XxO2tGYr7",
  "object": "balance_transaction",
  "amount": 100,
  "available_on": 1516662781,
  "created": 1516662781,
  "currency": "usd",
  "description": null,
  "exchange_rate": null,
  "fee": 0,
  "fee_details": [
  ],
  "net": 100,
  "source": "ch_1BnETJGswQrCoh0XTs0EERBj",
  "status": "pending",
  "type": "charge"
}