Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Square for Android API
branch: master

This branch is even with jonthewayne:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples/twocents
external
javadoc
src/com/squareup/android
.gitignore
LICENSE
README.md
android-api.iml
android-api.ipr
android-api.iws
build.sh

README.md

Square for Android API

Square enables Android users to accept cash and card payments, and email receipts. The Square for Android API enables Android-based point-of-sale applications to accept payments using Square.

Rather than settle for traditional, expensive one-size-fits-all point-of-sale solutions, the Square for Android API enables programmers to easily create custom-fit applications. Examples include:

  • A taxi cab meter that tracks your location using the GPS and computes a price based on the distance travelled.
  • A bar app that enables bartenders to track tabs based on seating location, quickly enter drink combinations, and square up when the customer leaves.
  • A donation application that enables a charity to collect contact information from the benefactor.

The current release v0.9 is a preview release and is subject to incompatible changes. Your feedback will help ensure a solid 1.0 release. Square v1.1.1, available through the Android Market, supports this version of the API.

Installation

Download square-android-api-0.9.zip. Extract square-android-api-0.9.zip to your application's libs directory.

Usage

See the Square for Android API documentation. Start with the Square class.

The current version of Square supports only one line item. Future versions of Square may support more; the API is designed with this in mind.

Example

The following activity check whether Square is installed. If Square is missing, the activity navigates to Square in the Market so the user can install it. Once Square is installed, the activity starts Square and fills in the price (2 cents) and description ("Advice").

import android.app.Activity;
import android.os.Bundle;

public class TwoCents extends Activity {
  @Override public void onCreate(Bundle state) {
    super.onCreate(state);

    Square square = new Square(this);
    if (square.installationStatus()
        != Square.InstallationStatus.AVAILABLE) {
      square.requestInstallation();
    } else {
      LineItem advice = new LineItem.Builder()
          .price(2, Currency.USD) // 2 cents
          .description("Advice")
          .build();
      square.squareUp(Bill.containing(advice));
    }
  }
}

For a complete example, see TwoCents in the examples directory.

Mailing List

To get help and otherwise discuss the Square for Android API, please join our mailing list, square-android-api@googlegroups.com.

License

This project is licensed under the Apache License, Version 2.0.

Something went wrong with that request. Please try again.