Save a card during payment
1. Create a Customer
// Use your private key
MoneyCollect.apiKey = "test_pr_NWZsa******";
CustomerCreateParams customerCreateParams =
CustomerCreateParams.builder()
.setEmail("[email protected]").build();
Customer customer = Customer.create(customerCreateParams);2. Create Checkout Session
// Use your private key
MoneyCollect.apiKey = "test_pr_NWZsa******";
SessionCreateParams params =
SessionCreateParams.builder()
.setReturnUrl("http://localhost:4242/success.html")
.setCancelUrl("http://localhost:4242/cancel.html")
.setNotifyUrl("http://localhost:4242/success.html")
.setAmountTotal(18*100L)
.setCurrency("USD")
.setOrderNo("C"+System.currentTimeMillis())
.setWebsite("https://www.localhost.com")
.setBillingDetails(getBillingDetails())
.setCustomer(customer.getId())
.setStatementDescriptor("Mc122").build();
Session session = Session.create(params); 3. Customer selects "save this card" during payment

4. Customer selects the saved card to make payment

Last updated