Reputation: 1817
I have to integrate stripe to receive payment. So, my basic concept is that there will be some service providers and the consumers. so the consumers will be able to book a service then pay for the same.I have already implemented the consumer side payment now I have to receive the payment from consumers. so in service provider side i need to configure the bank account for receiving the payment.
Let me explain the steps I'm going to follow
Listing the supported banks by stripe
Blockers
1.1) I couldn't find any doc for listing the stripe supported bank in theire doc
Select any bank then add the credentiols for the choosen
Save the token for the particular
Verify account
Getting paid from consumers
Pl. help me any experienced one if any flaw in my understandings & help me to overcome the blockers
Upvotes: 4
Views: 592
Reputation: 10559
Let me explain the steps for adding an account to receive payment using stripe. there are two ways to verify your account
Here I illustrating the second solution
Step 1
The first thing we have to do is that collecting user account details to create a stripe token which need to send to our server.
Setting up token metadata
Map<String, Object> tokenParams = new HashMap<String, Object>();
Map<String, Object> bank_accountParams = new HashMap<String, Object>();
bank_accountParams.put("country", "US");
bank_accountParams.put("currency", "usd");
bank_accountParams.put("account_holder_name", "name");
bank_accountParams.put("account_holder_type", "individual");
bank_accountParams.put("routing_number", "number");
bank_accountParams.put("account_number", "a/c no");
tokenParams.put("bank_account", bank_accountParams);
Create token
Token token = null;
try {
token = Token.create(params[0]);
} catch (AuthenticationException e) {
error = e.getMessage();
e.printStackTrace();
}
Send token id to server for later verification
token.getId()
Step 2
Receiving a representative token in return. Once you have that, attach it to a Stripe customer in your account
// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
Stripe.apiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2";
// Get the bank token submitted by the form
String tokenID = request.getParameter("stripeToken");
// Create a Customer
Map<String, Object> customerParams = new HashMap<String, Object>();
customerParams.put("source", tokenID);
customerParams.put("description", "Example customer");
Customer customer = Customer.create(customerParams);
After adding the bank account to a customer, it needs to be verified. When using Stripe without Plaid, verification is done via two small deposits into the bank account that Stripe will automatically send. These deposits will take 1-2 business days to appear on the customer’s online statement. The statement description for these deposits will be VERIFICATION. Your customer will need to relay the value of the two deposits to you.
When accepting these values, be sure to note that there is a limit of 10 failed verification attempts. Once this limit has been crossed, the bank account will be unable to be verified. Careful messaging about what these microdeposits are and how they are used can help your end customers avoid this issue. Once you have these values, you can verify the bank account:
// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
Stripe.apiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2";
// get the existing bank account
Customer customer = Customer.retrieve("cus_7iLOlPKxhQJ75a");
ExternalAccount source = customer.getSources().retrieve("ba_17SHwa2eZvKYlo2CUx7nphbZ");
// verify the account
Map params = new HashMap<String, Object>();
ArrayList amounts = new ArrayList();
amounts.add(32);
amounts.add(45);
params.put("amounts", amounts);
source.verify(params);
Once the bank account is verified, you can make charges against it.
Reference
Upvotes: 2