private static final String TEST_KEY = "782CB4B3F5B84BDDB3C9EAFA6A134DC3";
private static Logger log = Logger.getLogger(JuspayPaymentExample.class);
public static void main(String[] args) {
PaymentService juspayService = new PaymentService().withEnvironment(Environment.PRODUCTION)
.withKey(TEST_KEY).withMerchantId("juspay");
//InitOrder example calls
InitOrderRequest request = new InitOrderRequest().withOrderId("" + System.currentTimeMillis())
.withAmount(100.0)
.withCustomerId("customer_id").withEmail("customer@shop.in");
InitOrderResponse initOrderResponse = juspayService.initOrder(request);
log.info("Init order response: " + initOrderResponse);
//AddCard example call
AddCardRequest addCardRequest = new AddCardRequest().withNameOnCard("Customer Name")
.withCardExpMonth("11").withCardExpYear("2020")
.withCardNumber("4111222233334444").withCustomerEmail("customer@shop.in")
.withCustomerId("customer_id");
AddCardResponse addCardResponse = juspayService.addCard(addCardRequest);
log.info("Add card response: " + addCardResponse);
//ListCard example call
ListCardsRequest listCardsRequest = new ListCardsRequest().withCustomerId("customerId");
ListCardsResponse listCardsResponse = juspayService.listCards(listCardsRequest);
System.out.println("List card response: " + listCardsResponse);
// OrderStatus example call
GetOrderStatusRequest orderStatusRequest = new GetOrderStatusRequest();
orderStatusRequest.withOrderId("1355728384");
GetOrderStatusResponse orderStatusResponse = juspayService.getOrderStatus(orderStatusRequest);
log.info("Order status response: " + orderStatusResponse);
// PaymentStatus example call
PaymentRequest paymentRequest = new PaymentRequest();
//merchantId=juspay&orderId=1359115924989&cardNumber=4375511234567899&cardExpYear=2013&cardExpMonth=05&cardSecurityCode=111
paymentRequest.withMerchantId("juspay").withOrderId("1359115924989").withCardNumber("4375511234567899").
withCardExpYear("2013").withCardExpMonth("05").withCardSecurityCode("111");
PaymentResponse paymentResponse = juspayService.makePayment(paymentRequest);
log.info("Payment Response is:" + paymentResponse);
/*
String specialTestKey = "enter-the-special-key";
PaymentService juspayExtendedService = new PaymentService().withEnvironment(Environment.PRODUCTION)