Server SDKs
Server SDK Integration
.NET and PHP Integrations
net and php sdks we no longer support the php sdk and it is now deprecated integration from visual studio launch nuget package manager search for judopay net add judopay net via gui, or package manager console add the judopay net package install package judopay net for examples on integrating with the net server sdk, see our sample app for more information prerequisites php 5 5 and above composer package manager integration using the composer package manager add the judopay package to your composer json file "require" {"judopay/judopay sdk" "5 1 0"} execute $ composer install make the judopay sdk classes available to your application, by adding the following to your file require 'vendor/autoload php'; for examples on integrating php with the server sdk, see our sample app for more information only sandbox api tokens and secrets will work in the sandbox using the wrong tokens and secrets will result in an authorisation failure setup ensure all integration steps are completed add your app’s sandbox token and secret var client = judopaymentsfactory create( judoenvironment sandbox, \<yourapitoken>, \<yourapisecret> ); ensure the sdk is configured for the sandbox environment use the test cards provided in the judopay portal tools > generating transactions create a separate app for your backend with the make payments permission enabled test all your required payment types in the sandbox environment before going live for our dotnetsdk core sample app, see dotnetsdk create a new judopay object, with your api credentials $judopay = new \judopay( array( 'apitoken' => 'your token', 'apisecret' => 'your secret', 'judoid' => 'your judo id', //set to true on production, defaults to false which is the sandbox 'useproduction' => false ) ); ensure the sdk is configured for the environment you are targeting for example, if you are using the sandbox environment 'useproduction' => false for the purpose of this exercise, the sandbox token and secret have been added the server sdk allows for further configuration logging to help debug you can attach a logger library validation error details can be found in the modelerrors array for example if a required field is missing from the model other payment methods using the server sdks to send payment requests with the wallet details from apple pay™ and google pay™, see our transaction api reference docid\ bcxnm5keok nlnrztafut for more information check card ensure your account supports the check card functionality contact developer support mailto\ developersupport\@judopay com for more details when making net and php integrations /#token payments , you can obtain the card token from the check card response create an instance of the checkcard model net //create an instance of the checkcard model var checkcardrequest = new checkcardmodel { judoid = "yourjudoid", yourconsumerreference = "yourconsumerreference", yourpaymentreference = "yourpaymentreference", cardnumber = "4976000000003436", expirydate = "12/25", cv2 = "452", cardaddress = new cardaddressmodel { address1 = "41 luke st", postcode = "ec2a 4dp", town = "london", countrycode = 826 }, // primaryaccountdetails only required for mcc6012 merchants primaryaccountdetails = new primaryaccountdetailsmodel { name = "smith", accountnumber = "1234567", dateofbirth = "2000 12 31", postcode = "ec2a 4dp" }, // following are for 3ds2 transactions phonecountrycode = "44", mobilenumber = "7999123456", emailaddress = "test user\@judopay com", cardholdername = "john smith", threedsecure = new threedsecuretwomodel { authenticationsource = threedsecuretwoauthenticationsource browser, challengerequestindicator = threedsecuretwochallengerequestindicator challengeasmandate, methodnotificationurl = "https //yourmethodnotificationurl", challengenotificationurl = "https //yourchallengenotificationurl" } }; //send the request to judopay var response = await client checkcards create(checkcardrequest); if (response haserror) { if (response error code == (int)httpstatuscode forbidden) { // failed to authenticate check your credentials } else if (response error modelerrors != null) { // validation failed on the request, check each list entry for details } else { // refer to https //docs judopay com/content/developer%20tools/codes htm#errors var errorcode = response error code; } } else if (response response is paymentrequiresthreedsecuretwomodel threedsecuretworesponsemodel) { if (threedsecuretworesponsemodel methodurl != null) { // device details are required post md as threedsmethoddata to methodurl var methodurl = threedsecuretworesponsemodel methodurl; var md = threedsecuretworesponsemodel md; } else if (threedsecuretworesponsemodel challengeurl != null) { // challenge is required post creq to challengeurl var challengeurl = threedsecuretworesponsemodel challengeurl; var creq = threedsecuretworesponsemodel creq; } } else if (response response is paymentreceiptmodel receipt) { var receiptid = receipt receiptid; var status = receipt result; if (receipt result == "success") { var cardtoken = receipt carddetails cardtoken; } } php deprecated //prepare the checkcard request $checkcardrequest = $judopay >getmodel('checkcard'); $checkcardrequest >setattributevalues( array( 'judoid' => 'yourjudoid', 'yourconsumerreference' => 'yourconsumerreference', 'yourpaymentreference' => 'yourpaymentreference', 'cardnumber' => '4976000000003436', 'expirydate' => '12/25', 'cv2' => '452', 'cardaddress' => array( 'address1' => '41 luke st', 'postcode' => 'ec2a 4dp', 'town' => 'london', 'countrycode' => 826 ), // primaryaccountdetails only required for mcc6012 merchants 'primaryaccountdetails' => array( 'name' => 'smith', 'accountnumber' => '1234567', 'dateofbirth' => '2000 12 31', 'postcode' => 'ec2a 4dp' ), // following are for 3ds2 transactions 'phonecountrycode' => '44', 'mobilenumber' => '7999123456', 'emailaddress' => 'test user\@judopay com', 'cardholdername' => 'john smith', 'threedsecure' => array( 'authenticationsource' => 'browser', 'challengerequestindicator' => 'challengeasmandate', 'methodnotificationurl' => 'https //yourmethodnotificationurl', 'challengenotificationurl' => 'https //yourmethodnotificationurl' ) ) ); try { //send the request to judopay $response = $checkcardrequest >create(); if ($response\['methodurl']) { // device details are required post md as threedsmethoddata to methodurl $methodurl = $response\['methodurl']; $md = $response\['md']; } else if ($response\['challengeurl']) { // challenge is required post creq to challengeurl $challengeurl = $response\['challengeurl']; $creq = $response\['creq']; } else { $receiptid = $response\['receiptid']; if ($response\['result'] == 'success') { $cardtoken = $response\['carddetails']\['cardtoken']; } } } catch (\judopay\exception\apiexception $apiexception) { $errorresponse = "{\\"error\\" \\"{$apiexception >getsummary()}\\",\\"result\\" \\"error\\"}"; } catch (\judopay\exception\validationerror $validationerrors) { // required attributes are missing from the request $errorresponse = "{\\"error\\" \\"{$validationerrors >getsummary()}\\",\\"result\\" \\"error\\"}"; } catch (\exception $e) { $errorresponse = "{\\"error\\" \\"" $e >getmessage() "\\",\\"result\\" \\"error\\"}"; } you do not need to set an amount this is automatically set by judopay's transaction api in order to check the card true false 254false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type if result haserror = false , check the net and php integrations docid\ hnglljxesinhs7ptfevtn response save card use savecard to save the consumer's card details in judopay's card vault when making net and php integrations /#token payments , you can obtain the card token from the save card response create an instance of the savecardmodel net //create an instance of the savecardmodel var savecardrequest = new savecardmodel() { judoid = "yourjudoid", yourconsumerreference = "yourconsumerreference", cardnumber = "4976000000003436", expirydate = "12/25" }; //send the request to judopay var response = await client savecards create(savecardrequest); if (response haserror) { if (response error code == (int)httpstatuscode forbidden) { // failed to authenticate check your credentials } else if (response error modelerrors != null) { // validation failed on the request, check each list entry for details } else { // refer to https //docs judopay com/content/developer%20tools/codes htm#errors var errorcode = response error code; } } else if (response response is paymentreceiptmodel receipt) { var receiptid = receipt receiptid; var status = receipt result; if (receipt result == "success") { var cardtoken = receipt carddetails cardtoken; } } php deprecated //prepare the savecard request $savecardrequest = $judopay >getmodel('savecard'); $savecardrequest >setattributevalues( array( 'judoid' => 'yourjudoid', 'yourconsumerreference' => 'yourconsumerreference', 'cardnumber' => '4976000000003436', 'expirydate' => '12/25' ) ); try { //send the request to judopay $response = $savecardrequest >create(); $receiptid = $response\['receiptid']; if ($response\['result'] == 'success') { $cardtoken = $response\['carddetails']\['cardtoken']; } } catch (\judopay\exception\apiexception $apiexception) { $errorresponse = "{\\"error\\" \\"{$apiexception >getsummary()}\\",\\"result\\" \\"error\\"}"; } catch (\judopay\exception\validationerror $validationerrors) { // required attributes are missing from the request $errorresponse = "{\\"error\\" \\"{$validationerrors >getsummary()}\\",\\"result\\" \\"error\\"}"; } catch (\exception $e) { $errorresponse = "{\\"error\\" \\"" $e >getmessage() "\\",\\"result\\" \\"error\\"}"; } true false 217false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type if result haserror = false , check the net and php integrations docid\ hnglljxesinhs7ptfevtn response token payments you can create a token payment following a payment | preauth | save card operation, as a card token is always returned create an instance of the tokenpaymentmodel net //create an instance of the tokenpaymentmodel model var tokenpaymentrequest = new tokenpaymentmodel { judoid = "yourjudoid", yourconsumerreference = "yourconsumerreference", yourpaymentreference = "yourpaymentreference", cardtoken = "cardtokenfromprevioustransaction", // cv2 only required if required by your gateway cv2 = "452", amount = 1 01m, currency = "gbp", cardaddress = new cardaddressmodel { address1 = "41 luke st", postcode = "ec2a 4dp", town = "london", countrycode = 826 }, // primaryaccountdetails only required for mcc6012 merchants primaryaccountdetails = new primaryaccountdetailsmodel { name = "smith", accountnumber = "1234567", dateofbirth = "2000 12 31", postcode = "ec2a 4dp" }, // following are for 3ds2 customer initiated transactions phonecountrycode = "44", mobilenumber = "7999123456", emailaddress = "test user\@judopay com", cardholdername = "john smith", threedsecure = new threedsecuretwomodel { authenticationsource = threedsecuretwoauthenticationsource browser, challengerequestindicator = threedsecuretwochallengerequestindicator challengeasmandate, methodnotificationurl = "https //yourmethodnotificationurl", challengenotificationurl = "https //yourchallengenotificationurl" }, // following are for merchant initiated transactions recurringpayment = true, recurringpaymenttype = recurringpaymenttype mit, // unscheduled, use recurring for scheduled payments relatedreceiptid = "receiptidoforiginalcustomerinitiatedtransaction" }; //send the request to judopay var response = await client payments create(tokenpaymentrequest); if (response haserror) { if (response error code == (int)httpstatuscode forbidden) { // failed to authenticate check your credentials } else if (response error modelerrors != null) { // validation failed on the request, check each list entry for details } else { // refer to https //docs judopay com/content/developer%20tools/codes htm#errors var errorcode = response error code; } } else if (response response is paymentrequiresthreedsecuretwomodel threedsecuretworesponsemodel) { if (threedsecuretworesponsemodel methodurl != null) { // device details are required post md as threedsmethoddata to methodurl var methodurl = threedsecuretworesponsemodel methodurl; var md = threedsecuretworesponsemodel md; } else if (threedsecuretworesponsemodel challengeurl != null) { // challenge is required post creq to challengeurl var challengeurl = threedsecuretworesponsemodel challengeurl; var creq = threedsecuretworesponsemodel creq; } } else if (response response is paymentreceiptmodel receipt) { var receiptid = receipt receiptid; var status = receipt result; if (receipt result == "success") { var cardtoken = receipt carddetails cardtoken; } } php deprecated //prepare the tokenpayment request $tokenpaymentrequest = $judopay >getmodel('tokenpayment'); $tokenpaymentrequest >setattributevalues( array( 'judoid' => 'yourjudoid', 'yourconsumerreference' => 'yourconsumerreference', 'yourpaymentreference' => 'yourpaymentreference', 'cardtoken' => 'cardtokenfromprevioustransaction', 'cv2' => '452', 'amount' => 1 01, 'currency' => 'gbp', // primaryaccountdetails only required for mcc6012 merchants 'primaryaccountdetails' => array( 'name' => 'smith', 'accountnumber' => '1234567', 'dateofbirth' => '2000 12 31', 'postcode' => 'ec2a 4dp' ), // following are for 3ds2 customer initiated transactions 'phonecountrycode' => '44', 'mobilenumber' => '7999123456', 'emailaddress' => 'test user\@judopay com', 'cardholdername' => 'john smith', 'threedsecure' => array( 'authenticationsource' => 'browser', 'challengerequestindicator' => 'challengeasmandate', 'methodnotificationurl' => 'https //yourmethodnotificationurl', 'challengenotificationurl' => 'https //yourmethodnotificationurl' ), // following are for merchant initiated transactions 'recurringpayment' => true, 'recurringpaymenttype' => 'mit', // unscheduled, use recurring for scheduled payments 'relatedreceiptid' => 'receiptidoforiginalcustomerinitiatedtransaction' ) ); try { //send the request to judopay $response = $tokenpaymentrequest >create(); if ($response\['methodurl']) { // device details are required post md as threedsmethoddata to methodurl $methodurl = $response\['methodurl']; $md = $response\['md']; } else if ($response\['challengeurl']) { // challenge is required post creq to challengeurl $challengeurl = $response\['challengeurl']; $creq = $response\['creq']; } else { $receiptid = $response\['receiptid']; if ($response\['result'] == 'success') { $cardtoken = $response\['carddetails']\['cardtoken']; } } } catch (\judopay\exception\apiexception $apiexception) { $errorresponse = "{\\"error\\" \\"{$apiexception >getsummary()}\\",\\"result\\" \\"error\\"}"; } catch (\judopay\exception\validationerror $validationerrors) { // required attributes are missing from the request $errorresponse = "{\\"error\\" \\"{$validationerrors >getsummary()}\\",\\"result\\" \\"error\\"}"; } catch (\exception $e) { $errorresponse = "{\\"error\\" \\"" $e >getmessage() "\\",\\"result\\" \\"error\\"}"; } true false 251false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type if result haserror = false , check the net and php integrations docid\ hnglljxesinhs7ptfevtn response creating a preauth create an instance of the cardpayment model net //create an instance of the cardpayment model var preauthrequest = new cardpaymentmodel { judoid = "yourjudoid", yourconsumerreference = "yourconsumerreference", yourpaymentreference = "yourpaymentreference", cardnumber = "4976000000003436", expirydate = "12/25", cv2 = "452", amount = 1 01m, currency = "gbp", cardaddress = new cardaddressmodel { address1 = "41 luke st", postcode = "ec2a 4dp", town = "london", countrycode = 826 }, // primaryaccountdetails only required for mcc6012 merchants primaryaccountdetails = new primaryaccountdetailsmodel { name = "smith", accountnumber = "1234567", dateofbirth = "2000 12 31", postcode = "ec2a 4dp" }, // following are for 3ds2 transactions phonecountrycode = "44", mobilenumber = "7999123456", emailaddress = "test user\@judopay com", cardholdername = "john smith", threedsecure = new threedsecuretwomodel { authenticationsource = threedsecuretwoauthenticationsource browser, challengerequestindicator = threedsecuretwochallengerequestindicator challengeasmandate, methodnotificationurl = "https //yourmethodnotificationurl", challengenotificationurl = "https //yourchallengenotificationurl" } }; //send the request to judopay var response = await client preauths create(preauthrequest); if (response haserror) { if (response error code == (int)httpstatuscode forbidden) { // failed to authenticate check your credentials } else if (response error modelerrors != null) { // validation failed on the request, check each list entry for details } else { // refer to https //docs judopay com/content/developer%20tools/codes htm#errors var errorcode = response error code; } } else if (response response is paymentrequiresthreedsecuretwomodel threedsecuretworesponsemodel) { if (threedsecuretworesponsemodel methodurl != null) { // device details are required post md as threedsmethoddata to methodurl var methodurl = threedsecuretworesponsemodel methodurl; var md = threedsecuretworesponsemodel md; } else if (threedsecuretworesponsemodel challengeurl != null) { // challenge is required post creq to challengeurl var challengeurl = threedsecuretworesponsemodel challengeurl; var creq = threedsecuretworesponsemodel creq; } } else if (response response is paymentreceiptmodel receipt) { var receiptid = receipt receiptid; var status = receipt result; if (receipt result == "success") { var cardtoken = receipt carddetails cardtoken; } } php deprecated //prepare the preauth request $preauthrequest = $judopay >getmodel('preauth'); $preauthrequest >setattributevalues( array( 'judoid' => 'yourjudoid', 'yourconsumerreference' => 'yourconsumerreference', 'yourpaymentreference' => 'yourpaymentreference', 'cardnumber' => '4976000000003436', 'expirydate' => '12/25', 'cv2' => '452', 'amount' => 1 01, 'currency' => 'gbp', 'cardaddress' => array( 'address1' => '41 luke st', 'postcode' => 'ec2a 4dp', 'town' => 'london', 'countrycode' => 826 ), // primaryaccountdetails only required for mcc6012 merchants 'primaryaccountdetails' => array( 'name' => 'smith', 'accountnumber' => '1234567', 'dateofbirth' => '2000 12 31', 'postcode' => 'ec2a 4dp' ), // following are for 3ds2 transactions 'phonecountrycode' => '44', 'mobilenumber' => '7999123456', 'emailaddress' => 'test user\@judopay com', 'cardholdername' => 'john smith', 'threedsecure' => array( 'authenticationsource' => 'browser', 'challengerequestindicator' => 'challengeasmandate', 'methodnotificationurl' => 'https //yourmethodnotificationurl', 'challengenotificationurl' => 'https //yourmethodnotificationurl' ) ) ); try { //send the request to judopay $response = $preauthrequest >create(); if ($response\['methodurl']) { // device details are required post md as threedsmethoddata to methodurl $methodurl = $response\['methodurl']; $md = $response\['md']; } else if ($response\['challengeurl']) { // challenge is required post creq to challengeurl $challengeurl = $response\['challengeurl']; $creq = $response\['creq']; } else { $receiptid = $response\['receiptid']; if ($response\['result'] == 'success') { $cardtoken = $response\['carddetails']\['cardtoken']; } } } catch (\judopay\exception\apiexception $apiexception) { $errorresponse = "{\\"error\\" \\"{$apiexception >getsummary()}\\",\\"result\\" \\"error\\"}"; } catch (\judopay\exception\validationerror $validationerrors) { // required attributes are missing from the request $errorresponse = "{\\"error\\" \\"{$validationerrors >getsummary()}\\",\\"result\\" \\"error\\"}"; } catch (\exception $e) { $errorresponse = "{\\"error\\" \\"" $e >getmessage() "\\",\\"result\\" \\"error\\"}"; } true false 250false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type if result haserror = false , check the net and php integrations docid\ hnglljxesinhs7ptfevtn response creating a collection partial collections are supported use the same receiptid to collect different amounts up to the original preauth amount you cannot collect more than the original amount following the net and php integrations /#creating a preauth , prepare the collection net // create an instance of the collection model var collectionrequest = new collectionmodel() { receiptid = yourpreauthreceiptid, amount = 1 01m // optional, if not specified full preauth amount will be collected }; //send the request to judopay var response = await client collections create(collectionrequest); if (response haserror) { if (response error code == (int)httpstatuscode forbidden) { // failed to authenticate check your credentials } else if (response error modelerrors != null) { // validation failed on the request, check each list entry for details } else { // refer to https //docs judopay com/content/developer%20tools/codes htm#errors var errorcode = response error code; } } else if (response response is paymentreceiptmodel receipt) { var receiptid = receipt receiptid; var status = receipt result; } php deprecated //prepare the collection request $collectionrequest = $judopay >getmodel('collection'); $collectionrequest >setattributevalues( array( 'receiptid' => 'yourpreauthreceiptid', 'yourpaymentreference' => 'yourcollectionreference', 'amount' => 1 01 ) ); try { //send the request to judopay $response = $collectionrequest >create(); $receiptid = $response\['receiptid']; $status = $response\['result']; } catch (\judopay\exception\apiexception $apiexception) { $errorresponse = "{\\"error\\" \\"{$apiexception >getsummary()}\\",\\"result\\" \\"error\\"}"; } catch (\judopay\exception\validationerror $validationerrors) { // required attributes are missing from the request $errorresponse = "{\\"error\\" \\"{$validationerrors >getsummary()}\\",\\"result\\" \\"error\\"}"; } catch (\exception $e) { $errorresponse = "{\\"error\\" \\"" $e >getmessage() "\\",\\"result\\" \\"error\\"}"; } true false 243false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type check the net and php integrations docid\ hnglljxesinhs7ptfevtn response voiding a preauth transaction cancel a pre authorised transaction if the funds have not yet settled voids cannot be performed on transactions that have been collected (partial or full) create a void request net // create an instance of the void model var voidrequest = new voidmodel() { receiptid = yourpreauthreceiptid }; //send the request to judopay var response = await client voids create(voidrequest); if (response haserror) { if (response error code == (int)httpstatuscode forbidden) { // failed to authenticate check your credentials } else if (response error modelerrors != null) { // validation failed on the request, check each list entry for details } else { // refer to https //docs judopay com/content/developer%20tools/codes htm#errors var errorcode = response error code; } } else if (response response is paymentreceiptmodel receipt) { var receiptid = receipt receiptid; var status = receipt result; } php deprecated //prepare the void request $voidrequest = $judopay >getmodel('voidtransaction'); $voidrequest >setattributevalues( array( 'judoid' => 'yourjudoid', // this attribute will not be required in the next version of the sdk 'receiptid' => 'yourpreauthreceiptid', 'yourpaymentreference' => 'yourvoidreference', 'amount' => 1 01 ) ); try { //send the request to judopay $response = $voidrequest >create(); $receiptid = $response\['receiptid']; $status = $response\['result']; } catch (\judopay\exception\apiexception $apiexception) { $errorresponse = "{\\"error\\" \\"{$apiexception >getsummary()}\\",\\"result\\" \\"error\\"}"; } catch (\judopay\exception\validationerror $validationerrors) { // required attributes are missing from the request $errorresponse = "{\\"error\\" \\"{$validationerrors >getsummary()}\\",\\"result\\" \\"error\\"}"; } catch (\exception $e) { $errorresponse = "{\\"error\\" \\"" $e >getmessage() "\\",\\"result\\" \\"error\\"}"; } true false 243false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type if result haserror = false , check the net and php integrations docid\ hnglljxesinhs7ptfevtn response creating a payment when handling exceptions, it is good practice to use try catch block create an instance of the cardpayment model net //create an instance of the cardpayment model var paymentrequest = new cardpaymentmodel { judoid = "yourjudoid", yourconsumerreference = "yourconsumerreference", yourpaymentreference = "yourpaymentreference", cardnumber = "4976000000003436", expirydate = "12/25", cv2 = "452", amount = 1 01m, currency = "gbp", cardaddress = new cardaddressmodel { address1 = "41 luke st", postcode = "ec2a 4dp", town = "london", countrycode = 826 }, // primaryaccountdetails only required for mcc6012 merchants primaryaccountdetails = new primaryaccountdetailsmodel { name = "smith", accountnumber = "1234567", dateofbirth = "2000 12 31", postcode = "ec2a 4dp" }, // following are for 3ds2 transactions phonecountrycode = "44", mobilenumber = "7999123456", emailaddress = "test user\@judopay com", cardholdername = "john smith", threedsecure = new threedsecuretwomodel { authenticationsource = threedsecuretwoauthenticationsource browser, challengerequestindicator = threedsecuretwochallengerequestindicator challengeasmandate, methodnotificationurl = "https //yourmethodnotificationurl", challengenotificationurl = "https //yourchallengenotificationurl" } }; //send the request to judopay var response = await client payments create(paymentrequest); if (response haserror) { if (response error code == (int)httpstatuscode forbidden) { // failed to authenticate check your credentials } else if (response error modelerrors != null) { // validation failed on the request, check each list entry for details } else { // refer to https //docs judopay com/content/developer%20tools/codes htm#errors var errorcode = response error code; } } else if (response response is paymentrequiresthreedsecuretwomodel threedsecuretworesponsemodel) { if (threedsecuretworesponsemodel methodurl != null) { // device details are required post md as threedsmethoddata to methodurl var methodurl = threedsecuretworesponsemodel methodurl; var md = threedsecuretworesponsemodel md; } else if (threedsecuretworesponsemodel challengeurl != null) { // challenge is required post creq to challengeurl var challengeurl = threedsecuretworesponsemodel challengeurl; var creq = threedsecuretworesponsemodel creq; } } else if (response response is paymentreceiptmodel receipt) { var receiptid = receipt receiptid; var status = receipt result; if (receipt result == "success") { var cardtoken = receipt carddetails cardtoken; } } php deprecated //prepare the payment request $paymentrequest = $judopay >getmodel('payment'); $paymentrequest >setattributevalues( array( 'judoid' => 'yourjudoid', 'yourconsumerreference' => 'yourconsumerreference', 'yourpaymentreference' => 'yourpaymentreference', 'cardnumber' => '4976000000003436', 'expirydate' => '12/25', 'cv2' => '452', 'amount' => 1 01, 'currency' => 'gbp', 'cardaddress' => array( 'address1' => '41 luke st', 'postcode' => 'ec2a 4dp', 'town' => 'london', 'countrycode' => 826 ), // primaryaccountdetails only required for mcc6012 merchants 'primaryaccountdetails' => array( 'name' => 'smith', 'accountnumber' => '1234567', 'dateofbirth' => '2000 12 31', 'postcode' => 'ec2a 4dp' ), // following are for 3ds2 transactions 'phonecountrycode' => '44', 'mobilenumber' => '7999123456', 'emailaddress' => 'test user\@judopay com', 'cardholdername' => 'john smith', 'threedsecure' => array( 'authenticationsource' => 'browser', 'challengerequestindicator' => 'challengeasmandate', 'methodnotificationurl' => 'https //yourmethodnotificationurl', 'challengenotificationurl' => 'https //yourmethodnotificationurl' ) ) ); try { //send the request to judopay $response = $paymentrequest >create(); if ($response\['methodurl']) { // device details are required post md as threedsmethoddata to methodurl $methodurl = $response\['methodurl']; $md = $response\['md']; } else if ($response\['challengeurl']) { // challenge is required post creq to challengeurl $challengeurl = $response\['challengeurl']; $creq = $response\['creq']; } else { $receiptid = $response\['receiptid']; if ($response\['result'] == 'success') { $cardtoken = $response\['carddetails']\['cardtoken']; } } } catch (\judopay\exception\apiexception $apiexception) { $errorresponse = "{\\"error\\" \\"{$apiexception >getsummary()}\\",\\"result\\" \\"error\\"}"; } catch (\judopay\exception\validationerror $validationerrors) { // required attributes are missing from the request $errorresponse = "{\\"error\\" \\"{$validationerrors >getsummary()}\\",\\"result\\" \\"error\\"}"; } catch (\exception $e) { $errorresponse = "{\\"error\\" \\"" $e >getmessage() "\\",\\"result\\" \\"error\\"}"; } true false 250false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type if result haserror = false , check the net and php integrations docid\ hnglljxesinhs7ptfevtn response 3d secure 2 transaction flow authenticate a 3d secure 2 transaction to allow for additional transaction checks required for compliance with strong customer authentication (sca) for more information on 3d secure 2 and sca, see managing sca compliance docid\ ulg1ucayg3ljb7t0svcw5 make sure your account has 3d secure 2 api credentials enabled contact customer support to set this up the instance of the cardpaymentmodel you created for net and php integrations /#creating a payment , just needs the following additional 3d secure 2 parameters to be included net // see payment, preauth sections for details of how to trigger an initial transaction with required 3ds2 attributes // if the response indicated device details check are required, post the returned md (as an attribute named // threedsmethoddata) to the returned methodurl, and wait for a call from acs to the methodnotificationurl supplied on // the initial transaction // once the call to the methodnotificationurl has been received, create an instance of the resumethreedsecuretwo model var resumethreedsrequest = new resumethreedsecuretwomodel() { methodcompletion = methodcompletion yes, cv2 = "452", // primaryaccountdetails only required for mcc6012 merchants primaryaccountdetails = new primaryaccountdetailsmodel { name = "smith", accountnumber = "1234567", dateofbirth = "2000 12 31", postcode = "ec2a 4dp" }, }; // use the receiptid from the original transaction response var resumeresponse = await client threeds resume3dsecuretwo(result response receiptid, resumethreedsrequest); if (resumeresponse haserror) { if (resumeresponse error code == (int)httpstatuscode forbidden) { // failed to authenticate check your credentials } else if (resumeresponse error modelerrors != null) { // validation failed on the request, check each list entry for details } else { // refer to https //docs judopay com/content/developer%20tools/codes htm#errors var errorcode = resumeresponse error code; } } else if (resumeresponse response is paymentrequiresthreedsecuretwomodel resumechallengerequiredmodel) { // challenge is required post creq to challengeurl var challengeurl = resumechallengerequiredmodel challengeurl; var creq = resumechallengerequiredmodel creq; } else if (resumeresponse response is paymentreceiptmodel resumereceipt) { // transaction has been processed var receiptid = resumereceipt receiptid; var status = resumereceipt result; } // if either the initial transaction response, or the resume response, indicated a challenge is required, post the // returned creq to the returned challengeurl, and wait for a call from acs to the challengenotificationurl supplied on // the initial transaction // once the call to the challengenotificationurl has been received, create an instance of the completethreedsecuretwo // model var completethreedsrequest = new completethreedsecuretwomodel() { cv2 = "452", // primaryaccountdetails only required for mcc6012 merchants primaryaccountdetails = new primaryaccountdetailsmodel { name = "smith", accountnumber = "1234567", dateofbirth = "2000 12 31", postcode = "ec2a 4dp" } }; // use the receiptid from the original transaction response var completeresponse = await client threeds complete3dsecuretwo(result response receiptid, completethreedsrequest); if (completeresponse haserror) { if (completeresponse error code == (int)httpstatuscode forbidden) { // failed to authenticate check your credentials } else if (completeresponse error modelerrors != null) { // validation failed on the request, check each list entry for details } else { // refer to https //docs judopay com/content/developer%20tools/codes htm#errors var errorcode = completeresponse error code; } } else if (resumeresponse response is paymentreceiptmodel completereceipt) { // transaction has been processed var receiptid = completereceipt receiptid; var status = completereceipt result; } php deprecated // see payment, preauth sections for details of how to trigger an initial transaction with required 3ds2 attributes // if the response indicated device details check are required, post the returned md (as an attribute named // threedsmethoddata) to the returned methodurl, and wait for a call from acs to the methodnotificationurl supplied on // the initial transaction // once the call to the methodnotificationurl has been received, resume the transaction flow to judopay $resumerequest = $judopay >getmodel('resumethreedsecuretwo'); $resumerequest >setattributevalues( array( 'receiptid' => $response\['receiptid'], // receiptid of the original transaction 'methodcompletion' => 'yes', 'cv2' => '452', // primaryaccountdetails only required for mcc6012 merchants 'primaryaccountdetails' => array( 'name' => 'smith', 'accountnumber' => '1234567', 'dateofbirth' => '2000 12 31', 'postcode' => 'ec2a 4dp' ) ) ); try { //send the request to judopay $resumeresponse = $resumerequest >update(); if ($resumeresponse\['challengeurl']) { // challenge is required post creq to challengeurl $challengeurl = $resumeresponse\['challengeurl']; $creq = $resumeresponse\['creq']; } else { // transaction has been processed $receiptid = $response\['receiptid']; $status = $response\['result']; } } catch (\judopay\exception\apiexception $resumeapiexception) { $resumeerrorresponse = "{\\"error\\" \\"{$resumeapiexception >getsummary()}\\",\\"result\\" \\"error\\"}"; } catch (\judopay\exception\validationerror $resumevalidationerrors) { // required attributes are missing from the request $resumeerrorresponse = "{\\"error\\" \\"{$resumevalidationerrors >getsummary()}\\",\\"result\\" \\"error\\"}"; } catch (\exception $resumeexception) { $resumeerrorresponse = "{\\"error\\" \\"" $resumeexception >getmessage() "\\",\\"result\\" \\"error\\"}"; } // if either the initial transaction response, or the resume response, indicated a challenge is required, post the // returned creq to the returned challengeurl, and wait for a call from acs to the challengenotificationurl supplied on // the initial transaction // once the call to the challengenotificationurl has been received, complete the transaction flow to judopay $completerequest = $judopay>getmodel('completethreedsecuretwo'); $completerequest >setattributevalues( array( 'receiptid' => $response\['receiptid'], // receiptid of the original transaction 'cv2' => '452', // primaryaccountdetails only required for mcc6012 merchants 'primaryaccountdetails' => array( 'name' => 'smith', 'accountnumber' => '1234567', 'dateofbirth' => '2000 12 31', 'postcode' => 'ec2a 4dp' ) ) ); try { //send the request to judopay $completeresponse = $completerequest >update(); // transaction has been processed $receiptid = $completeresponse\['receiptid']; $status = $completeresponse\['result']; } catch (\judopay\exception\apiexception $completeapiexception) { $completeerrorresponse = "{\\"error\\" \\"{$completeapiexception >getsummary()}\\",\\"result\\" \\"error\\"}"; } catch (\judopay\exception\validationerror $completevalidationerrors) { // required attributes are missing from the request $completeerrorresponse = "{\\"error\\" \\"{$completevalidationerrors >getsummary()}\\",\\"result\\" \\"error\\"}"; } catch (\exception $completeexception) { $completeerrorresponse = "{\\"error\\" \\"" $completeexception >getmessage() "\\",\\"result\\" \\"error\\"}"; } additional 3d secure 2 parameters true false 223false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type if no additional transaction checks are required, you will receive the usual paymentreceipt response if additional transaction checks are required, you will receive the challenge response resumethreedsecuretwo model parameters true false 244false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type completethreedsecuretwo model parameters true false 236false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type check the net and php integrations docid\ hnglljxesinhs7ptfevtn response payment receipt payment receipt model parameters true false 272false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type creating a refund you can process a full or partial refund ensure the refund payments permission is enabled on your api token create a refund request net // create an instance of the refund model var refundrequest = new refundmodel() { receiptid = yourpaymentreceiptid, amount = 1 01m // optional, if not specified full payment amount will be refunded }; //send the request to judopay var response = await client refunds create(refundrequest); if (response haserror) { if (response error code == (int)httpstatuscode forbidden) { // failed to authenticate check your credentials } else if (response error modelerrors != null) { // validation failed on the request, check each list entry for details } else { // refer to https //docs judopay com/content/developer%20tools/codes htm#errors var errorcode = response error code; } } else if (response response is paymentreceiptmodel receipt) { var receiptid = receipt receiptid; var status = receipt result; } php deprecated //prepare the refund request $refundrequest = $judopay >getmodel('refund'); $refundrequest >setattributevalues( array( 'receiptid' => 'yourpaymentreceiptid', 'yourpaymentreference' => 'yourrefundreference', 'amount' => 1 01 // optional, if not specified full payment amount will be refunded ) ); try { //send the request to judopay $response = $refundrequest >create(); $receiptid = $response\['receiptid']; $status = $response\['result']; } catch (\judopay\exception\apiexception $apiexception) { $errorresponse = "{\\"error\\" \\"{$apiexception >getsummary()}\\",\\"result\\" \\"error\\"}"; } catch (\judopay\exception\validationerror $validationerrors) { // required attributes are missing from the request $errorresponse = "{\\"error\\" \\"{$validationerrors >getsummary()}\\",\\"result\\" \\"error\\"}"; } catch (\exception $e) { $errorresponse = "{\\"error\\" \\"" $e >getmessage() "\\",\\"result\\" \\"error\\"}"; } true false 243false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type check the net and php integrations docid\ hnglljxesinhs7ptfevtn response going live test all your required transaction types in the live environment before deploying your app you will need to have tested your app in the sandbox environment before going live activate your account to process live payments, ensure you have a live account complete the activation form for us to make the necessary changes to your account we will contact you as soon as you are live point to the live environment replace your sandbox api token and secret for the live api token and secret find these in judopay portal > your apps > { app name } > live tokens net //in the judopaymentsfactory create //method, change the environment from sandbox to live var client = judopaymentsfactory create(judoenvironment live, "your api token", "your api secret"); php deprecated //in the judopay object change the production environment setting from false to true 'useproduction' => true $judopay = new \judopay( array( 'apitoken' => 'your token, 'apisecret' => 'your secret', 'judoid' => 'your judo id', //set to true on production, defaults to false which is the sandbox 'useproduction' => true ) ); test live payments ensure the sdk is properly configured for the live environment use real debit or credit cards test cards provided will not work in live we recommend to perform pre authorizations followed by a void, or regular payments followed by a refund send a refund through the judopay portal > history test all payment scenarios and security features to verify the expected behaviour