Rozary pay payment Gateway implementation on your app.

If you are going to make an live payment app then you have to sing up in Rozary pay and build a live tokon for your app here i am using test tokon for it this are the following codes you have to implement to your app

1. In build.gradle(module.app)

implementation 'com.razorpay:checkout:1.5.13'

2.In progroun rules.pro past following codes.

-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;}
-keepattributes JavascriptInterface
-keepattributes *Annotation*

-dontwarn com.razorpay.**
-keep class com.razorpay.** {*;}

-optimizations !method/inlining/*

-keepclasseswithmembers class * {
  public void onPayment*(...);}

3. In manifest file past this meta data

<meta-data    android:name="com.razorpay.ApiKey"    android:value="rzp_test_4xWs1d6clD1zFz" />

4. Create your xml layout and create a button and a edit text to enter the amount to 
pay an past the following codes to it

final Activity activity = this;
 final   Checkout checkout = new Checkout();
 try {
     JSONObject options = new JSONObject();
     options.put("name", "Merchant Name");//Your name
     options.put("description", "Reference No. #123456");// Ref no if you want to give
     options.put("image", "https://s3.amazonaws.com/rzp-mobile/images/rzp.png"); 
     options.put("currency", "INR"); //currency you want to take payment.

     String payment = ed.getText().toString();
     Double total = Double.parseDouble(payment);
     total= total*100; // payment on r pay takes as paisa only     options.put("amount", total);
     JSONObject prefill = new JSONObject();
     // you can take users email id or phone as you wish     prefill.put("email", "if you want to take information from user");
     prefill.put("contact", "user phone no");
     options.put ("prefill", prefill);
     checkout.open(activity, options);

 } catch(Exception e) {
     Log.e(TAG, "Error in starting Razorpay Checkout", e);
 }

//if you want to show any on successful note to your user then

@Overridepublic void onPaymentSuccess(String s)
{
    //you can do as you wish    Toast.makeText(MainActivity.this,"Succesfull",Toast.LENGTH_SHORT).show();

}

  

Comments

Popular posts from this blog

How to load image view from your android to your android studio app

About Us

Best 10 places to visit in punjab