GithubHelp home page GithubHelp logo

razorpay / razorpay-java Goto Github PK

View Code? Open in Web Editor NEW
49.0 188.0 63.0 839 KB

Razorpay Java SDK

Home Page: https://mvnrepository.com/artifact/com.razorpay/razorpay-java

License: MIT License

Java 100.00%

razorpay-java's Introduction

Razorpay Java SDK

Official java bindings for the Razorpay API.

Documentation

Documentation of Razorpay's API and their usage is available at https://docs.razorpay.com

Requirements

Java 1.8 or later

Mock Tests Support till Java 1.8

Installation

Maven users

Add this dependency to your project's POM:

<dependency>
 <groupId>com.razorpay</groupId>
 <artifactId>razorpay-java</artifactId>
 <version>1.4.5</version>
</dependency>

Gradle users

Add this dependency to your project's build file:

implementation "com.razorpay:razorpay-java:1.4.5"

Usage

RazorpayClient can be instantiated via two ways:

Using Private Auth

Instantiate RazorpayClient with key_id & key_secret. You can obtain the keys from the dashboard app https://dashboard.razorpay.com/#/app/keys

// Initialize client
RazorpayClient instance = new RazorpayClient("key_id", "key_secret");
  • Add custom headers to request (optional)
Map<String, String> headers = new HashMap<String, String>();
razorpayClient.addHeaders(headers);

Using Access Token

Instantiate RazorpayClient with access_token. The access_token can be obtained only in case if you are a platform partner. For more information, refer page - https://razorpay.com/docs/partners/platform/.

// Initialize client
RazorpayClient instance = new RazorpayClient("access_token");
  • Add custom headers to request (optional)
Map<String, String> headers = new HashMap<String, String>();
razorpayClient.addHeaders(headers);

Supported Resources


  • Make custom requests

You can make custom API requests using clients. For example, here is how to make custom request to /payments/path endpoint.

Entity response = razorpayClient.Payments.post("path", JSONObject requestBody);

razorpay-java's People

Contributors

ankit-rzp avatar ankitdas13 avatar archit-kumar avatar bhavyay avatar chandansunag avatar dependabot-preview[bot] avatar ersinghlovepreet avatar harman28 avatar hobbes09 avatar javeeth avatar jitendra-1217 avatar mb-14 avatar ndhaka007 avatar prem-razorpay avatar riagarg5 avatar ritesh-commits avatar shwatang avatar swati31196 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

razorpay-java's Issues

razorpay-java should honor DNS TTL

The java SDK does not honor the DNS TTL set on api.razorpay.com.

As a result changes in DNS do not take effect fast enough causing potential issues for merchants using it.

Unable to Make Test Payment Showing this error??

E/com.razorpay.checkout: Webview JS Error: Uncaught ReferenceError: otpPermissionCallback is not defined
2021-10-07 15:09:31.493 22413-22413/com.tanishq.creditscrore I/chromium: [INFO:CONSOLE(1)] "Uncaught ReferenceError: otpPermissionCallback is not defined", source: https://api.razorpay.com/v1/checkout/public?version=1.6.12&library=checkoutjs&platform=android (1)
2021-10-07 15:09:31.498 22413-22413/com.tanishq.creditscrore E/ActivityThread: Activity com.razorpay.CheckoutActivity has leaked IntentReceiver com.razorpay.AutoReadOtpHelper@5ba677a that was originally registered here. Are you missing a call to unregisterReceiver()?
android.app.IntentReceiverLeaked: Activity com.razorpay.CheckoutActivity has leaked IntentReceiver com.razorpay.AutoReadOtpHelper@5ba677a that was originally registered here. Are you missing a call to unregisterReceiver()?
at android.app.LoadedApk$ReceiverDispatcher.(LoadedApk.java:1602)
at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:1378)
at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1624)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1590)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1578)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:679)
at com.razorpay.CheckoutPresenterImpl.startSmsRetrieverForSavedCardsOTP(CheckoutPresenterImpl.java:828)
at com.razorpay.CheckoutPresenterImpl.onLoad(CheckoutPresenterImpl.java:819)
at com.razorpay.l__d$.secure(CheckoutBridge.java:27)
at com.razorpay.CheckoutPresenterImpl.executeWebViewCallback(CheckoutPresenterImpl.java:1257)
at com.razorpay.CheckoutPresenterImpl.access$700(CheckoutPresenterImpl.java:49)
at com.razorpay.z$_w$.run(CheckoutPresenterImpl.java:1243)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:236)
at android.app.ActivityThread.main(ActivityThread.java:8019)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:600)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)

Cannot build on API 31

The exported flag that is used to tell the system whether the activity is exported and accessible for deep-links, etc. Since the release of API 31 (Android 12), this flag needs to been explicitly written in the AndroidManifest or the build will fail.

Json library vulnerabilities warning

I am getting vulnerability warnings in Razorpay java sdk because of the org.json library version used in this repository. If it is possible please change the org.json library version.
image

Fetch tokens is not working.

throwing com.razorpay.RazorpayException: BAD_REQUEST_ERROR:The requested URL was not found on the server.

while I am fetching tokens.

Fetching Bank Transfer with latest SDK fails

I am using Razorpay Java SDK version 1.3.8 and call to

razorpayClient.Payments.fetchBankTransfers

simply fails, on debugging, came to know that the SDK is not able to parse the response.

Create Plan not working

Plan result = razorpayClient.Plans.create(request);

com.razorpay.RazorpayException: BAD_REQUEST_ERROR:The requested URL was not found on the server.
at com.razorpay.ApiClient.throwException(ApiClient.java:174)
at com.razorpay.ApiClient.processResponse(ApiClient.java:119)
at com.razorpay.ApiClient.post(ApiClient.java:41)
at com.razorpay.PlanClient.post(PlanClient.java:7)
at com.razorpay.PlanClient.create(PlanClient.java:14)

Intent Filter leaked in Razorpay getting

Activity com.razorpay.CheckoutActivity has leaked IntentReceiver com.razorpay.AutoReadOtpHelper@c42c9c4 that was originally registered here. Are you missing a call to unregisterReceiver()?
android.app.IntentReceiverLeaked: Activity com.razorpay.CheckoutActivity has leaked IntentReceiver com.razorpay.AutoReadOtpHelper@c42c9c4 that was originally registered here. Are you missing a call to unregisterReceiver()?
at android.app.LoadedApk$ReceiverDispatcher.(LoadedApk.java:1876)
at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:1595)
at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1827)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1793)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1781)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:743)
at com.razorpay.CheckoutPresenterImpl.startSmsRetrieverForSavedCardsOTP(CheckoutPresenterImpl.java:916)
at com.razorpay.CheckoutPresenterImpl.onSubmit(CheckoutPresenterImpl.java:1056)
at com.razorpay.O__Y_.secure(CheckoutBridge.java:158)
at com.razorpay.CheckoutPresenterImpl.executeWebViewCallback(CheckoutPresenterImpl.java:1370)
at com.razorpay.CheckoutPresenterImpl.access$700(CheckoutPresenterImpl.java:55)
at com.razorpay.b$f.run(CheckoutPresenterImpl.java:1355)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

Why I am getting this issue again again

E/Rzp: onPaymentError: {"code":"BAD_REQUEST_ERROR","description":"Your payment has been declined as the order is invalid. To pay successfully try initiating the payment again from merchant checkout.","source":"business","step":"payment_initiation","reason":"input_validation_failed","metadata":{"order_id":"KhqK0GLtX9O9ni"}} @ankitdas13

Uncaught ReferenceError: otpPermissionCallback is not defined

This is error I get in my log when I start the Razorpay payments:

> 2021-04-14 16:23:24.191 E/com.razorpay.checkout: Webview JS Error: Uncaught ReferenceError: otpPermissionCallback is not defined
> 2021-04-14 16:23:24.191 I/chromium: [INFO:CONSOLE(1)] "Uncaught ReferenceError: otpPermissionCallback is not defined", source: https://api.razorpay.com/v1/checkout/public?version=1.6.6&library=checkoutjs&platform=android (1) 

Issue

java.lang.NoSuchMethodError:
No virtual method
startSmsUserConsent(Ljava/
lang/String:)Lcom/google/
android/gms/tasks/Task; in
class Lcom/google/android/
gms/auth/api/phone/
SmsRetrieverClient; or its
super classes (declaration of
'com.google.android.gms.auth.
api.phone.SmsRetrieverClient'
appears in base.apk!
classes4.dex)

com.razorpay.CheckoutActivity has leaked IntentReceiver

I am using 'com.razorpay:checkout:1.6.11' in my android dependencies.

While running the payment scenario for my app, I am getting the below error

E/com.razorpay.checkout: Webview JS Error: Uncaught ReferenceError: otpPermissionCallback is not defined
I/chromium: [INFO:CONSOLE(1)] "Uncaught ReferenceError: otpPermissionCallback is not defined", source: https://api.razorpay.com/v1/payments/pay_HjyJpCXUmEggBd/callback/08b127d2a0d9ad380b5b13ce290ea6018bdf9085/rzp_test_gYefCg3wjpjcPZ?status=authorized&token_recurring_status=rejected&language_code=en (1)
E/ActivityThread: Activity com.razorpay.CheckoutActivity has leaked IntentReceiver com.razorpay.AutoReadOtpHelper@8c37f9c that was originally registered here. Are you missing a call to unregisterReceiver()?
android.app.IntentReceiverLeaked: Activity com.razorpay.CheckoutActivity has leaked IntentReceiver com.razorpay.AutoReadOtpHelper@8c37f9c that was originally registered here. Are you missing a call to unregisterReceiver()?
at android.app.LoadedApk$ReceiverDispatcher.(LoadedApk.java:1167)
at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:950)
at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1339)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1319)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1313)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:596)
at com.razorpay.CheckoutPresenterImpl.onSubmit(CheckoutPresenterImpl.java:958)
at com.razorpay.CheckoutBridge$2.secure(CheckoutBridge.java:158)
at com.razorpay.CheckoutPresenterImpl.executeWebViewCallback(CheckoutPresenterImpl.java:1256)
at com.razorpay.CheckoutPresenterImpl.access$700(CheckoutPresenterImpl.java:49)
at com.razorpay.CheckoutPresenterImpl$9.run(CheckoutPresenterImpl.java:1242)
at android.os.Handler.handleCallback(Handler.java:754)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6238)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:933)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)

As per many issues which i saw already, this was fixed but I keep getting this error anyway.

Can this please be resolved.

Thanks,
Sujith.

[Delete API]: Unable to parse response for delete calls

  • Merchants were getting Unable to parse response for delete calls. (Token delete)
  • This was because, we expect entity name should be present in the response to create an object of that entity. In case of delete we just get an empty json {}, without actual name of entity.
  • We changed all the delete call to void return type, and throws an exception in case of non 2xx response.

Api to Create and apply payments from server side

I have integrated razorpay with java and trying to invoke payments(create a payment method and apply payments) directly from the server side since we don't have any front end code. Looks like razor pay is not exposing any api to create a payment directly from server side.

Activity com.razorpay.CheckoutActivity has leaked IntentReceiver

I am trying to integrate razorpay on android and I am facing a issue that has already been raised but solutions are not working for me.
` private void makepayment() {
Checkout checkout = new Checkout();
checkout.setKeyID("rzp_test_Gj9ClQXvE7sb9p");
checkout.setImage(R.drawable.logo);

    /**
     * Reference to current activity
     */
    final Activity activity = this;

    /**
     * Pass your payment options to the Razorpay Checkout as a JSONObject
     */
    try {
        JSONObject options = new JSONObject();

        options.put("name", "test Payment");
        options.put("description", "Reference No. #123456");
        options.put("image", "https://s3.amazonaws.com/rzp-mobile/images/rzp.png");
       //options.put("order_id", "order_DBJOWzybf0sJbb");//from response of step 3.
        options.put("theme.color", "#3399cc");
        options.put("currency", "INR");
        options.put("amount", "50000");//pass amount in currency subunits
        options.put("prefill.email", "[email protected]");
        options.put("prefill.contact","xxxxxxxxxx");
        JSONObject retryObj = new JSONObject();
        retryObj.put("enabled", true);
        retryObj.put("max_count", 4);
        options.put("retry", retryObj);

        checkout.open(activity, options);

    } catch(Exception e) {
        Log.e("TAG", "Error in starting Razorpay Checkout", e);
    }
}
public void onPaymentSuccess(String s, PaymentData paymentData) {
    text.setText("Payment Sucessfull" + s);


}

@Override
public void onPaymentError(int i, String s, PaymentData paymentData) {
    text.setText("Payment Failed because" + s);
}`

What happens here is the payment succeeds. It comes through on dashboard and the textview is also saying payment successfull. But it throws an error. I was looking to send the information to backend but I cannot do because of the error. This is the entire error
2021-07-17 23:27:13.161 5904-5904/com.example.loginapplication E/com.razorpay.checkout: Webview JS Error: Uncaught ReferenceError: otpPermissionCallback is not defined 2021-07-17 23:27:13.163 5904-5904/com.example.loginapplication I/chromium: [INFO:CONSOLE(1)] "Uncaught ReferenceError: otpPermissionCallback is not defined", source: https://api.razorpay.com/v1/payments/pay_Ha5XW7H1wenZ51/callback/5dbd94043815b9a9fbee2b874e548d5adb1c0268/rzp_t est_Gj9ClQXvE7sb9p?status=authorized&token_recurring_status=rejected&language_code=en (1) 2021-07-17 23:27:13.164 5904-5904/com.example.loginapplication E/ActivityThread: Activity com.razorpay.CheckoutActivity has leaked IntentReceiver com.razorpay.AutoReadOtpHelper@eb52ce5 that was originally registered here. Are you missing a call to unregisterReceiver()? android.app.IntentReceiverLeaked: Activity com.razorpay.CheckoutActivity has leaked IntentReceiver com.razorpay.AutoReadOtpHelper@eb52ce5 that was originally registered here. Are you missing a call to unregisterReceiver()? at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:1159) at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:946) at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1330) at android.app.ContextImpl.registerReceiver(ContextImpl.java:1310) at android.app.ContextImpl.registerReceiver(ContextImpl.java:1304) at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:586) at com.razorpay.CheckoutPresenterImpl.onSubmit(CheckoutPresenterImpl.java:958) at com.razorpay.CheckoutBridge$10.secure(CheckoutBridge.java:158) at com.razorpay.CheckoutPresenterImpl.executeWebViewCallback(CheckoutPresenterImpl.java:1257) at com.razorpay.CheckoutPresenterImpl.access$700(CheckoutPresenterImpl.java:49) at com.razorpay.CheckoutPresenterImpl$17.run(CheckoutPresenterImpl.java:1243) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6123) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)

How can I solve my issue?

P.S I am using latest version of sdk 1.6.10 .

Segment Class with ASCII character's causes proguard error

Razorpay v1.0.2 and also tested on v1.2.0 causes the error with Segment Class having ASCII character in class name while applying proguard.

Android gradle version: 2.3.0
Android Studio: 2.3

I am having this error:
Error:org.gradle.api.UncheckedIOException: java.io.IOException: Failed to read zip file 'app/build/intermediates/transforms/proguard/release/jars/3/1f/main.jar'.

Caused by: java.io.IOException: Failed to read stored entry 'com/razorpay/Segment$ۥ.class'.
at com.android.apkzlib.zip.CentralDirectory.readEntry(CentralDirectory.java:367)
at com.android.apkzlib.zip.CentralDirectory.makeFromData(CentralDirectory.java:225)
... 36 more

SDK for Go

Not sure where to raise this, Hence putting here. If inappropriate kindly redirect me on where i should be raising this.

I could see SDK's available for several languages (PHP, Ruby, Python, .NET, Node.js, Java) but i could not find one for go lang

My question is, Is a first class support for go lang in your timeline ?

BAD_REQUEST_ERROR:Account number is mandatory for this merchant

I'm trying to generate the orderId in Razorpay, and I'm following the steps given in documentation
https://razorpay.com/docs/payments/server-integration/java/payment-gateway/build-integration/#api-sample-code
. But its throwing an error saying com.razorpay.RazorpayException: BAD_REQUEST_ERROR:Account number is mandatory for this merchant

My code:
`RazorpayClient client = null;
try {
client = new RazorpayClient("[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]");
JSONObject options = new JSONObject();
options.put("amount", 100);
options.put("currency", "INR");
options.put("receipt", "order_receipt_id");
Order order = client.orders.create(options);
System.out.println("ORDER Details: "+order);

        String orderId = order.get("id");  // Corrected property name to lowercase "id"
        System.out.println("ORDER ID: " + orderId);
        response.getWriter().append(orderId);
    }catch(Exception e){
        e.printStackTrace();
    }`

Note: I've added my key id and key secret in their respective "[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]"

Then I tried adding

options.put("account_number", "[accNO]");
then it threw a different error saying Internal server error try after some time... and I've tried many times but still nothing.

and the Razorpay version I'm using is 1.4.3

Razorpay api Integration

sample code for java , api integration,

I am not able to implement using provided reference code,
please provide me best solution for this

regards,
Sharad

order id generation error!! getting null value

azorpay.utils.RazorpayException: Unable to parse response because of null
at com.buszaar.razorpay.utils.ApiClient.parseResponse(ApiClient.java:71)
at com.buszaar.razorpay.utils.ApiClient.parseCollectionResponse(ApiClient.java:87)
at com.buszaar.razorpay.utils.ApiClient.processCollectionResponse(ApiClient.java:141)
at com.buszaar.razorpay.utils.ApiClient.getCollection(ApiClient.java:62)
at com.buszaar.razorpay.utils.OrderClient.fetchAll(OrderClient.java:22)
at com.buszaar.razorpay.utils.OrderClient.fetchAll(OrderClient.java:18)
at com.razorpay.api.RazorpayApplication.main(RazorpayApplication.java:32)

Delete a plan

How can i delete a plan using java. ?

razorpayClient.Plans.delete(String path , JsonObject jsonObject) ;
this method support razorpay but what is the meaning of this two parameter . I can't understand it's meaning . Anybody have face this issue ?

[Bug] Improper handling of delete call response

Expected Behavior

When a delete call is made, the ApiClient's processDeleteResponse should "return" void, if deletion is successful

Current Behavior

Currently, ApiClient's processDeleteResponse returns JSONException saying

A JSONObject text must begin with '{' at 0 [character 1 line 1]

Current Code:

private void processDeleteResponse(Response response) throws RazorpayException {
        if (response == null) {
            throw new RazorpayException("Invalid Response from server");
        } else {
            int statusCode = response.code();
            String responseBody = null;
            JSONObject responseJson = null;

            try {
                responseBody = response.body().string();
                responseJson = new JSONObject(responseBody);
            } catch (IOException var6) {
                throw new RazorpayException(var6.getMessage());
            }

            if (statusCode < 200 || statusCode >= 300) {
                this.throwException(statusCode, responseJson);
            }

        }
    }

for a delete request 204 is a valid response, and the responseBody in that case will be empty,
Currently if responseBody is empty, then new JSONObject(responseBody); will give JSONException as it wont be able to serialize empty string

Possible Solution

  1. Handle the empty body case
  • This change should not cause any issues as we already are using throwException in case of non-200 responses

Steps to Reproduce

  1. Issue can be reproduced by making any valid delete call which returns 204 response

Context (Environment)

Detailed Description

Possible Implementation

Proposed Code:

private void processDeleteResponse(Response response) throws RazorpayException {
        if (response == null) {
            throw new RazorpayException("Invalid Response from server");
        } else {
            int statusCode = response.code();
            String responseBody = null;
            JSONObject responseJson = null;

            try {
                responseBody = response.body().string();
               //additional check here
               if(StringUtils.isNotEmpty(responseBody)) {
                responseJson = new JSONObject(responseBody);
               }
            } catch (IOException var6) {
                throw new RazorpayException(var6.getMessage());
            }

            if (statusCode < 200 || statusCode >= 300) {
                this.throwException(statusCode, responseJson);
            }

        }
    }

Token

How exactly token here is working?
i tried to fetch the token, i got error while accessing API
List tokens = razorpayClient.Customers.fetchTokens(customerId);

Error:-
com.razorpay.RazorpayException: BAD_REQUEST_ERROR:The requested URL was not found on the server.

@ankit-rzp

[Feature Request] Adding Allowed Payers In Virtual Account API

Problem Description

VirtualAccountClient class currently does not support addition of allowed payers for TPV flow as mentioned here
Unlike Payments there is also no such support for a custom call

Entity response = razorpayClient.Payments.post("path", JSONObject requestBody);

The Current edit method on the VirtualAccountClient is also not applicable

public VirtualAccount edit(String id, JSONObject request) throws RazorpayException {
        return (VirtualAccount)this.patch(String.format("virtual_accounts/%s", id), request);
    }

because it is a PATCH call and the add additional payer is a POST call

/virtual_accounts/{va_id}/allowed_payers

Hack:

  • we can directly call the post on VirtualAccountClient just like Payments post, but a dedicated a method exposed will make the API richer

Suggested Solutions

  • create a custom addAllowedPayers method

Capturing payments using Java Sdk in Android

Trying to capture the payments using java sdk in android, In debug mode its working fine but in production app is crashing. This issue may be related with proguard . Without Razorpay Java SDK its working fine

[Java] Integration capture payment giving an error #94

I am doing razorpay java API integration with spring boot.

Below is the razorpay version which I am using.

<dependency>
    <groupId>com.razorpay</groupId>
    <artifactId>razorpay-java</artifactId>
    <version>1.3.8</version>
</dependency>

Capture payment API is giving me an error.
Below code snippet which I am using to capture payment.

public static String capturePayment(String paymentid){
        try {
            JSONObject options = new JSONObject();
            options.put("amount", 500.00);
            CustomRazopayClient.getRazopayClient().Payments.capture(paymentid, options);
            return "success";
        }catch (Exception e){
            return e.getLocalizedMessage();
        }
    }

Error which I am getting
"BAD_REQUEST_ERROR:Capture amount must be equal to the amount authorized"

I have tried an amount as 500.
Can anyone help here?

Just for info:- Amount is validated.
Below is the screenshot for reference.

Screenshot 2019-07-28 at 11 18 20 AM

PaymentClient#fetchAll only returns 10

At People's Archive of Rural India, we are trying to use the Java bindings of Razorpay REST API to get a list of our subscribers' pancard details. These are entered as notes only when the subscriber makes the first payment. These payments are thus way back in history.

When trying to fetchAll, the client only returns the latest 10 payments. I see that in the REST API the count has been set to default at 10. Is there anyway that we can change the count or paginate?

Properties prop = new Properties();
prop.load(App.class.getResourceAsStream("/application.properties"));
RazorpayClient razorpayClient = new RazorpayClient(prop.getProperty("key"), prop.getProperty("secret"));
List payments = razorpayClient.Payments.fetchAll();
System.out.println(payments.size());

	for (Payment p : payments) {
		Object notes = p.get("notes");
		if (notes instanceof JSONObject) {
			System.out.println(((JSONObject) notes).get("customer_pan"));
		}
	}

Webhook use 'GET' method

Dear Team,
I have a problem when I use the webhook. https://razorpay.com/docs/webhooks/ this document says that you will send an HTTP POST payload in JSON to the webhook's configured URL. I provide a POST interface in my spring boot application but when I get the webhook request I get an error "javax.servlet.error.message=Request method 'GET' not supported". I turn the POST interface to a GET interface then I can get the request but I can not get the payload. Can you help me solve it.

Why no tests ?

Why are there no tests for this sdk ?

All i can see are source files and there is not even one test file. This totally reduces my confidence level to use this SDK given it handles secure data.

Freezed Grey Screen after initializing Payment Request

After starting the checkout code, the razorpay progress bar starts, goes off, after which the payment details needed to be filled up. But that screen is not appearing. After the progress bar goes off, it shows a grey screen and gets freezed.
It's happening in multiple Android models. Currently using: LENOVO A7010a48 Android 6.0 API 23
I am using RazorPay Version: 1.5.2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.