#Ramya Chekuri-GooglePay
1 messages · Page 1 of 1 (latest)
com. stripe:stripe-java:19.45.0
com. stripe:stripe-android:14.4.0
I see. Can you paste the request id here? I can take a look. Also did you check your Stripe Dashboard logs for that request? What was the error?
I found that request req_EEvxOoHyjCpkdT, the error message is Missing required param: amount. You can re-check your server side code (in Java) around where you are creating PaymentIntent
Ok.. Will share here the parameters what we are sending
PaymentIntentCreateParams params =
PaymentIntentCreateParams.builder()
.setAmount(Long.parseLong(value))
.setCurrency("usd")
.build();
sending amount as long .. currency in lowercase
I see, can you put a debug to print out that value? Because in our log I don't see an amount passed in
ok Sure
is it correct way to send value as Long
PaymentIntentCreateParams params =
PaymentIntentCreateParams.builder()
.setAmount(1000L)
.setCurrency("usd")
.build();
PaymentIntent intent = PaymentIntent.create(params);
i have given values statically.. but still getting intent as null
Long should work. How about print out the whole PaymentIntentCreateParams after creation? Do you see the amount inside that object?
yes
it is returning same when i get from params
params.getAmount() and params.getCurrency()
it is working in debug mode getting this issue release mode
Hmm? So in test mode you do have the PaymentIntent with amount? Can you give an example requests in Test mode and Live mode?
not using any API calls we are using java code directly in thread and sending to PaymentIntent object.
class getSecretKey extends AsyncTask<String,String,String>{
String clientSecret;
@Override
protected String doInBackground(String... strings) {
String units = preferenceUtils.getString(Constants.units,Constants.no_value);
int amount = Integer.parseInt(MyApplication.getInstance().getDonation_charges_amount());
String value = String.valueOf(amount*100);
PaymentIntentCreateParams params =
PaymentIntentCreateParams.builder()
.setAmount(1000L)
.setCurrency("usd")
.build();
System.out.println("amount ::::" +params.getAmount()+"//"+params.getCurrency());
try {
Stripe.apiKey = stripe_sk;
PaymentIntent intent = PaymentIntent.create(params);
clientSecret = intent.getClientSecret();
}catch (Exception e){
System.out.println("in catch block");
e.printStackTrace();
new Thread()
{
public void run()
{
PaymentIntegrationActivity.this.runOnUiThread(new Runnable()
{
public void run()
{
progressDialog.dismiss();
Constants.showAlert(PaymentIntegrationActivity.this,e.getMessage());
}
});
}
}.start();
}
return clientSecret;
}
}
like this
Yes, but you can access to your Stripe Dashboard, right?
yes
wait, in the above code you are passing 1000L directly, right? The original code is
.setAmount(Long.parseLong(value))
With this original code, is your code working in Test mode but not in Live mode?
you have amount in Int already, why convert it to string and then to Long?
anw that's a different thing. In Release mode, can you reproduce and log the value of
int amount = Integer.parseInt(MyApplication.getInstance().getDonation_charges_amount());
?
i understood you point.. but if i give value directly like 1000L
why i am getting same issue
Give it direct value of 1000L, build in Release mode = getting error?
hmm that's strange
not showing that popup message
Can you see the latest failed request here?
@humble pewter are you creating the payment_intent in your android App using secret key?
or you have a java server side doing that?
Ah yeah it's confusing. Let clarify that. Debug mode/Release mode is per client build, while this code is on Server
sure .. i am requesting my manager for credentials
for secret key i am creating PaymentIntent
PaymentIntentCreateParams params =
PaymentIntentCreateParams.builder()
.setAmount(1000L)
.setCurrency("usd")
.build();
yeah, i mean are you doing that in yoru android app?
yes
you cannot do taht
Stripe-Java is used for server and secret key is like your bank account password which it should not be exposed in your android app
so that will not work
you will have to have a server like JSP, or Spring server calling Stripe API with Stripe-Java
then your android App call your server to get the payment_intent
i have a doubt we had so many released.. but we had this issue in recent
can you share working android code?
You can see an example integration here: https://stripe.com/docs/payments/integration-builder?platform=android&server=java
why we are getting this issue now
As wsw said, you should create the PaymentIntent on server and your Android call your server to get that PaymentIntent Secret. Please see the sample above
we followed this example but give error for PaymentLauncher like cannot find symbol
ok.. i will try in your suggested way
It should be the only correct way to go
sounds like a different problem with importing the Java SDK
They have mentioned only these 3
implementation 'com.stripe:stripe-android:15.1.0'
implementation 'com.squareup.okhttp3:okhttp:4.4.0'
implementation 'com.google.code.gson:gson:2.8.6'
followed the same
is there any suggestion
That should be enough for client. Aren't you using the same for your current setup?
using same
I need to send payment_intent_id to server ... how could i
i am tring to create PaymentIntent object it is giving null
You will need to let server to create PaymentIntent
you won't pass anything from Android to server, just let your server create a fresh new PaymentIntent, and pass back the clientSecret to your Android
ok...
for that what i need to send to server
is there any specific data
like currency and amount like that
based on you i think server side they need only currency and amount right
That's another story 😄 Technically you wouldn't want to pass amount from Android to server. Server should decide the amount
The reason is your information on client can be hijacked (network spoof, Man In the Middle), you wouldn't want some of your customer to to able to change the amount to get a same service
So, just define a kind of product id on your server, and pass that id from your Android, and let Server decide what to do when creating a PaymentIntent
ok.. i will try with server and get back to you @rustic robin