Issues "Invalid boolean: 1" external api call

i have called stripe external api for subscription cancel where we need to pass boolean true i passed boolean true but in external api response i get error message this Invalid boolean: 1


  • Michael Udinski
    Michael Udinski Administrator


    Hey @Khan aqib that is strange. I'd have to look at Stripe's documentation. One quick thing to try would be to pass true as a text string instead of a boolean. Not sure if that will work in this case but just something worth trying!

  • Xano freelance
    Xano freelance Member ✭
    edited February 15

    Please check with to_boolean and to_text filter

  • Khan aqib
    Khan aqib Member ✭

    Hi @Michael Udinski and @Xano freelance i have checked to_boolean and to_text filter and string but it's not worked please check this issues

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭

    The conversion of bools to 1/0 is a symptom of URL form encoding.

    In your external API request, "push" the following header:

    Content-Type: application/json

    Let us know if that squares you away? If not, can you please share a screenshot of the Exertnal API Request configuration?

  • Khan aqib
    Khan aqib Member ✭

    i have checked this but not work i have share response header and request header and also send external api request configuration

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭

    Got it. Your API appears to requires form-encoding, but also wants the words "true" and "false". First, remove the extra header I recommended above. That will put you back where you were. To make progress, make an if-then conditioned on the state of the boolean in question. In the "then", create a variable and set it to the word (text) of "true". Make sure it's not a bool! In the "else", create a variable of the same name and set it to the word "false". Then pass that to your params.

    We actually hit exactly this situation in a recent State Change Pro Office Hours (held every day) and resolved the issue using the above technique.