#josh_terminal-bug

1 messages ยท Page 1 of 1 (latest)

sharp ventureBOT
#

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

๐Ÿ“ 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.

old hound
#

josh_terminal-bug

#

@dense pasture can you share the PaymentIntent id?

dense pasture
#

pi_3QDTDVR8EvBMqb532zxrb8lo

old hound
#

Okay it looks configured properly. Which part of your code is throwing that specific error?

#

is it the collectPaymentMethod() call specifically? Which exact SDK version are you using?

dense pasture
#

yes, it is

#

"@stripe/stripe-terminal-react-native": "^0.0.1-beta.22",

old hound
#

let me have a look!

dense pasture
#

thank you

old hound
#

I see you are using Direct Charges.

#

Can you try on your own platform account without Connect involved just to see if you get the same error?

dense pasture
#

I've never done that, is it as simple as putting in my platform ID on the intent request instead of the connected account's id when I call stripe.paymentIntents.create ?

old hound
#

sadly no it's a bit more subtle than this ๐Ÿ˜ฆ

#

So just to be clearer here, you have fully integrated for a long time, it all worked fine and suddenly you got this error?
It's not like your first day trying to build and debug this?

#

What is the log line console.log("Payment Intent ID: ", orderData.clientSecret.id); showing? We're a bit confused by clientSecret.id naming scheme you have

dense pasture
#

A little of column a, a little of column b. Been using Stripe for several years in production, adding a product that uses Terminal

#

{ amount_details: { tip: {} },
object: 'payment_intent',
receipt_email: null,
payment_method_options:
{ card_present:
{ request_extended_authorization: false,
request_incremental_authorization_support: false } },
application: 'ca_KEE84uaoBRtW1EIEOpzErdI0SVrvNOR0',
client_secret: 'pi_3QDTDVR8EvBMqb532zxrb8lo_secret_3oOeDbtJoUdgLQmXQMVT21qrR',
processing: null,
created: 1729784693,
charges:
{ total_count: 0,
object: 'list',
has_more: false,
data: [],
url: '/v1/charges?payment_intent=pi_3QDTDVR8EvBMqb532zxrb8lo' },
cancellation_reason: null,
latest_charge: null,
payment_method_configuration_details: null,
invoice: null,
customer: null,
payment_method_types: [ 'card_present' ],
last_payment_error: null,
source: null,
livemode: false,
payment_method: null,
application_fee_amount: 1,
on_behalf_of: null,
shipping: null,
capture_method: 'manual',
statement_descriptor: null,
status: 'requires_payment_method',
id: 'pi_3QDTDVR8EvBMqb532zxrb8lo',
statement_descriptor_suffix: null,
confirmation_method: 'automatic',
description: null,
automatic_payment_methods: null,
currency: 'usd',
setup_future_usage: null,
amount_capturable: 0,
amount: 1500,
next_action: null,
review: null,
metadata: {},
transfer_group: null,
transfer_data: null,
canceled_at: null,
amount_received: 0 }

old hound
#

Okay so you have never used Terminal before and you are just getting started?

dense pasture
#

Correct.

old hound
#

I'm super confused by what you just dumped in the channel now. Your log seems to be "log the client secret" but then it has an id (which doesn't make sense, it's a string since it's a secret" and that log is the entire PaymentIntent object?

dense pasture
#

console.log("Payment Intent ID: ", orderData.clientSecret);

#

is the line that produced that

#

there is no id

old hound
#

I'm confused, your code earlier had console.log("Payment Intent ID: ", orderData.clientSecret.id);

dense pasture
#

the orderData gets the paymentIntent saved as clientSecret (sorry, I know that is confusing) when it is processed on the back end

old hound
#

So yeah I think that's your entire bug. You are supposed to pass the client_secret value, the pi_123_secret_XXXX and you passed an entire PaymentIntent object in JSON

dense pasture
#

I thought I tried that. Let me try again. First I tried the PaymentIntentId, and then the one with the secret, but let me give that a shot.

#

When I do that, I get
'Payment Intent ID: ', 'pi_3QDTnTR8EvBMqb532NfjZ9LM_secret_9vxkqqnHXsdUz84xT2SsQhVMI'
2024-10-24 11:22:05.162459-0500 GoboFOH[39090:2512270] [javascript] 'error', { code: 'InvalidRequiredParameter',
message: 'You must provide paymentIntent.' }

#

Here is the changed code:
console.log("Payment Intent ID: ", orderData.clientSecret.client_secret);
const { paymentIntent, error } = await collectPaymentMethod({ paymentIntent: orderData.clientSecret.client_secret, skipTipping: true });
if (error) console.log("error", error);

old hound
#

Can you hardcode the id to collectPaymentMethod? I worry you're not extracting what you think you are

dense pasture
#

Sure

#

ok, it doesn't like me setting the param to a string. Looks like it needs to be PaymentIntent.type

#

Here's what I find confusing. You docs say I need to create the PI on the server, which is what I have traditionally done for web-based charges, but the React Native sample app creates them in the client app.

old hound
#

yes, Terminal is quite a different integration

#

So I recommend doing ```const { paymentIntent, error } = await retrievePaymentIntent(clientSecret);

And then ```const { paymentIntent, error } = await collectPaymentMethod({ paymentIntent: paymentIntent });
dense pasture
#

Got it, let me try that.

old hound
#

Sorry I'm so mad at our docs. This makes... no sense honestly

dense pasture
#

I was creating the payment intent on the server side

#

Yeah, it's super confusing

old hound
#

But yeah I think you want to follow that doc I found end to end if you create the PaymentIntent server-side

#

I am so annoyed at some of our SDKs like Mobile and Terminal re-inventing our abstractions/APIs

dense pasture
#

ok, I will try that

old hound
#

Like you create a PaymentIntent, you get a client_secret, you pass it to whatever method needs to authenticate the PaymentIntent and it should just work.
But apparently not here ๐Ÿ˜ฆ

dense pasture
#

and to be clear, the client secret I pass in is the public key pk_test_blah?

old hound
#

no you are mixing up a PaymentIntent's client_secret which is pi_123_secret_XXX and the Publishable API key pk_test_123

dense pasture
#

ok, so it is the first one, got it.

dense pasture
#

that did it, I successfully got a response with my test card!

#

'success', { sdkUuid: '8C181C1C-17B5-4C2F-A5CD-D1D593202DC6',
status: 'requiresConfirmation',
created: '1729790054000',
currency: 'usd',
captureMethod: 'manual',
paymentMethodId: null,
statementDescriptor: null,
statementDescriptorSuffix: null,
paymentMethod: null,
amountTip: 0,
id: 'pi_3QDUbyR8EvBMqb532KN1DTYk',
metadata: {},
charges: [],
amount: 1500,
amountDetails: { tip: { amount: null } },
offlineDetails: null }

old hound
#

Amazing, thanks for your patience!

sharp ventureBOT