No description or website provided.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 1edef67 Jul 28, 2018


ZarinPal In App Purchase Android SDK

ZarinPal Payment Requeset SDK on Android Platforms Simply Request to ZarinPal IPG and Callback Handling

New Options:

  • Support ZarinGate in 0.0.4 Version
  • Implemented SandBox Payment in 0.0.8 Version

Note: This version is open source then you can open pull request and we check it, If project need to your change, We will certainly merge it.

  • Compile ZarinPal In App Purchase SDK:
   compile 'com.zarinpal:purchase:0.0.8-beta'
  • Internet Access Permission:
    <uses-permission android:name="android.permission.INTERNET"/>
  • Set Your Application Scheme in Actvity for Handling Callback:
        <action android:name="android.intent.action.VIEW"/>

         <category android:name="android.intent.category.DEFAULT"/>
         <category android:name="android.intent.category.BROWSABLE"/>

         <data android:scheme="<YOUR-APP-SCHEME>"/>

###Example For Payment Request:

       ZarinPal       purchase = ZarinPal.getPurchase(this);
       PaymentRequest payment  = ZarinPal.getPaymentRequest();
       //If you will test on our sandbox, you can use it:
       PaymentRequest payment  = ZarinPal.getSandboxPaymentRequest();

       payment.setDescription("In App Purchase Test SDK");
       payment.setCallbackURL("yourapp://app");     /* Your App Scheme */
       payment.setMobile("09355106005");            /* Optional Parameters */
       payment.setEmail("");     /* Optional Parameters */

       purchase.startPayment(payment, new OnCallbackRequestPaymentListener() {
           public void onCallbackResultPaymentRequest(int status, String authority, Uri paymentGatewayUri, Intent intent) {

               if (status == 100) {
                   When Status is 100 Open Zarinpal PG on Browser
               } else {
                   Toast.makeText(getApplicationContext(), "Your Payment Failure :(", Toast.LENGTH_LONG).show();


###Example For Callback Handler:

        * When User Return to Application From IPG on Browser
        Uri data = getIntent().getData();
       ZarinPal.getPurchase(this).verificationPayment(data, new OnCallbackVerificationPaymentListener() {
           public void onCallbackResultVerificationPayment(boolean isPaymentSuccess, String refID, PaymentRequest paymentRequest) {

               if (isPaymentSuccess) {
                   /* When Payment Request is Success :) */
                   String message = "Your Payment is Success :) " + refID;
                   Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
               } else {
                   /* When Payment Request is Failure :) */
                   String message = "Your Payment is Failure :(";
                   Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();