#Ramya-token

1 messages · Page 1 of 1 (latest)

stone tapir
glacial garnet
#

i am doing ach payments process.. following
Map<String, Object> bankAccount = new HashMap<>();
bankAccount.put("country", "US");
bankAccount.put("currency", "usd");
bankAccount.put(
"account_holder_name",
"Jenny Rosen"
);
bankAccount.put(
"account_holder_type",
"individual"
);
bankAccount.put("routing_number", "110000000");
bankAccount.put("account_number", "000123456789");
Map<String, Object> params = new HashMap<>();
params.put("bank_account", bankAccount);

Token token = Token.create(params);

#

this code returning empty object

glacial garnet
potent reef
#

what does "empty object" mean?

#

like what are you looking at exactly, can you share the exact response or a screenshot of what you are looking at or so on?

glacial garnet
#

giving {} like this

#

but i am expecting for
{
"id": "btok_1KgnhQ2eZvKYlo2CoaQl5Uur",
"object": "token",
"bank_account": {
"id": "ba_1KgnhQ2eZvKYlo2CeKCQq2sX",
"object": "bank_account",
"account_holder_name": "Jane Austen",
"account_holder_type": "individual",
"account_type": null,
"bank_name": "STRIPE TEST BANK",
"country": "US",
"currency": "usd",
"fingerprint": "1JWtPxqbdX5Gamtz",
"last4": "6789",
"routing_number": "110000000",
"status": "new"
},
"client_ip": null,
"created": 1648116924,
"livemode": false,
"type": "bank_account",
"used": false
}

potent reef
#

can you show me where you see {} exactly, what code do you have that prints it, or are you looking in a debugger, or something else?

glacial garnet
#

i wanted to get token which is belongs to particular account details

potent reef
#

I understand.

#

can you show me where you see {} exactly, what code do you have that prints it, or are you looking in a debugger, or something else?

glacial garnet
#

Gson gson = new GsonBuilder().setPrettyPrinting().create();

    Stripe.apiKey = "sk_test_R8EhbtMSWYQYqkuppjm3UvSz00MCTmCh3i";


    Map<String,Object> tokenParams = new HashMap<>();
    Map<String,Object> bankAccountMap = new HashMap<>();
    bankAccountMap.put("country","US");
    bankAccountMap.put("currency","usd");
    bankAccountMap.put("account_holder_name","Jenny Rosen");
    bankAccountMap.put("account_holder_type","individual");
    bankAccountMap.put("routing_number","110000000");
    bankAccountMap.put("account_number","000123456789");
    tokenParams.put("bank_account",bankAccountMap);
    Token token = null;

    Log.d("TAG", "params: "+tokenParams);

    new Thread(new Runnable(){
        @Override
        public void run() {
            try {
                com.stripe.model.Token token1 = com.stripe.model.Token.create(tokenParams);
                Log.d("TAG", "createACHToken: "+gson.toJson(token1));
            } catch (StripeException e) {
                e.printStackTrace();
                Log.d("TAG", "run: e :::: "+e.toString());
            }
        }
    }).start();
#

i have used this code

#

in my logs displaying createACHToken: {}

potent reef
#

interesting how that code is different from what you posted earlier

#

try just doing Log.d("TAG", "createACHToken: "+ token1.getId()); instead and see what happens.

glacial garnet
#

giving null value

glacial garnet
potent reef
#

wait, you're doing this in an Android app?

#

that is completely wrong

#

you can't use our stripe-java library in an Android app, and you can't use your secret key in a frontend app your customers would install! That library is for backend servers.

glacial garnet
#

in logs giving this message No request log found with the specified ID.

#

yes i am developing android application using java.. i wanted to create token using my user bank account details.. can i make this from front end

potent reef
potent reef