#TomS - PaymentIntent

1 messages · Page 1 of 1 (latest)

gusty warren
#

When you say "displayed in the reader" what reader are you talking about?

pallid estuary
#

I'm sorry. I'm using the WisePOS E reader

gusty warren
#

Since that data is not passed to the reader when initializing with the Payment Intent (the reader only has the client_secret AFAIK)

pallid estuary
#

Ah, ok. Thank you very much

gusty warren
#

Just curious. what kind of integration are you using?
JavaScript, iOS, Android, Server Driven?

pallid estuary
#

Javascript

#

.NET back end

#

I'm creating the intent on the back end

gusty warren
#

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.

pallid estuary
#

I'm creating the PaymentIntentService on the server side

gusty warren
#

Is your front-end where you capture the various items involved in the total?

pallid estuary
#

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

gusty warren
#

Could you store them client side and populate the cart.line_items array from that information?

pallid estuary
#

I'm not using the cart at all. But I can try a different way.

gusty warren
#

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

pallid estuary
#

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

gusty warren
#

When all else fails, copy & paste and then start tweaking.

pallid estuary
#

Yep. Thanks again

gusty warren
#

Happy to help 🙂

pallid estuary
#

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

gusty warren
#

Alright, I'm powering mine up to see what happens

pallid estuary
#

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

gusty warren
#

Right, the reader will not show that description.

pallid estuary
#

Ah ok. So I need to figure out how to pass the items as a cart

gusty warren
#

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

pallid estuary
#

In the intellisense description for the Description property, it says that the property is to display to users

#

FWIW

gusty warren
#

Which it does, in Checkout and Invoices

#

But one thing you are very right on, we don't clearly display when this should be called

pallid estuary
#

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

gusty warren
#

Yeah I am still having difficulty figuring out when to call this function

gusty warren
#

Okay Success!

#

After I connected to the reader (terminal.connectReader), I triggered the function

#

But that still doesn't seem quite right...

pallid estuary
#

I've tried it after I've connected, and then created the intent, then called setReaderDisplay but it's not working

gusty warren
#

Do you see anything? Or is it just not the behavior you expect?

pallid estuary
#

I just don't see any description reader

#

*on the

gusty warren
#

I just copy/pasted the terminal.setReaderDisplay into my JS after I connected to the reader and this is what I see:

pallid estuary
#

Hmm

gusty warren
#

Still not sure this is exactly what you're looking for though.

pallid estuary
#

That'll work if I can it to work for me

#

you're calling terminal.collectPaymentMethod right after that?

gusty warren
#

I'm not doing anything yet,

#

I just stuck it in as a separate function to test if it worked

pallid estuary
#

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

gusty warren
#

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

pallid estuary
#

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

faint lichen
#

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.

pallid estuary
#

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

faint lichen
#

alright, can you share the code snippet where you're doing calling setReaderDisplay() and calling collectPaymentMethod()?

pallid estuary
#

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;                                
                    }
                });
            }
        });
faint lichen
#

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

pallid estuary
#

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

faint lichen
#

onesec, let me just try something out

pallid estuary
#

I appreciate the help

obsidian wedge
#

Hi @pallid estuary can you try commenting out the collectPaymentMethod part just keep setReaderDisplay and see if the line items stay there?

pallid estuary
#

They do

#

But then nothing happens if I try to use the card

obsidian wedge
#

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.

pallid estuary
#

Ah ok. So it would be two steps? Show them the cart and then show them the payment screen?

obsidian wedge
#

Yes you are right!