0
votes

I am able to receive the Customer Payment using Stripe API, but I want it should send to other customers using Customer ID.

I have written the code for receiving the payment, but I want payment should be sent to other customer using his customer ID.

Stripe.apiKey="sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
Customer c=Customer.retrieve("cus_FhPkYk0wrgEyCC");
Map <String, Object> chargeParam= new HashMap<String, Object>();
chargeParam.put("amount","500");
chargeParam.put("currency", "usd");
chargeParam.put("customer", c.getId());
Charge.create(chargeParam);
Gson gson=new GsonBuilder().setPrettyPrinting().create();
System.out.println(gson.toJson(c));

It should be sent to other customers, but I don't know what other code snippets to add here.

1
Are you even allowed to do that? - Joakim Danielson
I don't quite get what you are asking. You would create a function where you could pass in and replace customer id "cus_FhPkYk0wrgEyCC". as long as the customer has a default payment card, your API call will work - wsw
I have two customers and I want one customer should be able to send payment to other customer using customer ID eg. "cus_FhPkYk0wrgEyCC" - Adeep Malmotra

1 Answers

0
votes

This isn't possible with a normal Stripe account. You can accept payments from any customer, but you can't pay out to customers. You can only pay out to the bank account associated with your Stripe account.

If you want to process payments and pay out to sellers and service providers, look at using Stripe Connect: https://stripe.com/docs/connect