Switch branches/tags
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
Bin
Sample
SampleAPK
README.md
V1.1.0Document

README.md

PIQO Android SDK

Public specifications, samples and documentation on PIQO Android SDK.

##How can I use PIQO Android SDK?(Quick Tutorial) To use PIQO Android SDK you can download the .aar file from Bin folder. Refer to the sample folder for usage.

##How can I use PIQO Android SDK?(More Thorough Tutorial) First, you need to have an existing android application. You can add this line to your dependencies in build file:

compile 'ir.appson:PIQOlibrary:+'

Now you have to add your AppId to AndroidManifest.xml file inside <application/> tag:

<manifest>
<application>
...
<meta-data android:name="Appson-Identity-App-Id" android:value="MY_APP_ID" />
</application>
...
</manifest>

Replace MY_APP_ID with your ApplicationId. Then you need to call Appson.init method in onCreate() method of your activity and pass a context to this method:

import ir.appson.identitylibrary.Appson;
import ir.appson.identitylibrary.Interface.InfoListener;
import ir.appson.identitylibrary.Payment;
public class MainActivity extends Activity{
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Appson.init(MainActivity.this);
        }
}

Now you can use Payment.sohwInfo method to show payment process to the user. You have to pass a InfoListener object to Payment.showInfo() method. InfoListener has three methods:

  • onSuccess(String token): Payment successful.
  • onFailed(String exceptionCode) : Payment Failed
  • onUserCancelled(): The user has cancelled the Payment.

Here is a sample of InfoListener and Payment.showInfo() usage:

        Payment.showInfo(new InfoListener() {
                    @Override
                    public void onSuccess(String token) {
                        Toast.makeText(MainActivity.this, token, Toast.LENGTH_SHORT).show();
                    }

                    @Override
                    public void onFailed(String exceptionCode) {
                        Toast.makeText(MainActivity.this, exceptionCode, Toast.LENGTH_SHORT).show();
                    }

                    @Override
                    public void onUserCancelled() {

                    }
                },productCode , productItemCode, privateKey);}

Replace productCode, productItemCode and privateKey with your product info which defined in the PIQO developer panel.

A sample project can be found in sample folder.