Stripe Authentication

Question!

I am not able to authenticate in stripe.com - using Basic Authentication

public class Str extends HttpServlet {


    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        PrintWriter pw=response.getWriter();
        pw.println("Hello World");
        HttpClient client= new HttpClient();
        String req="https://api.stripe.com/";
        client.getParams().setAuthenticationPreemptive(true);
        client.getState().setCredentials(new AuthScope(req, 443, null),  new UsernamePasswordCredentials("<api-key>"));
        client.getHostConfiguration().setHost(req, 443, "https");

        PostMethod post= new PostMethod("https://api.stripe.com/v1/charges/");
        //post.addParameter("id", "<id>");
        int status=client.executeMethod(post);
        pw.println(status);



    }


}

i am presenting my code...where i hv used HTTP Basic Auth to provide the users credentials to stripe.com



Answers

Try: new UsernamePasswordCredentials("

By : brian


Hope this will help you.

Here API_KEY means secrete key

HttpResponse httpResponse;
String request ='card[number]=' card_name '
By : Naveen


This video can help you solving your question :)
By: admin