Simple Order API | Visa Platform Connect

Example: Transaction Request Structure

private PaymentInfo makeTransactionDetails() { // Supported card brands ArrayList<CardInfo.Brand> brandList = new ArrayList<CardInfo.Brand>(); if (visaBrand.isChecked()) brandList.add(CardInfo.Brand.VISA); if (mcBrand.isChecked()) brandList.add(CardInfo.Brand.Mastercard); if (amexBrand.isChecked()) brandList.add(CardInfo.Brand.AMERICANEXPRESS); // Basic payment information PaymentInfo paymentReq = new PaymentInfo.Builder() .setMerchantId(“merchantID”) .setMerchantName("Test").setAmount(getAmount()) .setShippingAddress(getShippingAddressInfo()) .setOrderNumber(orderNoView.getText().toString()) .setPaymentProtocol(PaymentProtocol.PROTOCOL_3DS) .setAddressInPaymentSheet(AddressInPaymentSheet.DO_NOT_SHOW) .setAllowedCardBrands(brandList) .setRecurringEnabled(isRecurring) .setCardHolderNameEnabled(isCardHolderNameRequired) .build(); return paymentReq; } // Add shipping address details private Address getShippingAddressInfo() { Address address = new Address.Builder() .setAddressee(name.getText().toString()) .setAddressLine1(addLine1.getText().toString()) .setAddressLine2(addline2.getText().toString()) .setCity(city.getText().toString()) .setState(state.getText().toString()) .setCountryCode(country.getSelectedItem().toString()) .setPostalCode(zip.getText().toString()).build(); return address; } // Add amount details private Amount getAmount() { Amount amount = new Amount.Builder() .setCurrencyCode(currencyType.getSelectedItem().toString()) .setItemTotalPrice(productPrice.getText().toString()) .setShippingPrice(shippingPrice.getText().toString()) .setTax(taxPrice.getText().toString()) .setTotalPrice(totalAmount.getText().toString()).build(); return amount; }