Sachin Harne
Sachin Harne

Reputation: 177

How to set RazorPay key dynamically?

I want to set the Razorpay key dynamically.

Can anyone help me with this ?

I have tried with

implementation 'com.razorpay:checkout:1.5.13'

Checkout checkout = new Checkout();
checkout.setKeyID(MY_KEY_HERE);

Still it gives me error to set RazorPay API key in manifest.

Later i tried with custom by setting .aar in libs folder also and tried with

implementation project(name: "razorpay-android-3.8.8", ext: 'aar')

Then it gave me error while building gradle as:

ERROR: Required keys [path] are missing from map {name=razorpay-android-3.8.8, ext=aar}.

Upvotes: 2

Views: 2295

Answers (3)

Arshdeep Singh
Arshdeep Singh

Reputation: 61

Replace

implementation project(name: "razorpay-android-3.8.8", ext: 'aar')

with

implementation(name:'razorpay-android-3.8.8', ext: 'aar')

Then this should work fine.

Upvotes: 0

Sachin Harne
Sachin Harne

Reputation: 177

Issue resolved with this.

Steps followed:

Checkout.preload(PaymentActivity.this);
Checkout checkout = new Checkout();
checkout.setKeyID(MY_KEY_HERE);


final Activity activity = this;

checkout.open(activity, options);

Upvotes: 2

Praveen
Praveen

Reputation: 81

Not sure what might be missing for the 1st issues. but for your second error, you can fix this by adding the .arr file manually to the lib folder. Download the latest SDK from the below link and add the SDK to your lib folder manually http://rzp-mobile.s3.amazonaws.com/customui/razorpay-android-3.8.8.aar after adding the SDK to the lib folder add the below dependencies to the build.gradel file dependencies { implementation(name: "razorpay-android-3.8.8", ext: 'aar') }

If needed you can refer to the sample test app https://github.com/razorpay/razorpay-android-custom-sample-app

Upvotes: 0

Related Questions