#jesus ruiz - OXXO
1 messages ยท Page 1 of 1 (latest)
Is this a test for something that you are developing or are you trying to make a payment to someone yourself?
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
And you are using just the number to create the barcode or are you using anything else?
sorry for my bad english
Looking in to what needs to go in to that bar code
Your english is great, much better than my Spanish
i'm using the 32 digit code that stripes gives me for the order created
thank u so much! i appreciate that
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?
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
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.
the curious thing is that i'm sending it as a string
but in frontend that's why i'm getting
๐ give me a few minutes to catch up as well
i'm sorry, in this moment i'm getting into a meeting, can we resume this in a hour ?
sure! just let us knwo when you're back ๐
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`, {
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
What does your exact code for generating the barcode look like?
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 ?
this is how i send it from the backend
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 <%-
Can you tell me what the following does?
<script>
var number= <%= data.overdue.barcodeReference; %>
console.log(number):
</script>
Can you try a couple of things for me?
- Log out
barcodeReferencefrom your backend and tell me what you get - Hardcode a number on your backend for
barcodeReferenceand share what you get in your console logs
Also just to confirm, are you using JSP?
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
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?
Hello Rubeus, thanks for being with me
I'm using nodejs as a backend and javascript in my frontend
wait
this is helping
let me be sure
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 + "'" %>?
yes, give me a minute
this gives me 32 digit code still as a exponential
but if from te backend i send
it seems like it's working
So where is reference being set?
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
So are you doing the ejs rendering client-side?
yes, sending data from the backend and rendering in frontend
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?
yes
i was printing the data in the backend and it was a string
but idk why in the front it was exponential
but your tip helped me
Can you show me that backend code? The part that sets the value that gets sent to the client?
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
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?
because i'm sending it to a custom template for my customers
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
yeah, it's solved now thanks for all your support
the company where i'm working has their own template to show payments orders to their clients
yeah that's fair, but worth testing ours too, it's a lot less work
but glad you figure it out ๐
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
gotcha
Thank you so much to you all for your support
Glad we could help ๐