public void createPayment()
// Required data to be provided
String merchantIdLive="<Marcent Id>";
String accessTokenLive="<Mobile Access Token>";
String productName="<Product Name>";
String orderId= String.valueOf(System.currentTimeMillis()); // You can change this based on your requirement
String amount="<Amount>";
String customerName="<Customer Name>";
String customerPhone="<Customer Mobile No>";
String customerEmail="<Customer Email Id>";
// You can customize which payment method should be provided
// Here is the example for payment method customization, This is optional.
// Create Map for payment methods
HashMap<PaymentTypes, PaymentMethods> payment_methods = new HashMap<>();
// Create payment method object to be added in payment method Map
PaymentMethods paymentMethod = new PaymentMethods();
paymentMethod.enable=true; // True if you want to enable this method or else false, default is true
paymentMethod.priority=1; // Set priority for payment method order at checkout page
paymentMethod.set_as_prefered=true; // If you want this payment method to show in prefered payment method then set it to true
// Add payment method into our Map
payment_methods.put(PaymentTypes.UPI, paymentMethod);
// Example for netbanking
paymentMethod = new PaymentMethods();
paymentMethod.enable=true;
paymentMethod.priority=2;
paymentMethod.set_as_prefered=true;
paymentMethod.sub_methods.add(new Sub_Methods(SubPaymentTypes.SBIN,1));
paymentMethod.sub_methods.add(new Sub_Methods(SubPaymentTypes.HDFC,1));
payment_methods.put(PaymentTypes.NB, paymentMethod);
paymentMethod = new PaymentMethods();
paymentMethod.enable=false;
paymentMethod.priority=3;
paymentMethod.set_as_prefered=false;
payment_methods.put(PaymentTypes.WA, paymentMethod);
// Example for card payment
paymentMethod = new PaymentMethods();
paymentMethod.enable=true;
paymentMethod.priority=3;
paymentMethod.set_as_prefered=true;
payment_methods.put(PaymentTypes.DCCC, paymentMethod);
paymentMethod = new PaymentMethods();
paymentMethod.enable=true;
paymentMethod.priority=3;
paymentMethod.set_as_prefered=true;
payment_methods.put(PaymentTypes.UPIQRCODE, paymentMethod);
paymentMethod = new PaymentMethods();
paymentMethod.enable=true;
paymentMethod.priority=3;
paymentMethod.set_as_prefered=true;
payment_methods.put(PaymentTypes.EMI, paymentMethod);
// Now, Create object for paykun transaction
PaykunTransaction paykunTransaction=new PaykunTransaction(merchantIdLive,accessTokenLive,true);
paykunTransaction.setCurrency("INR");
paykunTransaction.setCustomer_name(customerName);
paykunTransaction.setCustomer_email(customerEmail);
paykunTransaction.setCustomer_phone(customerPhone);
paykunTransaction.setProduct_name(productName);
paykunTransaction.setOrder_no(orderId);
paykunTransaction.setAmount(amount);
paykunTransaction.setLive(true); // Currently only live transactions is supported so keep this as true
// Optionally you can customize color and merchant logo for checkout page
paykunTransaction.setTheme_color("<COLOR CODE>");
paykunTransaction.setTheme_logo("<LOGO URL>");
// Set the payment methods Map object that we have prepared above, this is optional
paykunTransaction.setPayment_methods(payment_methods);
new PaykunApiCall.Builder(PaymentActivity.this).sendJsonObject(paykunTransaction);