#piyushjain_error

1 messages · Page 1 of 1 (latest)

young horizonBOT
#

👋 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/1390647296487719066

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

serene seal
#

Hi

#

I need to help for Stripe terminal

#

stripe terminal works with contactless like google pay and apple pay but when i tried with card its not completing.

young horizonBOT
vocal quail
#

What does 'not completing' look like? Is there an error thrown? What exaxctly are you trying and what isn't working?

serene seal
#

No error. It’s just closing the stripe

vocal quail
#

The PI you shared is in a requires_payment_method state, is the reader prompting for a card?

serene seal
#

Nope .. on terminal it shown remove card

#

After entering PIN

vocal quail
#

Is this the ID of the reader that you're having issues with? tmr_GFzWZwgBQbz5Wm

#

(you shouldn't be testing in livemode)

serene seal
#

Let me check in my code

vocal quail
#

That endpoint won't work with live keys (see the error) so it's probably causing the reader to error out

serene seal
#

This issue came in my production environment

#

Lives keys are required

#

Let me check the end point

vocal quail
#

But as I said, you shouldn't be testing card payments with your live keys

serene seal
#

Okay

#

But how this work in contactless ?

#

Like with google pay and Apple Pay

vocal quail
#

I don't know, I don't have access to your code. I'm just looking at the logs of the reader to see what could be causing an issue. I'd recommend using test keys and a physical test card to try your payment flow end-to-end

serene seal
#

pi_3Rh6yOPcCRWtyajj3hxlIvMI
can you please check if this payment done in testmode or live mode ?

vocal quail
#

I think you should be able to answer that by looking at the API response (livemode: true) or in the Dashboard

serene seal
#

for card insert which api i should call ?

#

can you please help me here?

vocal quail
#

None, you call the process payment endpoint and the reader will prompt for the card. No other API should be necessary

serene seal
#

so just need to skip this call ..

#

and payment will be done right

vocal quail
#

Skip which call?

serene seal
#

public String readerCreatePayment(String stripeKey, String rederId) {
try {
// Set Stripe API key
RequestOptions requestOptions = null;
if (stripeKey.startsWith("acc")) {
requestOptions = RequestOptions.builder().setApiKey(STRIPE_SECRET_KEY).setStripeAccount(stripeKey)
.build();
} else {
requestOptions = RequestOptions.builder().setApiKey(stripeKey).build();
}

        // Retrieve the Reader resource
        Reader reader = Reader.retrieve(rederId, requestOptions);

        // Construct the parameters directly as a Map
        String url = String.format(
                "https://api.stripe.com/v1/test_helpers/terminal/readers/%s/present_payment_method",
                reader.getId());

        // Create the params (if no params, you can use an empty map)
        Map<String, Object> params = new HashMap<>();

        // Send the POST request using ApiResource.request
        Reader updatedReader = ApiResource.request(ApiResource.RequestMethod.POST, url, params, Reader.class,
                requestOptions);

        // Print confirmation
        System.out.println("Payment method presented successfully. Reader status: " + updatedReader);

        return updatedReader.toString();
    } catch (Exception e) {
        // Handle exceptions
        System.out.println("Error processing payment intent: " + e.getMessage());
        return INPROGRESS;
    }
}

Actually i am calling this after registerPayment

#

then i am checking status

vocal quail
#

Yes, don't call present_payment_method

serene seal
#

Okay

#

let me skip this and try on production

vocal quail
#

Why? You should be doing this flow end-to-end with test keys. Testing live payments is against Stripe terms and you'll damage your merchant rep with card networks (by processing and refunding over and over)

serene seal
#

in testing it worked right .. it just issue in production we need to skip present_payment_method right

#

so i just removed that ..

#

now it should work in production

vocal quail
#

If it works in test mode it should also work in live mode, yes

serene seal
vocal quail
#

Well you shouldn't need that endpoint at all if you're using a physical card like in your screenshot

#

That's just for 'simulating' the card entry

serene seal
#

Okay..