{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"Third Party Gateway","description":"Developer documentation for the WHMCS API — the","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"third-party-gateway","__idx":0},"children":["Third Party Gateway"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Follow the steps below to create a third party gateway module."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A Third Party Gateway module is one where a customer leaves the site to pay and returns when the payment process is complete. Examples include PayPal Standard and 2Checkout."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"implementation-guide","__idx":1},"children":["Implementation guide"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Delete the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["yourmodulename_capture"]}," function from the module template since this is only required for ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/payment-gateways/merchant-gateway","title":"Merchant Gateways"},"children":["Merchant Gateway"]}," modules."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Define and return the HTML code that will forward the user to the payment gateway to complete the payment process inside the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["yourmodulename_link"]}," function. This is typically done by way of an HTML form utilizing the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["POST"]}," method."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Optionally, if your payment gateway supports sending notifications upon successful receipt of payments, create a ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/payment-gateways/callbacks","title":"Callback Files"},"children":["Callback File"]}," to receive and handle those."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["If your payment gateway supports refunds, implement support for ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/payment-gateways/refunds","title":"Refunding Transactions"},"children":["Refunds"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"variables","__idx":2},"children":["Variables"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following parameters are passed to the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["_link"]}," function along with all ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/payment-gateways/configuration","title":"Configuration Parameters"},"children":["defined configuration parameters"]}," and their values."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"invoice-variables","__idx":3},"children":["Invoice Variables"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$params['invoiceid'] # Invoice ID Number.\n$params['description'] # Description (eg. Company Name - Invoice #xxx).\n$params['amount'] # Format: xxx.xx\n$params['currency'] # Currency Code (eg. GBD, USD, etc.)\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"client-variables","__idx":4},"children":["Client Variables"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$params['clientdetails']['firstname'] # Client's First Name.\n$params['clientdetails']['lastname'] # Client's Last Name.\n$params['clientdetails']['email'] # Client's Email Address.\n$params['clientdetails']['address1'] # Client's Address.\n$params['clientdetails']['address2']\n$params['clientdetails']['city']\n$params['clientdetails']['state']\n$params['clientdetails']['postcode']\n$params['clientdetails']['country']\n$params['clientdetails']['model'] # An instance of WHMCS\\User\\Client. See below.\n$params['clientdetails']['phonenumber']\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more information on the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["model"]}," variable, see our ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://classdocs.whmcs.com/"},"children":["Class Documentation"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"system-variables","__idx":5},"children":["System Variables"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$params['companyname'] # Your Company Name setting in WHMCS.\n$params['systemurl'] # The URL to the WHMCS Client Area.\n$params['returnurl'] # The return URL for the invoice.\n$params['langpaynow'] # The language string for \"Pay Now\".\n$params['name'] # Module display name.\n$params['paymentmethod'] # Module name.\n$params['whmcsVersion'] # WHMCS Version Number.\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"response-format","__idx":6},"children":["Response Format"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["_link"]}," function should return an HTML code block that can be rendered to the user. This should typically take the format of an HTML form."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"simple-example","__idx":7},"children":["Simple Example"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Below is a very simple demonstration of a link function that forwards the end user to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://www.example.com/checkout"]}," using a form post containing the invoice data. For a more complete example, please refer to the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/WHMCS/sample-gateway-module","title":"Sample Third Party Gateway module on GitHub"},"children":["Sample Third Party Gateway module on GitHub"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"function yourmodulename_link($params) {\n    return '<form method=\"post\" action=\"https://www.example.com/checkout\">\n        <input type=\"invoice_number\" value=\"' . $params['invoiceid'] . '\" />\n        <input type=\"description\" value=\"' . $params['description'] . '\" />\n        <input type=\"amount\" value=\"' . $params['amount'] . '\" />\n        <input type=\"currency\" value=\"' . $params['currency'] . '\" />\n        <input type=\"submit\" value=\"' . $params['langpaynow'] . '\" />\n        </form>';\n}\n"},"children":[]}]},"headings":[{"value":"Third Party Gateway","id":"third-party-gateway","depth":1},{"value":"Implementation guide","id":"implementation-guide","depth":2},{"value":"Variables","id":"variables","depth":2},{"value":"Invoice Variables","id":"invoice-variables","depth":3},{"value":"Client Variables","id":"client-variables","depth":3},{"value":"System Variables","id":"system-variables","depth":3},{"value":"Response Format","id":"response-format","depth":2},{"value":"Simple Example","id":"simple-example","depth":2}],"frontmatter":{"title":"Third Party Gateway","seo":{"title":"Third Party Gateway"}},"lastModified":"2026-08-03T17:00:42.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/payment-gateways/third-party-gateway","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}