Create customer

Customer is used to group the various other objects, in order to provide a logical structure to the payment processes. Also, it is an essential object to create before some advanced capabilities can be attempted, like recurring or pay-per-use billing.

Create

None of the properties of Customer object are required, but if you specify at least email and description you will get a nicer overview in the Administration tool.

Use the fields of this object depending on your specific business needs.

CustomerRequest customerReq = new CustomerRequest()
    .company("Widgets Ltd")
    .firstName("John")
    .lastName("Hancock")
    .email("John.Hancock@emailserver.com")
    .phone("444 555 666")
    .mobile("444 555 666")
    .description("test customer")
        .billingAddress()
            .addressLine1("some street 123")
            .addressLine2("address line 2")
            .city("Zagreb")
            .postalCode("10000")
            .countryIsoCode2("HR")
        .done()
    .customData("customer_id", "my_custom_value");

Customer customer = gateway.customer().create(customerReq);

Result

Customer object is returned on success.