Forums

OverviewFelgo 2 Support (Qt 5) › cURL for stripe

Tagged: 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #23611

    jrrobles79

    Im trying to add some cURL calls to stripe api , is there an example of how to do this, I have only seen HTTPRequest examples

    #23612

    jrrobles79

    bTw I alredy tryed like this:

     HttpRequest.post("https://api.stripe.com/v1/tokens").set("Authorization",
                                           "Bearer pk_test_").timeout(
                             maxRequestTimeout)
    
            .query( "card[number]=4242424242424242")
            .query( "card[exp_month]=6")
            .query( "card[exp_year]=2021")
            .query( "card[cvc]=314")
           
            .then(
                            function (res) {
                                console.debug("token success!")
                                console.debug(JSON.stringify(res))
                            }).catch(function (err) {
                              //  console.error(JSON.stringify(err))
                                console.debug("token success!")
                                console.debug(JSON.stringify(err))
                            })
    

     

    since this works on postmans:

    https://api.stripe.com/v1/tokens?card%5Bnumber%5D=4242424242424242&card%5Bexp_month%5D=6&card%5Bexp_year%5D=2021&card%5Bcvc%5D=314

     

    But I keep getting errors

     

     

    #23613

    jrrobles79

    Just solved, I just change the content type to application/x-www-form-urlencoded:

     

            HttpRequest.post("https://api.stripe.com/v1/tokens").set("Authorization",
                                           "Bearer pk_test_").timeout(
                             maxRequestTimeout).set('Content-Type',
                                                   'application/x-www-form-urlencoded')
    
            .query( "card[number]=4242424242424242")
            .query( "card[exp_month]=6")
            .query( "card[exp_year]=2021")
            .query( "card[cvc]=314")
    
            .then(
                            function (res) {
                                console.debug("token success!")
                                console.debug(JSON.stringify(res))
                            }).catch(function (err) {
                              //  console.error(JSON.stringify(err))
                                console.debug("token error!")
                                console.debug(JSON.stringify(err))
                            })

     

     

Viewing 3 posts - 1 through 3 (of 3 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support