diff --git a/examples/consumer-authentication/cruise.php b/examples/consumer-authentication/cruise.php
index 625ff584..bafa35b2 100644
--- a/examples/consumer-authentication/cruise.php
+++ b/examples/consumer-authentication/cruise.php
@@ -3,9 +3,9 @@
require 'JWT.php';
use GlobalPayments\Api\PaymentMethods\CreditCardData;
-use GlobalPayments\Api\ServicesConfig;
use GlobalPayments\Api\ServicesContainer;
use GlobalPayments\Api\Entities\EcommerceInfo;
+use GlobalPayments\Api\ServiceConfigs\Gateways\PorticoConfig;
$_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
$_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
@@ -19,11 +19,10 @@
print_r($_GET);
print '';
- $config = new ServicesConfig();
+ $config = new PorticoConfig();
$config->secretApiKey = 'skapi_cert_MT2PAQB-9VQA5Z1mOXQbzZcH6O5PpdhjWtFhMBoL4A';
- $config->serviceUrl = 'https://cert.api2.heartlandportico.com';
- ServicesContainer::configure($config);
+ ServicesContainer::configureService($config);
$card = new CreditCardData();
$card->token = $_GET['heartlandToken'];
diff --git a/examples/echeck/index.html b/examples/echeck/index.html
index 242dff1b..97d10e69 100644
--- a/examples/echeck/index.html
+++ b/examples/echeck/index.html
@@ -107,7 +107,7 @@
Payment Information
Check Information
-
-
diff --git a/examples/gift/charge.php b/examples/gift/charge.php
index de9ed97e..41a008ae 100644
--- a/examples/gift/charge.php
+++ b/examples/gift/charge.php
@@ -3,18 +3,17 @@
require_once ('../../vendor/autoload.php');
use GlobalPayments\Api\PaymentMethods\GiftCard;
-use GlobalPayments\Api\ServicesConfig;
+use GlobalPayments\Api\ServiceConfigs\Gateways\PorticoConfig;
use GlobalPayments\Api\ServicesContainer;
$_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
$_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
-$config = new ServicesConfig();
+$config = new PorticoConfig();
$config->secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A';
-$config->serviceUrl = 'https://cert.api2.heartlandportico.com';
-ServicesContainer::configure($config);
+ServicesContainer::configureService($config);
try {
$card = new GiftCard();
@@ -29,5 +28,3 @@
} catch (Exception $e) {
echo $e->getMessage();
}
-
-
diff --git a/examples/iframe-pay-invoice/assets/main.js b/examples/iframe-pay-invoice/assets/main.js
index c3857aae..d289d503 100644
--- a/examples/iframe-pay-invoice/assets/main.js
+++ b/examples/iframe-pay-invoice/assets/main.js
@@ -1,206 +1,27 @@
-(function (document, Heartland) {
- // Create a new `HPS` object with the necessary configuration
- var hps = new Heartland.HPS({
- publicKey: 'pkapi_cert_P6dRqs1LzfWJ6HgGVZ',
- type: 'iframe',
- // Configure the iframe fields to tell the library where
- // the iframe should be inserted into the DOM and some
- // basic options
- fields: {
- cardNumber: {
- target: 'iframesCardNumber',
- placeholder: '•••• •••• •••• ••••'
- },
- cardExpiration: {
- target: 'iframesCardExpiration',
- placeholder: 'MM / YYYY'
- },
- cardCvv: {
- target: 'iframesCardCvv',
- placeholder: 'CVV'
- },
- submit: {
- target: 'iframesSubmit'
- }
- },
- // Collection of CSS to inject into the iframes.
- // These properties can match the site's styles
- // to create a seamless experience.
- style: {
- 'input': {
- 'background': '#fff',
- 'border': '1px solid',
- 'border-color': '#bbb3b9 #c7c1c6 #c7c1c6',
- 'box-sizing': 'border-box',
- 'font-family': 'serif',
- 'font-size': '16px',
- 'line-height': '1',
- 'margin': '0 .5em 0 0',
- 'max-width': '100%',
- 'outline': '0',
- 'padding': '0.5278em',
- 'vertical-align': 'baseline',
- 'height': '50px',
- 'width': '100% !important'
- },
- '#heartland-field': {
- 'font-family': 'sans-serif',
- 'box-sizing': 'border-box',
- 'display': 'block',
- 'height': '50px',
- 'padding': '6px 12px',
- 'font-size': '14px',
- 'line-height': '1.42857143',
- 'color': '#555',
- 'background-color': '#fff',
- 'border': '1px solid #ccc',
- 'border-radius': '0px',
- '-webkit-box-shadow': 'inset 0 1px 1px rgba(0,0,0,.075)',
- 'box-shadow': 'inset 0 1px 1px rgba(0,0,0,.075)',
- '-webkit-transition': 'border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s',
- '-o-transition': 'border-color ease-in-out .15s,box-shadow ease-in-out .15s',
- 'transition': 'border-color ease-in-out .15s,box-shadow ease-in-out .15s',
- 'width': '100%'
- },
- '#heartland-field[name=submit]': {
- 'background-color': '#36b46e',
- 'font-family': 'sans-serif',
- 'text-transform': 'uppercase',
- 'color': '#ffffff',
- 'border': '0px solid transparent'
- },
- '#heartland-field[name=submit]:focus': {
- 'color': '#ffffff',
- 'background-color': '#258851',
- 'outline': 'none'
- },
- '#heartland-field[name=submit]:hover': {
- 'background-color': '#258851'
- },
- '#heartland-field-wrapper #heartland-field:focus': {
- 'border': '1px solid #3989e3',
- 'outline': 'none',
- 'box-shadow': 'none',
- 'height': '50px'
- },
- 'heartland-field-wrapper #heartland-field': {
- 'height': '50px'
- },
- 'input[type=submit]': {
- 'box-sizing': 'border-box',
- 'display': 'inline-block',
- 'padding': '6px 12px',
- 'margin-bottom': '0',
- 'font-size': '14px',
- 'font-weight': '400',
- 'line-height': '1.42857143',
- 'text-align': 'center',
- 'white-space': 'nowrap',
- 'vertical-align': 'middle',
- '-ms-touch-action': 'manipulation',
- 'touch-action': 'manipulation',
- 'cursor': 'pointer',
- '-webkit-user-select': 'none',
- '-moz-user-select': 'none',
- '-ms-user-select': 'none',
- 'user-select': 'none',
- 'background-image': 'none',
- 'border': '1px solid transparent',
- 'border-radius': '4px',
- 'color': '#fff',
- 'background-color': '#337ab7',
- 'border-color': '#2e6da4'
- },
- '#heartland-field[placeholder]': {
- 'letter-spacing': '3px'
- },
- '#heartland-field[name=cardCvv]': {
- 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/cvv1.png?raw=true) no-repeat right',
- 'background-size': '63px 40px',
- },
- 'input#heartland-field[name=cardNumber]': {
- 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-inputcard-blank@2x.png?raw=true) no-repeat right',
- 'background-size': '55px 35px'},
- '#heartland-field.invalid.card-type-visa': {
- 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-visa@2x.png?raw=true) no-repeat right',
- 'background-size': '83px 88px',
- 'background-position-y': '-44px'
- },
- '#heartland-field.valid.card-type-visa': {
- 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-visa@2x.png?raw=true) no-repeat right top',
- 'background-size': '82px 86px'
- },
- '#heartland-field.invalid.card-type-discover': {
- 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-discover@2x.png?raw=true) no-repeat right',
- 'background-size': '85px 90px',
- 'background-position-y': '-44px'
- },
- '#heartland-field.valid.card-type-discover': {
- 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-discover@2x.png?raw=true) no-repeat right',
- 'background-size': '85px 90px',
- 'background-position-y': '1px'
- },
- '#heartland-field.invalid.card-type-amex': {
- 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-savedcards-amex@2x.png?raw=true) no-repeat right',
- 'background-size': '50px 90px',
- 'background-position-y': '-44px'
- },
- '#heartland-field.valid.card-type-amex': {
- 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-savedcards-amex@2x.png?raw=true) no-repeat right top',
- 'background-size': '50px 90px'
- },
- '#heartland-field.invalid.card-type-mastercard': {
- 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-mastercard.png?raw=true) no-repeat right',
- 'background-size': '62px 105px',
- 'background-position-y': '-52px'
- },
- '#heartland-field.valid.card-type-mastercard': {
- 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-mastercard.png?raw=true) no-repeat right',
- 'background-size': '62px 105px',
- 'background-position-y': '-1px'
- },
- '#heartland-field.invalid.card-type-jcb': {
- 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-jcb@2x.png?raw=true) no-repeat right',
- 'background-size': '55px 94px',
- 'background-position-y': '-44px'
- },
- '#heartland-field.valid.card-type-jcb': {
- 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-jcb@2x.png?raw=true) no-repeat right top',
- 'background-size': '55px 94px',
- 'background-position-y': '2px'
- },
- 'input#heartland-field[name=cardNumber]::-ms-clear': {
- 'display': 'none'
- }
- },
- // Callback when a token is received from the service
- onTokenSuccess: function (resp) {
- document.querySelector("input[name=token_value]").value = resp.token_value;
- Heartland.Events.removeHandler(document.getElementById('payment_form'), 'submit');
- document.getElementById('payment_form').submit();
- },
- // Callback when an error is received from the service
- onTokenError: function (resp) {
- alert('There was an error: ' + resp.error.message);
- },
- // Callback when an event is fired within an iFrame
- onEvent: function (ev) {
- console.log(ev);
- }
- });
+// Configure account
+GlobalPayments.configure({
+ publicApiKey: "pkapi_cert_P6dRqs1LzfWJ6HgGVZ"
+});
- // Attach a handler to interrupt the form submission
- Heartland.Events.addHandler(document.getElementById('iframes'), 'submit', function (e) {
- // Prevent the form from continuing to the `action` address
- e.preventDefault();
- // Tell the iframes to tokenize the data
- hps.Messages.post(
- {
- accumulateData: true,
- action: 'tokenize',
- message: 'pkapi_cert_jKc1FtuyAydZhZfbB3'
- },
- 'cardNumber'
- );
- });
-}(document, Heartland));
\ No newline at end of file
+// Create Form
+const cardForm = GlobalPayments.creditCard.form("#credit-card", { style: "blank" });
+
+// form-level event handlers. examples:
+cardForm.ready(() => {
+ console.log("Registration of all credit card fields occurred");
+});
+
+cardForm.on("token-success", (resp) => {
+ document.querySelector("input[name=token_value]").value = resp.paymentReference;
+ document.querySelector("input[name=cardholder_name]").value = resp.details.cardholderName;
+ document.getElementById('payment_form').submit();
+});
+
+cardForm.on("token-error", (resp) => {
+// show error to the consumer
+});
+
+// field-level event handlers. example:
+cardForm.on("card-number", "register", () => {
+ console.log("Registration of Card Number occurred");
+});
\ No newline at end of file
diff --git a/examples/iframe-pay-invoice/charge.php b/examples/iframe-pay-invoice/charge.php
index a75b2a30..be794db2 100644
--- a/examples/iframe-pay-invoice/charge.php
+++ b/examples/iframe-pay-invoice/charge.php
@@ -3,18 +3,17 @@
require_once ('../../vendor/autoload.php');
use GlobalPayments\Api\PaymentMethods\CreditCardData;
-use GlobalPayments\Api\ServicesConfig;
use GlobalPayments\Api\ServicesContainer;
use GlobalPayments\Api\Entities\Address;
+use GlobalPayments\Api\ServiceConfigs\Gateways\PorticoConfig;
$_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
$_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
-$config = new ServicesConfig();
+$config = new PorticoConfig();
$config->secretApiKey = 'skapi_cert_MYl2AQAowiQAbLp5JesGKh7QFkcizOP2jcX9BrEMqQ';
-$config->serviceUrl = 'https://cert.api2.heartlandportico.com';
-ServicesContainer::configure($config);
+ServicesContainer::configureService($config);
$card = new CreditCardData();
$card->token = $_GET['token_value'];
@@ -26,7 +25,6 @@
$address->postalCode = preg_replace('/[^0-9]/', '', $_GET["Zip"]);
$address->country = "United States";
-
try {
$response = $card->charge(15)
->withCurrency('USD')
@@ -35,7 +33,7 @@
->execute();
$body = 'Success!
';
- $body .= 'Thank you, ' . $_GET['FirstName'] . ', for your order of $' . $_GET["payment_amount"] . '.
';
+ $body .= 'Thank you, ' . $_GET['cardholder_name'] . ', for your order of $' . $_GET["payment_amount"] . '.
';
echo "Transaction Success!
Transaction Id: " . $response->transactionId;
echo "
Invoice Number: " . $_GET["invoice_number"];
diff --git a/examples/iframe-pay-invoice/index.html b/examples/iframe-pay-invoice/index.html
index 21aaa8fd..15e6f014 100644
--- a/examples/iframe-pay-invoice/index.html
+++ b/examples/iframe-pay-invoice/index.html
@@ -1,10 +1,11 @@
+
-
+
Simple Payment Form Demo
@@ -13,46 +14,34 @@
PHP SecureSubmit Example