Configuration
For configuration code samples, see our Configuration Code for SDKs article.
Apple Pay
// create the card object
CreditCardData card = new CreditCardData();
card.setToken("{\"version\":\"EC_v1\",\"data\":\"dvMNzlcy6WNB\",\"header\":{\"ephemeralPublicKey\":\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEeyyM++BjGrlaodphlJUvfTx4tQwn5Ci9IGpAI3RvbYqEshGX5cdkl0j7yNEu913OgT99r/MU1wqHnXn4p7qosA==\",\"publicKeyHash\":\"rEYX/7PdO7F7xL7rH0LZVak/iXTrkeU89Ck7E9dGFO4=\",\"transactionId\":\"38bb5ca49bc54c70e6ff5996bd087f1cce27f0f84fca2f6e71871fc7a56d877e\"}}");
card.setMobileType(MobilePaymentMethodType.APPLEPAY);
Transaction response;
try {
// process an auto-capture authorization
response =
card
.charge(10.00)
.withModifier(TransactionModifier.EncryptedMobile)
.withCurrency("EUR")
.execute();
// get the details to save to the DB for future requests
String result = response.getResponseCode(); // SUCCESS
String message = response.getResponseMessage(); // CAPTURED
String authCode = response.getAuthorizationCode(); // 12345
String paymentsReference = response.getTransactionId(); // TRN_vTijtcUtg2lPsUTvc0bQXH3U9vn2IK_a8ddd8f7c0fc
}
catch (ApiException ex) {
// TODO: add your error handling here
}
// create the card object
$card = new CreditCardData();
$card->token = '{"version":"EC_v1","data":"dvMNzlcy6WNB","header":{"ephemeralPublicKey":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWdNhNAHy9kO2Kol33kIh7k6wh6E",'
.'transactionId":"fd88874954acdb299c285f95a3202ad1f330d3fd4ebc22a864398684198644c3","publicKeyHash":"h7WnNVz2gmpTSkHqETOWsskFPLSj31e3sPTS2cBxgrk"}}';
$card->mobileType = EncyptedMobileType::APPLE_PAY;
try {
// process an auto-capture authorization
$response = $card->charge(10.00)
->withModifier(TransactionModifier::ENCRYPTED_MOBILE)
->withCurrency('EUR')
->execute();
} catch (ApiException $e) {
// TODO: add your error handling here
}
if (isset($response)) {
$result = $response->responseCode; // SUCCESS
$message = $response->responseMessage; // CAPTURED
// get the details to save to the DB for future requests
$authCode = $response->authorizationCode; // 12345
$paymentsReference = $response->transactionId; // TRN_vTijtcUtg2lPsUTvc0bQXH3U9vn2IK_a8ddd8f7c0fc
}
// create the card object
CreditCardData card = new CreditCardData();
card.Token = "{\"version\":\"EC_v1\",\"data\":\"dvMNzlcy6WNB\",\"header\":{\"ephemeralPublicKey\":\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWdNhNAHy9kO2Kol33kIh7k6wh6E\","
+ "\"transactionId\":\"fd88874954acdb299c285f95a3202ad1f330d3fd4ebc22a864398684198644c3\",\"publicKeyHash\":\"h7WnNVz2gmpTSkHqETOWsskFPLSj31e3sPTS2cBxgrk\"}}";
card.MobileType = MobilePaymentMethodType.APPLEPAY;
try
{
// process an auto-capture authorization
Transaction response = card.Charge(10m)
.WithModifier(TransactionModifier.EncryptedMobile)
.WithCurrency("EUR")
.Execute();
string result = response.ResponseCode; // SUCCESS
string message = response.ResponseMessage; // CAPTURED
// get the details to save to the DB for future requests
string authCode = response.AuthorizationCode; // 12345
string paymentsReference = response.TransactionId;
}
catch (ApiException ex)
{
// TODO: add your error handling here
}
Google Pay
// create the card object
CreditCardData card = new CreditCardData();
card.setToken("{\n" +
" \"signature\": \"MEQCIG5NDTGsgPrltVuuJQ0NYJnLUm1mo8JOW8vfLvt+ZtW6AiAZXJgnszos88b06ujEKubOMQNIuFdOgU+6ArRDGlZPoQ==\",\n" +
" \"protocolVersion\": \"ECv1\",\n" +
" \"signedMessage\": \"{\\\"encryptedMessage\\\":\\\"t+8CD+SWUl7VflMnwOqJedp7ZK71qnKX2tabp7px4C3d97ki1eb8vySoZoD8wbp7B2FDZPVGPDtUSUxz67JfwJ04sncw4KyDQiyShlxxdOakK/bnn+ooGHZ3jWA97hXVjtf1YecOCppzQIVk7F4RZZNgfIImQr4nDX5nm4BLN+TGsI4/m542xix45h+5e7y/xtyY/GFm8YwEfHQFCNY5edOr7h4nanDi/k//oQQG+ChOCKHtcmv4LpwtR2W737t5bTj+5mxXWu2sdAx6EnQGFOnmMKbNd1phcw4fdAHGtmxkW2LDUamXq5hnY99ECcl+Iqe75S6d3vQ3Lidk3k2lVVRtXTkxtCGvBOUy8okp4hndQL0665YOOIgEPengKfv3CIgUcKahKPyRVekaybDUalYpvyBvX2xIq+ilOo703z7pdL+FkILe7PC7RrEbnKLLJEv6\\\",\\\"ephemeralPublicKey\\\":\\\"BMLc+beu32XtPnrQ6D2z7IuICWl0gg9XmnKEync31BZ7NAvCa0BXTpLkyii+dDMPahj6xUoI0m7YES2UncrVkS8\\\\u003d\\\",\\\"tag\\\":\\\"QlvO9HQqmHXnlew8IzEWqr1AFSNL2wSc+HEb2IAd4YE\\\\u003d\\\"}\"\n" +
"}");
card.setMobileType(MobilePaymentMethodType.GOOGLEPAY);
try {
// process an auto-capture authorization
Transaction response =
card
.charge(new BigDecimal("10.00"))
.withCurrency("EUR")
.withModifier(TransactionModifier.EncryptedMobile)
.execute();
// get the details to save to the DB for future requests
String result = response.getResponseCode(); // SUCCESS
String message = response.getResponseMessage(); // CAPTURED
String authCode = response.getAuthorizationCode(); // 12345
String paymentsReference = response.getTransactionId(); //TRN_vTijtcUtg2lPsUTvc0bQXH3U9vn2IK_a8ddd8f7c0fc
}
catch (ApiException ex) {
// TODO: add your error handling here
}
// create the card object
$card = new CreditCardData();
$card->token = '{"signature":"MEUCIQDapDDJyf9lH3ztEWksgAjNe...AXjW+ZM+Ut2BWoTExppDDPc1a9Z7U\u003d",'
.'"protocolVersion":"ECv1","signedMessage":"{\"encryptedMessage\":\"VkqwkFuMdXp...TZQxVMnkTeJjwyc4\\u003d\",'
.'\"ephemeralPublicKey\":\"BMglUoKZWxgB...YCiBNkLaMTD9G4sec\\u003d\",\"tag\":\"4VYypqW2Q5FN7UP87QNDGsLgc48vAe5+AcjR+BxQ2Zo\\u003d\"}"}';
$card->mobileType = EncyptedMobileType::GOOGLE_PAY;
try {
// process an auto-settle authorization
$response = $card->charge(10.00)
->withCurrency("EUR")
->withModifier(TransactionModifier::ENCRYPTED_MOBILE)
->execute();
} catch (ApiException $e) {
// TODO: add your error handling here
}
if (isset($response)) {
$result = $response->responseCode; // SUCCESS
$message = $response->responseMessage; // CAPTURED
// get the details to save to the DB for future requests
$authCode = $response->authorizationCode;
$paymentsReference = $response->transactionId; // TRN_vTijtcUtg2lPsUTvc0bQXH3U9vn2IK_a8ddd8f7c0fc
}
.NET
// create the card object
CreditCardData card = new CreditCardData();
card.Token = "{\"signature\":\"MEUCIQDapDDJyf9lH3ztEWksgAjNe...AXjW+ZM+Ut2BWoTExppDDPc1a9Z7U\\u003d\",\"protocolVersion\":\"ECv1\","
+ "\"signedMessage\":\"{\"encryptedMessage\":\"VkqwkFuMdXp...TZQxVMnkTeJjwyc4\\u003d\",\"ephemeralPublicKey\":\"BMglUoKZWxgB...YCiBNkLaMTD9G4sec\\u003d\","
+ "\"tag\":\"4VYypqW2Q5FN7UP87QNDGsLgc48vAe5+AcjR+BxQ2Zo\\u003d\"}\"}";
card.MobileType = MobilePaymentMethodType.GOOGLEPAY;
try
{
// process an auto-capture authorization
Transaction response = card.Charge(10m)
.WithModifier(TransactionModifier.EncryptedMobile)
.WithCurrency("EUR")
.Execute();
string result = response.ResponseCode; // SUCCESS
string message = response.ResponseMessage; // CAPTURED
// get the details to save to the DB for future requests
string authCode = response.AuthorizationCode; // 12345
string paymentsReference = response.TransactionId;
}
catch (ApiException ex)
{
// TODO: add your error handling here
}
Internal Title
REST API, SDK
Show Content Nav
On
Tags