You are required to use a specific transaction request structure and required fields to initiate a payment.

Required Fields for Initiating a Payment

The following fields are required for initiating a payment; include these fields in the
PaymentInfo
class:
IMPORTANT
If the required fields are not included, you receive a
NullPointerException
error.
Merchant Name
The merchant name as it appears on the payment sheet of Samsung Pay and customer’s bank statement.
Amount
Payment Protocol
3D Secure.
Permitted Card Brands
Specify the card brands that are supported such as American Express, JCB, Mastercard, or Visa.
Merchant ID
Order Number
Shipping Address
This field is required if
SEND_SHIPPING or NEED_BILLING_AND_SEND_SHIPPING
is set for
AddressVisibilityOption
.
Address Visibility Option
Card Holder Name
Recurring Option

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; }