Create a generic payment session
1 min
code examples curl request post \\ \ url https //api sandbox judopay com/paymentsession \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ header 'api version 6 23' \\ \ data '{ "judoid" "100100100", "yourconsumerreference" "2b45fd3f cee5 4e7e 874f 28051db65408", "yourpaymentreference" "6482c678 cad3 4efd b081 aeae7a89a134", "yourpaymentmetadata" "{\\"internallocationref\\" \\"example\\",\\"internalid\\" 99}", "currency" "gbp", "cardaddress" { "address1" "cardholder house", "address2" "1 cardholder street", "town" "cardholder town", "postcode" "ab1 2cd", "state" "fl", "countrycode" "826" }, "phonecountrycode" "44", "threedsecure" { "challengerequestindicator" "nopreference" }, "hidebillinginfo" true, "hidereviewinfo" true, "primaryaccountdetails" { "name" "doe", "accountnumber" "12345678", "dateofbirth" "1980 01 31", "postcode" "ab1 2cd" } }'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); myheaders append("api version", "6 23"); var raw = json stringify({ "judoid" "100100100", "yourconsumerreference" "2b45fd3f cee5 4e7e 874f 28051db65408", "yourpaymentreference" "6482c678 cad3 4efd b081 aeae7a89a134", "yourpaymentmetadata" "{\\"internallocationref\\" \\"example\\",\\"internalid\\" 99}", "currency" "gbp", "cardaddress" { "address1" "cardholder house", "address2" "1 cardholder street", "town" "cardholder town", "postcode" "ab1 2cd", "state" "fl", "countrycode" "826" }, "phonecountrycode" "44", "threedsecure" { "challengerequestindicator" "nopreference" }, "hidebillinginfo" true, "hidereviewinfo" true, "primaryaccountdetails" { "name" "doe", "accountnumber" "12345678", "dateofbirth" "1980 01 31", "postcode" "ab1 2cd" } }); var requestoptions = { method 'post', headers myheaders, body raw, redirect 'follow' }; fetch("https //api sandbox judopay com/paymentsession", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "json" require "net/http" url = uri("https //api sandbox judopay com/paymentsession") https = net http new(url host, url port) https use ssl = true request = net http post new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" request\["api version"] = "6 23" request body = json dump({ "judoid" "100100100", "yourconsumerreference" "2b45fd3f cee5 4e7e 874f 28051db65408", "yourpaymentreference" "6482c678 cad3 4efd b081 aeae7a89a134", "yourpaymentmetadata" "{\\"internallocationref\\" \\"example\\",\\"internalid\\" 99}", "currency" "gbp", "cardaddress" { "address1" "cardholder house", "address2" "1 cardholder street", "town" "cardholder town", "postcode" "ab1 2cd", "state" "fl", "countrycode" "826" }, "phonecountrycode" "44", "threedsecure" { "challengerequestindicator" "nopreference" }, "hidebillinginfo" true, "hidereviewinfo" true, "primaryaccountdetails" { "name" "doe", "accountnumber" "12345678", "dateofbirth" "1980 01 31", "postcode" "ab1 2cd" } }) response = https request(request) puts response read body import requests import json url = "https //api sandbox judopay com/paymentsession" payload = json dumps({ "judoid" "100100100", "yourconsumerreference" "2b45fd3f cee5 4e7e 874f 28051db65408", "yourpaymentreference" "6482c678 cad3 4efd b081 aeae7a89a134", "yourpaymentmetadata" "{\\"internallocationref\\" \\"example\\",\\"internalid\\" 99}", "currency" "gbp", "cardaddress" { "address1" "cardholder house", "address2" "1 cardholder street", "town" "cardholder town", "postcode" "ab1 2cd", "state" "fl", "countrycode" "826" }, "phonecountrycode" "44", "threedsecure" { "challengerequestindicator" "nopreference" }, "hidebillinginfo" true, "hidereviewinfo" true, "primaryaccountdetails" { "name" "doe", "accountnumber" "12345678", "dateofbirth" "1980 01 31", "postcode" "ab1 2cd" } }) headers = { 'accept' 'application/json', 'content type' 'application/json', 'api version' '6 23' } response = requests request("post", url, headers=headers, data=payload) print(response text) responses // successful response { "expirydate" "2026 02 05t16 28 32 8596+00 00", "reference" "5qcaaaqaaaapaaaacaaaabtggvhbrf9bhtn7nqn1e0j4hvvmi y27dgpjwbmtls3gj xdg" }// bad request (api version header missing, or request body attributes invalid) // unauthorized { "requestid" "", "message" "", "code" 0, "category" 0 }// forbidden if token used does not have required permission { "requestid" "", "message" "", "code" 0, "category" 0 }