#TomS - PaymentIntent
1 messages · Page 1 of 1 (latest)
I'm sorry. I'm using the WisePOS E reader
Okay. I've only started playing with the WisePOS E. It looks like you need to pass the descriptions in the setReaderDisplay API call:
https://stripe.com/docs/terminal/features/display
Since that data is not passed to the reader when initializing with the Payment Intent (the reader only has the client_secret AFAIK)
Ah, ok. Thank you very much
Just curious. what kind of integration are you using?
JavaScript, iOS, Android, Server Driven?
Okay so you should be able to pass this data to the JS front-end and consume it in the terminal.setReaderDisplay function
I'm using a JS integration with a Python back-end as my test and looking at this doc is giving me ideas for the next stuff to test out.
I'm creating the PaymentIntentService on the server side
Is your front-end where you capture the various items involved in the total?
with the options that I'm passing the amount and description. Just the description isn't being passed but the amount is
Yes. I pass them to the server which creates the intent
Could you store them client side and populate the cart.line_items array from that information?
I'm not using the cart at all. But I can try a different way.
I'm not referencing any other cart than the object you need to pass in to the setTerminalReader function on the doc I just shared.
It looks like that is what you need to do if you want the item descriptions provided on your reader
Ok, thank you. I will play around with it. This is all a bit above my skillset so I'm moving forward inch by inch
When all else fails, copy & paste and then start tweaking.
Yep. Thanks again
Happy to help 🙂
I am calling terminal.processPayment and passing the intent. Do I call setReaderDisplay after that call?
It doesn't seem to be passing the cart item to the reader
Alright, I'm powering mine up to see what happens
I don't really have a "cart" or items. I'm just charging an admission price. When I pass the description to the PaymentIntent, it shows up correctly in the event data in the Stripe Dashboard. It's just not being displayed on the reader for some reason
Right, the reader will not show that description.
Ah ok. So I need to figure out how to pass the items as a cart
If you want a description presented on the reader AFAIK you need to set the display.
But, to be honest, what I know is much less than what I don't in this case
In the intellisense description for the Description property, it says that the property is to display to users
FWIW
Which it does, in Checkout and Invoices
And the canonical description can be found here:
https://stripe.com/docs/api/payment_intents/object#payment_intent_object-description
But one thing you are very right on, we don't clearly display when this should be called
So only the amount is being passed to the reader and not the description. I'm trying to call the setReaderDisplay but none of that is going to the reader so I'm calling improperly I assume
Yeah I am still having difficulty figuring out when to call this function
Okay Success!
After I connected to the reader (terminal.connectReader), I triggered the function
But that still doesn't seem quite right...
I've tried it after I've connected, and then created the intent, then called setReaderDisplay but it's not working
Do you see anything? Or is it just not the behavior you expect?
I just copy/pasted the terminal.setReaderDisplay into my JS after I connected to the reader and this is what I see:
Hmm
Still not sure this is exactly what you're looking for though.
That'll work if I can it to work for me
you're calling terminal.collectPaymentMethod right after that?
I'm not doing anything yet,
I just stuck it in as a separate function to test if it worked
ah ok. I'm getting Invalid Type. I must be calling it wrong
could you show me the snippet of code you you used to create those items?
I keep getting invalid type
I just copy/pasted this:
terminal.setReaderDisplay({
type: 'cart',
cart: {
line_items: [
{
description: "Caramel latte",
amount: 659,
quantity: 1,
},
{
description: "Dozen donuts",
amount: 1239,
quantity: 1,
},
],
tax: 100,
total: 1998,
currency: 'usd',
},
});
into it's own function and called it after I connected to the reader
This is weird. It seems to be working. I can see the line items for a split second on the reader but then it goes back to just showing the Total
if I call setReaderDisplay without calling the collectPaymentMethod, nothing gets sent to the reader
No, I take that back. If I JUST call the setReaderDisplay, it's working
jumping in as snufkin had to step away. Maybe can you share the relevant code snippets / logic here for us to take a closer look and see if there's anything which we can spot immediately? remember to remove any API Keys or other sensitive information.
Hi Alex, I'm just trying to get my head around how to pass the item details to the reader. I've got it working now using setReaderDisplay(), but when I then call collectPaymentMethod(), it overwrites the display
alright, can you share the code snippet where you're doing calling setReaderDisplay() and calling collectPaymentMethod()?
Sure. I'm hardcoding the values at the moment:
terminal.setReaderDisplay({
type: 'cart',
cart: {
line_items: [
{
description: 'Jerry Seinfeld 7:00pm',
quantity: 2,
amount: 401
},
],
tax: 0,
total: 802,
currency: 'usd',
},
});
terminal.collectPaymentMethod(secret).then(function (result) {
if (result.error) {
// Placeholder for handling result.error
} else {
terminal.processPayment(result.paymentIntent).then(function (result) {
if (result.error) {
alert(result.error.message)
} else if (result.paymentIntent) {
paymentIntentId = result.paymentIntent.id;
}
});
}
});
terminal.setReaderDisplay returns a Promise that resolves to an empty object if the command succeeds. I'm wondering if you should be waiting for that to be done first before executing the subsequent methods like collectPaymentMethod
I can see the cart description displayed on the reader for a split second and then it's getting overwritten on the screen with the processPayment data
onesec, let me just try something out
I appreciate the help
Hi @pallid estuary can you try commenting out the collectPaymentMethod part just keep setReaderDisplay and see if the line items stay there?
Ok. You can't collect the payment in the cart display screen, and you need to call collectPaymentMethod to go to the payment screen in order to collect payment
However, the cart display will be cleared once collectPaymentMethod is called.
I'd suggest you to have a button in your web application to trigger collectPaymentMethod , and you can use the example code as a refrence https://github.com/stripe/stripe-terminal-js-demo/blob/master/src/MainPage.jsx
Ah ok. So it would be two steps? Show them the cart and then show them the payment screen?
Yes you are right!