Cards
You can integrate your e-commerce application directly to our platform-agnostic Card Payments API and process all major credit cards through the Paysafe payment gateway.
The level2level3 segment of the Java SDK doesn't support multiple line items.
Authorization auth =
Authorization.builder()
.merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
.amount(555)
.card()
.cardNum("4111111111111111")
.cvv(123)
.cardExpiry()
.month(2)
.year(2017)
.done()
.done()
.billingDetails()
.zip("M5H 2N2")
.done()
.build();
Authorization response = apiClient.cardPaymentService().authorize(auth);
Authorization auth =
Authorization.builder()
.merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
.amount(6666)
.settleWithAuth(false)
.card()
.cardNum("4111111111111111")
.cvv(123)
.cardExpiry()
.month(2)
.year(2017)
.done()
.done()
.authentication()
.eci(5)
.cavv("AAABCIEjYgAAAAAAlCNiENiWiV+=")
.xid("OU9rcTRCY1VJTFlDWTFESXFtTHU=")
.threeDEnrollment("Y")
.threeDResult("Y")
.signatureStatus("Y")
.done()
.billingDetails()
.street("100 Queen Street West")
.city("Toronto")
.state("ON")
.country("CA")
.zip("M5H 2N2")
.done()
.shippingDetails()
.carrier("UPS")
.shipMethod("N")
.street("100 Queen Street West")
.city("Toronto")
.state("ON")
.country("CA")
.zip("M5H 2N2")
.done()
.customerIp("204.91.0.12")
.description("Got U a video")
.build();
Authorization response = apiClient.cardPaymentService().authorize(auth);
Authorization authResponse = apiClient.cardPaymentService().getAuth(auth.getId());
AuthorizationQuery newAuth =
AuthorizationQuery.builder()
.account(accountNumber)
.merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
.build();
AuthorizationResultSet auths = apiClient.cardPaymentService().query(newAuth);
Authorization auth =
Authorization.builder()
.merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
.amount(10098)
.settleWithAuth(true)
.card()
.cardNum("4111111111111111")
.cvv(123)
.cardExpiry()
.month(2)
.year(2023)
.done()
.done()
.billingDetails()
.zip("M5H 2N2")
.done()
.build();
apiClient.cardPaymentService().authorize(auth);
Authorization authResponse = makeAuthRequest("processAuthReversal");
AuthorizationReversal voidAuth =
AuthorizationReversal.builder()
.merchantRefNum(authResponse.getMerchantRefNum())
.amount(555)
.authorizationId(authResponse.getId())
.build();
AuthorizationReversal voidAuthResponse = apiClient.cardPaymentService().voidAuth(voidAuth);
Authorization authResponse = makeAuthRequest("processPartialAuthReversal");
AuthorizationReversal voidAuth =
AuthorizationReversal.builder()
.merchantRefNum(authResponse.getMerchantRefNum())
.authorizationId(authResponse.getId())
.amount(333)
.build();
AuthorizationReversal voidAuthResponse = apiClient.cardPaymentService().voidAuth(voidAuth);
AuthorizationReversalId authLookup = auth.getId();
AuthorizationReversal authLookupResponse = apiClient.cardPaymentService().getAuthReversal(authLookup);
AuthorizationReversalQuery authLookup =
AuthorizationReversalQuery.builder()
.merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
.build();
AuthorizationReversalResultSet results = apiClient.cardPaymentService().query(authLookup);
apiClient.cardPaymentService().approveHeldAuth(auth.getId());
apiClient.cardPaymentService().cancelHeldAuth(auth.getId());
Settlement settlement =
Settlement.builder()
.authorizationId(auth.getId())
.merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
.build();
Settlement settlementResponse = apiClient.cardPaymentService().settlement(settlement);
apiClient.cardPaymentService().cancelSettlement(settlementResponse.getId());
Settlement settleLookupResponse = apiClient.cardPaymentService().getSettlement(settlementResponse.getId());
SettlementQuery querySettlements =
SettlementQuery.builder()
.merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
.build();
SettlementResultSet settlements = apiClient.cardPaymentService().query(querySettlements);
Refund refund = Refund.builder()
.settlementId(settlement.getId())
.merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
.build();
Refund refundResponse = apiClient.cardPaymentService().refund(refund);
Refund refundResponse = apiClient.cardPaymentService().getRefund(refund.getId());
RefundQuery query = RefundQuery.builder()
.merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
.build();
RefundResultSet refundResultSet = apiClient.cardPaymentService().query(query);
Verification verification =
Verification.builder()
.merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
.card()
.cardNum("4111111111111111")
.cardExpiry()
.month(3)
.year(2023)
.done()
.cvv( "234" )
.done()
.profile()
.firstName(getRandomChars("Joe"))
.lastName("Smith")
.email("Joe.Smith@canada.com")
.done()
.billingDetails()
.street("100 Queen Street West")
.city("Toronto")
.state("ON")
.country("CA")
.zip("M5H2N2")
.done()
.customerIp("209.91.0.12")
.description("This is a test transaction")
.build();
Verification verificationResponse = apiClient.cardPaymentService().verify(verification);
Verification verificationResponse = apiClient.cardPaymentService().getVerification(verification.getId());
VerificationQuery queryVerification =
VerificationQuery.builder()
.merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
.build();
VerificationResultSet verifications = apiClient.cardPaymentService().query(queryVerification);