Hi, I have an app that allows creating a customer after swiping their card and then save the card to that created customer object using clover connector. The issue now is after customer is been created through card swiping, I was able to get the vaultedCard response, but the card was not saving to the customer created instead it keeps throwing this error:
W InputValidator: checkCloverId(InputValidator.java:379)[Binder:2364_4]: Not a valid Clover ID: 7297162975886668, app=unknown
Method for creating a customer;
public void createNewCustomerAndVaultCard(String firstName, String lastName) { if (mAccount == null) { Toast.makeText(this, "Clover account not found!", Toast.LENGTH_SHORT).show(); return; } // create customer boolean marketingAllowed = false; new CreateCustomerTask(customerConnector, firstName, lastName, marketingAllowed, new OnCustomerCreatedListener() { @Override public void onCustomerCreated(Customer customer) { // Customer created successfully then vault a new card for the customer vaultCard(customer); } @Override public void onError(String message) { // Error creating customer } }).execute(); }
Method for the vaultCard;
private void vaultCard(Customer customer) { createdCustomer = customer; int cardEntryMethods = CloverConnector.CARD_ENTRY_METHOD_MAG_STRIPE | CloverConnector.CARD_ENTRY_METHOD_NFC_CONTACTLESS | CloverConnector.CARD_ENTRY_METHOD_ICC_CONTACT; cloverConnector.vaultCard(cardEntryMethods); }
Method for the onVaultCardResponse using the Clover Connector;
public void onVaultCardResponse(VaultCardResponse response) { if(response.isSuccess()){ VaultedCard vaultedCard = response.getCard(); // Get the card token String token = vaultedCard.getToken(); // Create a new Card object with the necessary information Card card = new Card.Builder() .token(token) .first6(vaultedCard.getFirst6()) .last4(vaultedCard.getLast4()) .expirationDate(vaultedCard.getExpirationDate()) .build(); // Associate the vaulted card with the customer try { customerConnector.setCard(createdCustomer.getId(), token, card); runOnUiThread(new Runnable() { @Override public void run() { createdCustomer = null; Toast.makeText(Activity.this, "Card vaulted successfully.", Toast.LENGTH_SHORT).show(); } }); } catch (ClientException e) { throw new RuntimeException(e); } catch (ServiceException e) { throw new RuntimeException(e); } catch (BindingException e) { throw new RuntimeException(e); } catch (RemoteException e) { throw new RuntimeException(e); }finally { runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(this, "Card vaulted unsuccessful.", Toast.LENGTH_SHORT).show(); } }); } }else{ if (response.getResult() == ResultCode.CANCEL) { Toast.makeText(this, "User canceled the operation", Toast.LENGTH_SHORT).show(); cloverConnector.showWelcomeScreen(); }else{ Toast.makeText(this, "Error capturing card: " + response.getResult(), Toast.LENGTH_SHORT).show(); String msg = "Card was not saved"; JsonObject jsonMsg = new JsonObject(); jsonMsg.addProperty("message", msg); cloverConnector.showMessage(msg); SystemClock.sleep(4000); //wait 4 seconds cloverConnector.showWelcomeScreen(); } } }
Please kindly help me out.