create
fun create(customerInfo: CustomerInfo, termsOfService: Boolean, ageVerification: Boolean, email: String? = null, password: String? = null, callback: (Customer?, SdkError?) -> Unit? = null)
Create a customer account using customerInfo from the user. Consent for termsOfService and ageVerification should be collected from the user (e.g. checkboxes).
Note: The phone parameter is optional. Set it to an empty string ("") if not used.
Optional: If creating a login for the customer, email and password may be included.
Important: If the termsOfService and ageVerification parameters are not true, an error will be returned and the customer will not be created.
Example:
fun createCustomer() {
val customerInfo = CustomerInfo (
name = "Marty McFly",
carType = "DeLorean",
carColor = "Silver",
licensePlate = "OUTATIME",
phone = "555-555-5555"
)
FlyBuyCore.getInstance().customer.create(customerInfo, termsOfService = userAcceptedTerms,
ageVerification = userVerifiedAge) { customer, sdkError ->
if (null != sdkError) {
// Handle error
} else {
// Handle success
}
}
}Content copied to clipboard