Exceptions

The Paysafe APIs allow for certain exceptions to be requested, e.g., invalid credentials, thereby ensuring reliable payment processing.

Click the links below to view our code samples.

Request conflict exception
apiClient.cardPaymentService().authorize(auth);
apiClient.cardPaymentService().authorize(auth);
Request declined exception
Authorization auth =
   Authorization.builder()
     .merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
     .amount(4) //The bank has requested that you process the transaction manually by calling the card
     .settleWithAuth(true)
     .card()
       .cardNum("4111111111111111")
       .cvv(123)
       .cardExpiry()
         .month(2)
         .year(2023)
         .done()
       .done()
     .billingDetails()
       .zip("M5H 2N2")
     .done()
     .build();

   apiClient.cardPaymentService().authorize(auth);
Invalid credentials exception
NetBanxApiClient invalidClient = new NetBanxApiClient("invalid-key", "invalid-code", Environment.TEST, 12345);

Authorization auth =
    Authorization.builder()
      .id("123456789")
      .done()
      .build();

  invalidClient.cardPaymentService().authorize(auth);
Entity not found exception
AuthorizationId authId = AuthorizationId.builder().id("errorTest").build();
apiClient.cardPaymentService().getAuth(authId);
Invalid request exception
Authorization auth =
   Authorization.builder()
     .merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
     .amount(10)
     .card()
       .cardNum("4111111111111111")
       .cvv(123)
       .cardExpiry()
         .month(2)
         .year(2023)
         .done()
       .done()
     .build();

   apiClient.cardPaymentService().authorize(auth);
API exception
Authorization auth =
   Authorization.builder()
     .merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
     .amount(6)
     .settleWithAuth(true)
     .card()
       .cardNum("4111111111111111")
       .cvv(123)
       .cardExpiry()
         .month(2)
         .year(2023)
         .done()
       .done()
     .billingDetails()
       .zip("M5H 2N2")
       .done()
     .build();

   apiClient.cardPaymentService().authorize(auth);
Did you find this page useful?