#nibbs
1 messages · Page 1 of 1 (latest)
hi there! I can try to help, what's up exactly?
Hi.. trying to set up stripe terminal for a POS that I'm making for a client. Since I can';t use server integration, I'm using your docs as a guide. Currently, I'm running it with a useEffect hook, but not sure if that is the correct path forward.
you can use guides like https://stripe.com/docs/terminal/payments/collect-payment?terminal-sdk-platform=js for this integration, and the SDK has a simulated reader to use if you don't have a device itself. (https://stripe.com/docs/terminal/payments/connect-reader?terminal-sdk-platform=js&reader-type=simulated)
Was there something more specific about the useEffect you were wondering about?
Since everything is currently run off useEffect, I was worried that the physical terminal would be bypassed since I have terminal.collectPaymentMethod and terminalprocessPayment in the same hook.
I'm not sure I follow your concern or how things would be bypassed exactly. Have you already written an integration that seems to work well with the simulated reader?
Running everything seems fine, but, in my payment intent after terminal.processPayment, captured amount reads 0.
hmm I mean that's normal. Did you capture the PaymentIntent?
Yes. Here is a screenshot of the code
https://stripe.com/docs/terminal/payments/collect-payment?terminal-sdk-platform=js#capture-payment you generally have to manually capture it on the backend after processing, at least by default
I have manual capture in my api
not sure I follow. Nothing in that code is related to capturing a PaymentIntent. It's just connecting to the reader and authorising a charge. It's backend code that creates the PaymentIntent or is involved in capturing it that would be relevant here.
also, please share an example PaymentIntent pi_xxx ID where you're seeing this "captured amount reads 0" and I can have a look!
paymentIntent
:
allowed_source_types
:
['card_present']
amount
:
100000
amount_capturable
:
100000
amount_details
:
{tip: {…}}
amount_received
:
0
application
:
null
application_fee_amount
:
null
automatic_payment_methods
:
null
canceled_at
:
null
cancellation_reason
:
null
capture_method
:
"manual"
charges
:
data
:
Array(1)
0
:
amount
:
100000
amount_captured
:
0
amount_refunded
:
0
application
:
null
application_fee
:
null
application_fee_amount
:
null
authorization_code
:
"123456"
balance_transaction
:
null
billing_details
:
{address: {…}, email: null, name: null, phone: null}
calculated_statement_descriptor
:
"Stripe"
captured
:
false
created
:
1665668224
currency
:
"eur"
customer
:
null
description
:
null
destination
:
null
dispute
:
null
disputed
:
false
failure_balance_transaction
:
null
failure_code
:
null
failure_message
:
null
fraud_details
:
{}
id
:
"ch_3LsRarJmNUvmJ4ew1ca8HqeV"
invoice
:
null
livemode
:
false
metadata
:
{}
object
:
"charge"
on_behalf_of
:
null
order
:
null
outcome
:
{network_status: 'approved_by_network', reason: null, risk_level: 'not_assessed', seller_message: 'Payment complete.', type: 'authorized'}
paid
:
true
payment_intent
:
"pi_3LsRarJmNUvmJ4ew1VkBy0w8"
payment_method
:
"pm_1LsRauJmNUvmJ4ewyQpCsSeT"
that is what is logged from your console.log(finalizedPayment) line?
then that's normal then
super.
you haven't captured the PaymentIntent yet
that's why it also tells you status:requires_capture. As covered in https://stripe.com/docs/terminal/payments/collect-payment?terminal-sdk-platform=js#capture-payment , after authorising the card in the frontend by interacting with the reader, you have to call our API on the backend to capture it.
or you could change the capture_method when you create the PaymentIntent, that's an option as well https://stripe.com/docs/terminal/payments/collect-payment?terminal-sdk-platform=js#create-payment
I have it set to manual on the backend
makes sense, then until you actually do the manual capture, the amount_captured will be 0 naturally.
let me know if something is unclear!
Thanks. haven't worked much with stripe so I'm being a bit paranoid.
I reallly appreciate your help.
happy to help