#anshjain_code

1 messages ยท Page 1 of 1 (latest)

twilit oracleBOT
#

๐Ÿ‘‹ 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.

earnest juniperBOT
balmy steeple
#

Hello! Can you paste the value of clientSecret here?

boreal jackal
#

no that's confidential right?

#

i can show the code

balmy steeple
boreal jackal
#

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();

balmy steeple
#

Can't really help with a Stripe obect ID or an API request ID

#

Your code looks fine

boreal jackal
#

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

balmy steeple
#

Again, a pi_xxx ID is needed

boreal jackal
#

yeah yeah i have used it

balmy steeple
#

I can't really debug the issue without that I'm afraid

#

No, I mean share it here

boreal jackal
#

pi_3OzHX2SAbmkAKQN90e6mSCLs_secret_DATZklW13EDQJIqqL9U27EckW

balmy steeple
#

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?

boreal jackal
#

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

balmy steeple
#

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

When buyers of your goods or services are located outside India.

#

I think you'll need to add a description parameter when creating your intent

boreal jackal
#

at backend?

balmy steeple
#

Yes โ€“ link above explains the requirements

boreal jackal
#

no it's not working

#

i have added a description

balmy steeple
#

OK, then can you share the ID of the payment?

#

Also, 'not working' is not very descriptive

boreal jackal
#

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);

boreal jackal
boreal jackal
balmy steeple
#

The pi_xxx ID please. The code is not relevant at this point

boreal jackal
#

there are two one is client secret and other is just id which one?

balmy steeple
#

Either is fine

boreal jackal
#

pi_3OzHrTSAbmkAKQN91NvTmeJS

balmy steeple
#

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

When buyers of your goods or services are located outside India.

#

Please read the full doc linked to ensure you meet all the requirements

boreal jackal
balmy steeple
#

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

boreal jackal
#

ok let me see

#

no still the same response

balmy steeple
#

IDs, please...

boreal jackal
#

pi_3OzI7vSAbmkAKQN91FrXCciT_secret_AJLHyv1eqwS0ZOjGkS7K8b1l0

balmy steeple
boreal jackal
#

no this time i had added it

balmy steeple
#

Not according to the ID you just shared

balmy steeple
boreal jackal
#

u r saying in req post body ?

#

here right?

balmy steeple
#

Yes, there's no customer parameter to provide the name and address(es)

boreal jackal
#

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

balmy steeple
#

Yes, but getId() function should return a string no?

boreal jackal
#

yeah sorry it worked now thanks a lot

balmy steeple
#

No problem, glad I could help!