#jesus ruiz - OXXO

1 messages ยท Page 1 of 1 (latest)

lyric steeple
#

Is this a test for something that you are developing or are you trying to make a payment to someone yourself?

narrow needle
#

I made a implementation in nodejs

#

in sandbox mode it worked fine too

#

when i receive the oxxo payment details in my frontend i extract the expiration date, number of reference and create a bar code using JsBarcode

lyric steeple
#

And you are using just the number to create the barcode or are you using anything else?

narrow needle
#

sorry for my bad english

lyric steeple
#

Looking in to what needs to go in to that bar code

#

Your english is great, much better than my Spanish

narrow needle
#

i'm using the 32 digit code that stripes gives me for the order created

narrow needle
lyric steeple
#

As far as I can tell, that number should be all that is turned in to the bar code.

#

I will ask my colleagues if they know about what might have happened here.

#

Do you have the Stripe ID (pi_123) of the payment that this happened with?

#

Also can you send me a direct message with the barcode that you created?

#

It looks like your code is generating the bar code of something slightly different from the bar code. When I decode it with online tools, I get a decimal number that ends in e+31 but when I generate my own barcode for your order number, it gets decoded as a normal 32 digit code.

#

Can you send me your snippet of code where you get the OXXO number from Stripe and generate your barcode?

narrow needle
#

Ok, i'm still getting the same result for the number, still working on it

#

in my backend side i'm working with the number such as it is (no problem with it) but when i catch it on the frontend that's when i'm getting the exponential one

#

i'm trying to re cast

lyric steeple
#

Interesting. Can you try sending it as a string from your backend to your frontend?

#

That might make it safer from being represented like this. Also I am stepping out for the day but my colleague @last trellis can help you going forward, they may need a bit to catch up but I send them the order details in case they need it.

narrow needle
#

the curious thing is that i'm sending it as a string

#

but in frontend that's why i'm getting

last trellis
#

๐Ÿ‘‹ give me a few minutes to catch up as well

narrow needle
#

i'm sorry, in this moment i'm getting into a meeting, can we resume this in a hour ?

last trellis
#

sure! just let us knwo when you're back ๐Ÿ‘

last trellis
#

Did some digging - I think it has to do with how you're generating the barcode
@lyric steeple shared the link to your site with me internally, and it looks like you're doing this:

 JsBarcode("#barcode", `${46000864635096320220729000129634}`, {

when instead you should be doing

 JsBarcode("#barcode", `46000864635096320220729000129634`, {
narrow needle
#

Hey there, thanks in advance, i'm back

#

I made the change you said i printed the value of the reference

#

But it's still the same

last trellis
#

What does your exact code for generating the barcode look like?

narrow needle
#

that console.log prints this

narrow needle
#

i don't understand why if i send it from the backend as a string then i'm receiving it as a number

#

so i was thinking by splitting the 32 digit code in 4 slices in my backend and joining them again in the frontend side as a string

#

but honestly i think that's a bad practice, isn't ?

narrow needle
last trellis
#

What do you get if you switch to using <%= instead of <%-

#

I'm not the most familiar with the subtly difference between all of them, but I think it is related to your usage of <%-

narrow needle
#

exponential number:/

last trellis
#

Can you tell me what the following does?

<script> 
  var number= <%= data.overdue.barcodeReference; %>
  console.log(number):
</script>
narrow needle
last trellis
#

Can you try a couple of things for me?

  • Log out barcodeReference from your backend and tell me what you get
  • Hardcode a number on your backend for barcodeReference and share what you get in your console logs

Also just to confirm, are you using JSP?

narrow needle
#

this is what i get from the backend

#

if a hardcode a number (the same number) i get this

#

i'm using a ejs file, it's a template i'm using to present data to my customers

sick night
#

Hello! I'm stepping in as @last trellis had to step away...

#

To clarify, you have a value in your Java code that you're trying to render into your JavaScript code using a JSP template?

#

And using <%= data.overdue.barcodeReference; %> is providing unexpected output which is wrapped in ${...} for some reason?

#

Can you try <% out.println("'" + data.overdue.barcodeReference + "'"); %> and see what output you get with that?

narrow needle
#

Hello Rubeus, thanks for being with me

#

I'm using nodejs as a backend and javascript in my frontend

sick night
#

Oh, okay.

#

One sec.

narrow needle
#

wait

narrow needle
#

let me be sure

sick night
#

It is? ๐Ÿ˜…

#

I wouldn't expect that to help unless you're using Java on the backend, not Node.

#

Can you try <%= "'" + data.overdue.barcodeReference + "'" %>?

narrow needle
#

yes, give me a minute

narrow needle
#

but if from te backend i send

#

it seems like it's working

sick night
#

So where is reference being set?

narrow needle
#

i got reference from the params of my request

#

but for some reason, if i send 'reference' from the backend to the frontend i receive it as a exponential, not as a string

#

so the bar code that i was trying to generate was a reference to the exponential and not the payment code

sick night
#

So are you doing the ejs rendering client-side?

narrow needle
#

yes, sending data from the backend and rendering in frontend

sick night
#

Okay, so on your backend in the handler for that request, how are you setting the data?

#

Is it a number or a string at that point?

narrow needle
#

but idk why in the front it was exponential

#

but your tip helped me

sick night
#

Can you show me that backend code? The part that sets the value that gets sent to the client?

narrow needle
#

now i think i'm getting the real reference

#

this is my back

#

before your help i was doing

barcodeReference: reference

and in the frontend it was an exponential

#

now with "'" + reference + "'" looks like its working

#

let me be sure

sick night
#

So, wait, if I'm understanding that code you're getting the reference value from the incoming request, then returning it back? Why are you sending it back if the client already had it?

narrow needle
#

because i'm sending it to a custom template for my customers

wooden hull
#

but you already have it client-side, why not render it client-side?

#

But overall you seem to have figured out the issue

#

Really curious why you don't use Stripe's hosted page instead with the bar code and all

narrow needle
#

the company where i'm working has their own template to show payments orders to their clients

wooden hull
#

yeah that's fair, but worth testing ours too, it's a lot less work

#

but glad you figure it out ๐Ÿ™‚

narrow needle
#

yeah i know, when i started to implement stripe i saw that template and is really useful

#

but here they wanted to show our own custom template because we already use it for other payments orders for others stores

#

like a "universal" template for everything

wooden hull
#

gotcha

narrow needle
#

Thank you so much to you all for your support

wooden hull
#

Glad we could help ๐Ÿ™‚