Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Mobile Development
  3. Android
  4. Can't make charge with stripe in android Fire base

Can't make charge with stripe in android Fire base

Scheduled Pinned Locked Moved Android
tutorialandroiddatabasesysadminsales
2 Posts 2 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Saboor8802
    wrote on last edited by
    #1

    Hello to all! Hope you are fine. I am developing an e-commerce android app and integrating Stripe payment gateway in it and using Google Fire base as real time database. I browsed the official website of stripe and took the source code from there. I used my test key from there. I successfully generated Stripe Token and saved it on my server (i-e Fire base). But I am unable to make an actual charge by using that token. That means no transaction shows on my stripe account. I am pasting my code, guide me what should i do to create/make charge?

    Card cardToSave = cardInputWidget.getCard();
    if (cardToSave == null) {
    Toast.makeText(getActivity(),"Invalid Card Data",Toast.LENGTH_LONG).show();
    // mErrorDialogHandler.showError("Invalid Card Data");
    }
    else{

                    Stripe stripe = new Stripe(MainActivity.mcont, 
                "pk\_test\_XZFc6CW7wmDMl4WWESxtvWd300ibs1wr85");
                    
                          stripe.createToken(
                            cardToSave,
                            new TokenCallback() {
                                public void onSuccess(final Token token) {
                                    // Send token to your server
                                    customer\_ref = 
                               database.getReference("Customers").child(MainActivity.user.getUid());
                                     final String tokenid = token.getId();
    
    
                                              //saving the tokenID on my server(i-e fiebase)
    
                                            final Map params = new HashMap<>();
                                            params.put("amount", paid);
                                            params.put("currency", "usd");
                                            params.put("description", "Example charge");
                                            params.put("source", tokenid);
    
                                            HashMap map = new HashMap();
                                            map.put("StripeToken",tokenid);
                                            customer\_ref.updateChildren(map);
    
                                            try {
                                                // creating charge object
                                                Charge charge = Charge.create(params);
    
    D 1 Reply Last reply
    0
    • S Saboor8802

      Hello to all! Hope you are fine. I am developing an e-commerce android app and integrating Stripe payment gateway in it and using Google Fire base as real time database. I browsed the official website of stripe and took the source code from there. I used my test key from there. I successfully generated Stripe Token and saved it on my server (i-e Fire base). But I am unable to make an actual charge by using that token. That means no transaction shows on my stripe account. I am pasting my code, guide me what should i do to create/make charge?

      Card cardToSave = cardInputWidget.getCard();
      if (cardToSave == null) {
      Toast.makeText(getActivity(),"Invalid Card Data",Toast.LENGTH_LONG).show();
      // mErrorDialogHandler.showError("Invalid Card Data");
      }
      else{

                      Stripe stripe = new Stripe(MainActivity.mcont, 
                  "pk\_test\_XZFc6CW7wmDMl4WWESxtvWd300ibs1wr85");
                      
                            stripe.createToken(
                              cardToSave,
                              new TokenCallback() {
                                  public void onSuccess(final Token token) {
                                      // Send token to your server
                                      customer\_ref = 
                                 database.getReference("Customers").child(MainActivity.user.getUid());
                                       final String tokenid = token.getId();
      
      
                                                //saving the tokenID on my server(i-e fiebase)
      
                                              final Map params = new HashMap<>();
                                              params.put("amount", paid);
                                              params.put("currency", "usd");
                                              params.put("description", "Example charge");
                                              params.put("source", tokenid);
      
                                              HashMap map = new HashMap();
                                              map.put("StripeToken",tokenid);
                                              customer\_ref.updateChildren(map);
      
                                              try {
                                                  // creating charge object
                                                  Charge charge = Charge.create(params);
      
      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      The Stripe developers hang out here.

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups