#anshjain_code
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1222877925918113794
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello! Can you paste the value of clientSecret here?
Not at all
try {
let res = await fetch("http://192.168.1.23:8080/client/createpaymentintent", {
method: "POST",
headers: {
'Content-Type': 'application/json',
"Authorization": Bearer ${token}
},
body: JSON.stringify({ amount: 1 })
})
// console.log(res);
try {
const { clientSecret } = await res.json();
// console.log("clientSecret -> ", clientSecret);
return { clientSecret, paymentMethodId };
} catch (error) {
console.log(error, "error in converting res.json");
}
} catch (error) {
console.log("error in checkout");
console.log(error);
}
const { clientSecret } = await fetchPaymentIntentClientSecret();
Can't really help with a Stripe obect ID or an API request ID
Your code looks fine
when i m pressing pay button i m redirecting to the official cards page and it keeps reloading and it returns
{"error": {"code": "Failed", "declineCode": null, "localizedMessage": "", "message": null, "stripeErrorCode": null, "type": null}}
basically payment is not getting successful
Again, a pi_xxx ID is needed
yeah yeah i have used it
pi_3OzHX2SAbmkAKQN90e6mSCLs_secret_DATZklW13EDQJIqqL9U27EckW
Thanks, taking a look
OK, so sure seems like 3DS auth failed for the payment. When your code calls confirmPayment you should be redirected to a page to authenticate the payment. Is that happening?
yes but it is only loading
after 5-6 sec it get redirected back to pay page
when i go in the dashboard
the payments are incomplete
and it says customer has not entered their payment method
but i have already given it in the code
OK, here's the actual API error: https://dashboard.stripe.com/test/logs/req_I7A405JgJAIxdi
As per Indian regulations, export transactions require a description. More info here: https://stripe.com/docs/india-exports
I think you'll need to add a description parameter when creating your intent
at backend?
Yes โ link above explains the requirements
OK, then can you share the ID of the payment?
Also, 'not working' is not very descriptive
int amount = Integer.parseInt(data.get("amount"))*100;
PaymentIntentCreateParams params =
PaymentIntentCreateParams.builder()
.setAmount((long) amount)
.setCurrency("usd")
.addPaymentMethodType("card")
.setDescription("Software development services")
// In the latest version of the API, specifying the `automatic_payment_methods` parameter is optional because Stripe enables its functionality by default.
.build();
PaymentIntent paymentIntent = PaymentIntent.create(params);
// CreatePaymentResponse paymentResponse = new CreatePaymentResponse(paymentIntent.getClientSecret());
System.out.println("payementIntent " + paymentIntent);
String clientSecret = paymentIntent.getClientSecret();
Map<String, String> res = new HashMap<>();
res.put("clientSecret", clientSecret);
res.put("paymentMethoddId", paymentIntent.getId());
System.out.println("res -> " + res);
// System.out.println(res.get("clientSecret"));
return new ResponseEntity<>(res, HttpStatus.CREATED);
I mean the same response is coming as of previous
here is the backend server implementation
The pi_xxx ID please. The code is not relevant at this point
there are two one is client secret and other is just id which one?
Either is fine
pi_3OzHrTSAbmkAKQN91NvTmeJS
https://dashboard.stripe.com/test/logs/req_S2M609erS4De4D
As per Indian regulations, export transactions require a customer name and address. More info here: https://stripe.com/docs/india-exports
Please read the full doc linked to ensure you meet all the requirements
https://dashboard.stripe.com/test/logs/req_S2M609erS4De4D this is showing me nothing
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
OK, it's probably an internal request that we don't surface in the Dashboard. In any case I shared the error message
As an IN merchant you have additional requirements to comply with RBI regulations. They're all explained in that doc
IDs, please...
pi_3OzI7vSAbmkAKQN91FrXCciT_secret_AJLHyv1eqwS0ZOjGkS7K8b1l0
Still the same error because you're missing the customer name and address via the customer parameter: https://docs.stripe.com/india-accept-international-payments#international-payments-for-services
Not according to the ID you just shared
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Yes, there's no customer parameter to provide the name and address(es)
i had added it like this->
but still the same response
also if i do it inside params then
it is expecting a string
rather than customer object
Yes, but getId() function should return a string no?
yeah sorry it worked now thanks a lot
No problem, glad I could help!