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
var authrization = new paysafeApiClient.Authorization();
var card = new paysafeApiClient.Card();
card.setPaymentToken("CdELTQJoyuHg6Ina");
authrization.setMerchantRefNum(Math.random().toString(36).slice(2));
authrization.setAmount("1000");
authrization.setSettleWithAuth("false");
authrization.setCard(card);
paysafeApiClient.cardServiceHandler(paysafeApiClient).authorize(
	authrization,
	function(error, response) {});
paysafeApiClient.cardServiceHandler(paysafeApiClient).authorize(
	authrization,
	function(error, response) {});
Request declined exception
var authrization = new paysafeApiClient.Authorization();
var card = new paysafeApiClient.Card();
card.setPaymentToken("CdELTQJoyuHg6Ina");
authrization.setMerchantRefNum(Math.random().toString(36).slice(2));
authrization.setAmount("1250000");
authrization.setCard(card);
paysafeApiClient.cardServiceHandler(paysafeApiClient).authorize(
	authrization,
	function(error, response) {});
Invalid credentials exception
var paysafeApiClient = new paysafeApiClient("devValue121345", "B-qa2-0-548ef29c8fa3617063ca4c69a", "TEST", "000000000000");
var order = new paysafeApiClient.Order();
order.setMerchantRefNum(Math.random().toString(36).slice(2));
order.setTotalAmount("1000");
order.setCurrencyCode("USD");
paysafeApiClient.HostedApiServiceHandler(paysafeApiClient).process(order,
	function(error, response) {});
Entity not found exception
var authrization = new paysafeApiClient.Authorization();
authrization.setId("3e148eb3-a0ed-403e-ba42-24982a953858");
paysafeApiClient.cardServiceHandler(paysafeApiClient).getAuth(authrization,
	function(error, response) {});
Invalid request exception
var billingDet = new paysafeApiClient.BillingDetails();
var authrization = new paysafeApiClient.Authorization();
var card = new paysafeApiClient.Card();
var cardExp = new paysafeApiClient.CardExpiry();
billingDet.setStreet("Carlos Pellegrini 551");
billingDet.setCity("Buenos Aires");
billingDet.setState("Zulia");
billingDet.setCountry("AR");
billingDet.setZip("C1009ABK1343434");
card.setCardNum("5191330000004415");
cardExp.setMonth("09");
cardExp.setYear("2019");
card.setCvv("579");
card.setCardExpiry(cardExp);
authrization.setMerchantRefNum(Math.random().toString(36).slice(2));
authrization.setAmount("100");
authrization.setSettleWithAuth("false");
authrization.setCard(card);
authrization.setBillingDetails(billingDet);
paysafeApiClient.cardServiceHandler(paysafeApiClient).authorize(
	authrization,
	function(error, response) {});
API exception
var authrization = new paysafeApiClient.Authorization();
paysafeApiClient.cardServiceHandler(paysafeApiClient).getAuth(authrization,
	function(error, response) {});
Did you find this page useful?