Ahsan Sharif
Ahsan Sharif

Reputation: 21

Stripe connect error in creating account

I am not able to create account of a customer in my application. The code which I found on stripe documentation id:

Map<String, Object> accountParams = new HashMap<String, Object>();
accountParams.put("email", "[email protected]");
accountParams.put("country", "US");
accountParams.put("type", "custom");
Account account = Account.create(accountParams);

When I run this it gives the this error:

"You can only create new accounts if you've registered your platform"

I'm not able to create account.

Can anyone tell me the whole flow of using stripe?

I might not be following that flow.

Upvotes: 2

Views: 2380

Answers (2)

Saberwolf
Saberwolf

Reputation: 11

You have to register your platform by going to Connect --> Settings.

Upvotes: 1

karllekko
karllekko

Reputation: 7198

That code is for creating a managed Stripe account as part of Stripe Connect, which I suspect is not what you are trying to do.

If you are only interested in charging a customer, you do not need to create a Stripe account for them, only a customer object. You would use Stripe Elements or Checkout to collect the customer's payment details and create a token, pass this token to your backend, and then create a customer using that token, as described in the Stripe docs.

Map<String, Object> customerParams = new HashMap<String, Object>();
customerParams.put("description", "Customer for [email protected]");
customerParams.put("source", "tok_visa");
// ^ obtained with Stripe.js
Customer.create(customerParams);

https://stripe.com/docs/api#create_customer

Upvotes: 0

Related Questions