{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","results":{"codes":[]},"settings":"","params":[]},"next":{"description":"","pages":[]},"title":"PHP Class Template","type":"basic","slug":"php-class-template","excerpt":"","body":"Below is a copy of the PHP Class we will need in order to add a payment processor. Once this file has been adjusted please submit them to our Support Team or your Gazoop Contact.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Need additional help or clarification?\",\n  \"body\": \"You can find out more detailed information about how to customise this file on our Getting Started pages here: https://docs.gazoop.com/docs/creditcard-processor-gettingstarted\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n/**\\n * :::at:::name Payment Processor Class File - OFFLINE METHOD\\n * @author James Parmee Morris\\n * @version 2.0.2\\n *\\n */\\nclass CreditCardModule {\\n\\t\\n\\tpublic $status = 'Pending';\\n\\tpublic $reference = '';\\n\\tprivate $configuration = array();\\n\\tprivate $cardDetails = array();\\n\\tprivate $personalDetails = array();\\n\\tpublic $transactionNotes = '';\\n\\t\\n\\tpublic function __construct($configuration){\\n\\t\\t// Use this area to do any preperation functions before processing a charge or generating a token. This function also supplies all variables stored from the clients account.\\n\\t    // If you have authentication logins, please use $this->configuration['varName'] - we will ensure the client enters any variables specified in this section.\\n\\t\\t\\n\\t\\t$this->configuration = $configuration;\\n\\t}\\n\\t\\n\\tpublic function applyCardDetails($card_number, $card_type, $expiry, $cvv, $valid_from='', $issue='', $token=''){\\n\\t\\t\\n\\t\\t// NB: Valid From and Issue Number are very rarely used and should be optional.\\n\\t\\t\\n\\t\\t$this->cardDetails = array(\\n\\t\\t'card_number'\\t=>\\t$card_number,\\n\\t\\t'card_type'\\t\\t=>\\t$card_type,\\n\\t\\t'expiry'\\t\\t=>\\t$expiry,\\n\\t\\t'cvv'\\t\\t\\t=>\\t$cvv,\\n\\t\\t'valid_from'\\t=>\\t$valid_from,\\n\\t\\t'issue'\\t\\t\\t=>\\t$issue,\\n\\t\\t'token'         =>  $token,\\n\\t\\t);\\n\\t\\t\\n\\t}\\n\\t\\n\\tpublic function applyPersonalDetails($first_name, $last_name, $address1, $address2, $city, $state, $country, $postcode){\\n\\t\\t\\n\\t\\t// NB: Postcode is the same as ZIP code, State is the same as County.\\n\\t\\t\\n\\t\\t$this->personalDetails = array(\\n\\t\\t'first_name'\\t=>\\t$first_name,\\n\\t\\t'last_name'\\t\\t=>\\t$last_name,\\n\\t\\t'address1'\\t\\t=>\\t$address1,\\n\\t\\t'address2'\\t\\t=>\\t$address2,\\n\\t\\t'city'\\t\\t\\t=>\\t$city,\\n\\t\\t'state'\\t\\t\\t=>\\t$state,\\n\\t\\t'country'\\t\\t=>\\t$country,\\n\\t\\t'postcode'\\t\\t=>\\t$postcode,\\n\\t\\t'email'\\t\\t\\t=>\\t$email);\\n\\t\\t\\n\\t}\\n\\t\\n\\t/*\\n\\t * Please uncomment this function if you require card details to be tokenized. If this method exists, the system will call this when storing new card details before calling chargeCard. No card information will be stored by Gazoop if this method exists.\\n\\t * \\n\\tpublic function getToken(){\\n\\t    \\n\\t    // NB: This should be used to store card information in exchange for a token which we save and can be obtained when chargeCard is called by using $this->cardDetails[token]\\n\\t\\n\\t    $this->cardDetails['token']=$token;\\n\\t    return $token;\\n\\t}*/\\n\\t\\n\\tpublic function chargeCard($amount,$currency){\\n\\t\\t\\n\\t\\t// NB: Generally this should be where API attempts are made to process the transaction. The response should be \\\"Authorized\\\" or \\\"NotAuthorized\\\".\\n\\t\\t\\n\\t\\t$this->transactionNotes = \\\"Payment against invoice.\\\";\\n\\t\\t$this->reference = \\\"ABC1234\\\";\\n\\t\\t$this->status='Authorized';\\n\\t\\t\\n\\t}\\n\\t\\n}\\n\\n?>\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]","updates":[],"order":1,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5e321fda7c7d250044f9a78b","project":"543005c87d487022005b3fa8","version":{"version":"1.0","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["543005c87d487022005b3fac","54345156edce04080040964e","543ee0c055bb1008000955b6","54c82a78ab706219009e0656","57390d0e1f4b740e00b06cb2","5741d5ab28f5fb0e0063ed36","5d1e4140522cd702b31b544b","5e321f8b5517b00012831b6a"],"_id":"543005c87d487022005b3fab","__v":8,"createdAt":"2014-10-04T14:35:52.362Z","releaseDate":"2014-10-04T14:35:52.362Z","project":"543005c87d487022005b3fa8"},"category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Credit Card Processor Module","slug":"credit-card-processor-module","order":9999,"from_sync":false,"reference":false,"_id":"5e321f8b5517b00012831b6a","project":"543005c87d487022005b3fa8","version":"543005c87d487022005b3fab","createdAt":"2020-01-30T00:12:59.668Z","__v":0},"user":"543005a67d487022005b3fa7","createdAt":"2020-01-30T00:14:18.610Z","__v":0,"parentDoc":null}

PHP Class Template


Below is a copy of the PHP Class we will need in order to add a payment processor. Once this file has been adjusted please submit them to our Support Team or your Gazoop Contact. [block:callout] { "type": "info", "title": "Need additional help or clarification?", "body": "You can find out more detailed information about how to customise this file on our Getting Started pages here: https://docs.gazoop.com/docs/creditcard-processor-gettingstarted" } [/block] [block:code] { "codes": [ { "code": "<?php\n/**\n * @name Payment Processor Class File - OFFLINE METHOD\n * @author James Parmee Morris\n * @version 2.0.2\n *\n */\nclass CreditCardModule {\n\t\n\tpublic $status = 'Pending';\n\tpublic $reference = '';\n\tprivate $configuration = array();\n\tprivate $cardDetails = array();\n\tprivate $personalDetails = array();\n\tpublic $transactionNotes = '';\n\t\n\tpublic function __construct($configuration){\n\t\t// Use this area to do any preperation functions before processing a charge or generating a token. This function also supplies all variables stored from the clients account.\n\t // If you have authentication logins, please use $this->configuration['varName'] - we will ensure the client enters any variables specified in this section.\n\t\t\n\t\t$this->configuration = $configuration;\n\t}\n\t\n\tpublic function applyCardDetails($card_number, $card_type, $expiry, $cvv, $valid_from='', $issue='', $token=''){\n\t\t\n\t\t// NB: Valid From and Issue Number are very rarely used and should be optional.\n\t\t\n\t\t$this->cardDetails = array(\n\t\t'card_number'\t=>\t$card_number,\n\t\t'card_type'\t\t=>\t$card_type,\n\t\t'expiry'\t\t=>\t$expiry,\n\t\t'cvv'\t\t\t=>\t$cvv,\n\t\t'valid_from'\t=>\t$valid_from,\n\t\t'issue'\t\t\t=>\t$issue,\n\t\t'token' => $token,\n\t\t);\n\t\t\n\t}\n\t\n\tpublic function applyPersonalDetails($first_name, $last_name, $address1, $address2, $city, $state, $country, $postcode){\n\t\t\n\t\t// NB: Postcode is the same as ZIP code, State is the same as County.\n\t\t\n\t\t$this->personalDetails = array(\n\t\t'first_name'\t=>\t$first_name,\n\t\t'last_name'\t\t=>\t$last_name,\n\t\t'address1'\t\t=>\t$address1,\n\t\t'address2'\t\t=>\t$address2,\n\t\t'city'\t\t\t=>\t$city,\n\t\t'state'\t\t\t=>\t$state,\n\t\t'country'\t\t=>\t$country,\n\t\t'postcode'\t\t=>\t$postcode,\n\t\t'email'\t\t\t=>\t$email);\n\t\t\n\t}\n\t\n\t/*\n\t * Please uncomment this function if you require card details to be tokenized. If this method exists, the system will call this when storing new card details before calling chargeCard. No card information will be stored by Gazoop if this method exists.\n\t * \n\tpublic function getToken(){\n\t \n\t // NB: This should be used to store card information in exchange for a token which we save and can be obtained when chargeCard is called by using $this->cardDetails[token]\n\t\n\t $this->cardDetails['token']=$token;\n\t return $token;\n\t}*/\n\t\n\tpublic function chargeCard($amount,$currency){\n\t\t\n\t\t// NB: Generally this should be where API attempts are made to process the transaction. The response should be \"Authorized\" or \"NotAuthorized\".\n\t\t\n\t\t$this->transactionNotes = \"Payment against invoice.\";\n\t\t$this->reference = \"ABC1234\";\n\t\t$this->status='Authorized';\n\t\t\n\t}\n\t\n}\n\n?>", "language": "php" } ] } [/block]