Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 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.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded