Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Get Stripe Token using client-side tokenization



  • I want to get stripe's one-time use token.What could be the best way for me to get token without making api call using my publishable key. Can i use https://stripe.com/docs/stripe.js? for getting token into my Qt c++ mobile applicaiton for android and ios or If it is possible to use stripe's android and ios sdks to get token in my application, has anyone done this before. I am not clear on this.


  • Moderators

    @bhupi012
    As i said in another post already you should use QNetworkAccessManager for REST-API calls.
    The CURL examples are most appropriate for you.
    In order to use their API you of course need to register your application to get a dev-token (like for most other public webservices) and provide this token on each call.
    It seems they use the token simply as a username (HTTP auth).

    Using QNetworkAccessManager you can do this to provide HTTP AUTH credentials automatically:

    m_NAM = new QNetworkAccessManager(this);
    connect ( m_NAM, &QNetworkAccessManager::authenticationRequired, this, &MyClass::onAuthenticationRequired );
    
    ....
    
    void MyClass::onAuthenticationRequired(QNetworkReply *reply, QAuthenticator * authenticator)
    {
        authenticator->setUser( "<<<DEV-TOKEN>>>" );
    }
    


  • @raven-worx I do not want to transfer user card-details in a unsecured way https://stripe.com/docs/api/curl#create_card_token to generate token. By token, I am referring here token which will be used to make a payment transaction and that token will be retrieved after making an api request with your app registered token(publishable key).


Log in to reply