I am using this code to create a customer. I can click on it from the Orders screen but it is not attached to merchant. How can I attach it for the current merchant so it will be visible on the Customers screen?

customerConnector.addEmailAddress(newCustomer.getId(), getText(email));
newCustomer = customerConnector.createCustomer(getText(firstName), getText(lastName), true);
customerConnector.addPhoneNumber(newCustomer.getId(), getText(phone));
customerConnector.setAddress(newCustomer.getId(), getText(address), null, null, null, null, null, null);

asked 2016-03-29 13:35:37 -0500

Georgi gravatar image

1 answer

Sort by  

In your code you are referencing newCustomer before you assign it in the second line.

I switched the order, and subbed your getTexts for string literals:

Customer newCustomer = customerConnector.createCustomer("John", "Doe", true);
customerConnector.addEmailAddress(newCustomer.getId(), "JDoe@foo.bar");
customerConnector.addPhoneNumber(newCustomer.getId(), "8004444444");
customerConnector.setAddress(newCustomer.getId(), "addressaddressaddressaddress", null, null, null, null, null, null);

Then I called your code in an async task and it ran fine, and resulted in a new customer for my merchant.

Make sure that you are passing all the values you expect, and that you have instantiated the Connecter, and run the connect() method on the instance.

answered 2016-04-01 19:04:06 -0500

AnthonyPinto gravatar image