Help with right cc hash syntax for Wappler component

Anyone has got a clue about the correct hash syntax for the user’s card details to input into the wappler component card field?

This is what Stripe expects:
image

Card hash explained here:
image

Double check numbers that are expected as strings(last4) and those that are expected as integers(exp_month)

Thanks indeed, I was careful with the number types.
I’m confused abt the right syntax in wappler for this hash where last4 and cvc should be between quotes, exp_ are string:
{last4: "4242", exp_month: 5, exp_year: 2022, cvc: "314"}
It gets converted into this mess:
image
Any idea abt the syntax on wappler side to get that kind of good looking response?
image

Try with single quotes.

That’s actually right. It’s just escaping the double quote. But Stripe doesn’t accept it.

There is no such thing as Wappler syntax. It’s all pretty standard code.

Also the key must be in double quotes.

It is definitely cleaner but we still get that error:
image
I’m asking Stripe tech support for further clarification…

What about the keys? You don’t have quotes around them. Stripe is expecting a json object I think.

Make sure to copy the syntax exactly as provided in stripe docs, as that’s how they expect it.

So try just entering:

{ "key" : "string", "key" : number, "key" : "another_string" }

Sorry, edited my reply, didn’t see the syntax correctly on my phone.

1 Like

Still same object error, yet I’ve followed scrupulously the Stripe doc.
Error whether double quotes:
image

…Or single quotes (cleaner result)
image

This is Stripe guide:
image

I haven’t used Stripe before, but from the looks of it, the SA JSON is storing the CARD information as a JSON string and not a JSON.

Try editing the SA directly to look like:

"card" : {last4: "4242", exp_month: 5, exp_year: 2022, cvc: "314"}

Note that there are no quotes outside the curly braces.

At first I suggested using javascript object notation only but it seems stripe won’t accept that either.

key : “value” and key : 'value'

So it seems only JSON(derived from javascript object notation) will do the work.

“key” : “value”

I don’t know if it has to do with Wappler escaping the double quotes or what.

We haven’t discarded yet one importante part.

@Fred_K did you get this working on postman?

I tried such manual edit but it gave me a nasty parsing error and blocked me access to the Api stripe component afterwards!
I’ll try your variation after backing up my Api action first!

Neither single nor double quotes are working…
Trying the manual edit on the php console although it has a pitfall: saving any further edit in the component will wipe my manual edits.

Did you get the call working on postman?

I don’t know this tool, I know zero language, learning from scratch… I’m a marketing guy :grimacing:
I do get some interesting info from the Stripe log:


Note: I get the same error with double quotes.

Gives me the parsing error now:
image

Same parsing error with 2 versions of my manual edit:


Postman is a free desktop app to test APIs. I suggest you get your stripe call working there correctly before implementing in Wappler.

Why? Because we don’t know if the error is in Wappler, in the data you are trying to send or in the API itself.

If you can get the call working in postman we can discard quite a few things.

2 Likes

Here you have the full postman collection for stripe.

Import it in postman for your convenience.

1 Like

Does @Teodor have tutorial on Postman? I’m kidding :wink:
Going to check tutos on youtube, i remember seeing good ones on this tool already.
Thanks for the suggestion.

1 Like

I use it always before adding any API to Wappler. It saves me a lot of troubleshooting and headaches.

You will enjoy it :slight_smile: