{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Transaction Information","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":"transaction-information","__idx":0},"children":["Transaction Information"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["WHMCS 8.2 added the ability to display additional transaction details in a modal in the WHMCS Admin Area. Clicking on a transaction ID will open the modal to display this information for enabled supported gateways. By default, these details are available by clicking a transaction ID at ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Billing > Transactions"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["All Stripe gateways support this by default. You can display transaction information for other gateways using the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TransactionInformation"]}," function."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"displaying-transaction-information","__idx":1},"children":["Displaying Transaction Information"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example code connects to the gateway and displays the transaction information:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"use WHMCS\\Billing\\Payment\\Transaction\\Information;\nuse WHMCS\\Carbon;\n\n/**\n * @param array @params\n *\n * @return Information\n */\nfunction yourmodulename_TransactionInformation(array $params = []): Information\n{\n    /**\n     * Connect to gateway to retrieve transaction information.\n     */\n    $postfields = [\n        'account' => $params['apikey'],\n        'transactionId' => $params['transactionId'],\n    ];\n    $ch = curl_init();\n    curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/api/transaction');\n    curl_setopt($ch, CURLOPT_POST, 1);\n    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postfields));\n    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n    $response = curl_exec($ch);\n    curl_close($ch);\n\n    $transactionInformation = json_decode($response);\n    return (new Information())\n        ->setTransactionId($transactionData['id'])\n        ->setAmount($transactionData['amount'])\n        ->setCurrency($transactionData['currency'])\n        ->setType($transactionData['type'])\n        ->setAvailableOn(Carbon::parse($transactionData['available_on']))\n        ->setCreated(Carbon::parse($transactionData['created']))\n        ->setDescription($transactionData['description'])\n        ->setFee($transactionData['fee'])\n        ->setStatus($transactionData['status'])\n        ->setAdditionalDatum('customName1', $transactionData['customValue1'])\n        ->setAdditionalDatum('customName2', $transactionData['customValue2']);\n}\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"the-information-class","__idx":2},"children":["The Information Class"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The use of the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Information"]}," class causes the return from the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TransactionInformation"]}," function to be standard."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This class has no attribute requirements, but we recommend that you set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["amount"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["currency"]}," as in the example above. The data that you set here determines what displays in the modal. Values that evaluate to false will not display in the modal."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more information about the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Information"]}," class, see the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://classdocs.whmcs.com/"},"children":["WHMCS Internal Class Documentation"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"setting-additional-data","__idx":3},"children":["Setting Additional Data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Information"]}," class's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["setAdditionalDatum"]}," method to add data. The passed value will display with the label for the key. For example:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"setAdditionalDatum(string $key, $value)\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"key-language-string-override","__idx":4},"children":["key Language String Override"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["key"]}," value will be translated before it displays in the modal. You will need to add an ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/languages/overrides/"},"children":["admin language string override"]}," for each additional piece of data."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For the code example above, you would add the following language strings:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$_ADMINLANG['transactions']['information']['customName1'] = \"Custom Name 1\";\n$_ADMINLANG['transactions']['information']['customName2'] = \"Custom Name 2\";\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"required-permissions","__idx":5},"children":["Required Permissions"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["By default, transaction information will display in the Admin Area for admins with the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Full Administrator"]}," role. To allow other admin roles to see balance information, enable ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["List Transactions"]}," for the desired role."]}]},"headings":[{"value":"Transaction Information","id":"transaction-information","depth":1},{"value":"Displaying Transaction Information","id":"displaying-transaction-information","depth":2},{"value":"The Information Class","id":"the-information-class","depth":2},{"value":"Setting Additional Data","id":"setting-additional-data","depth":3},{"value":"key Language String Override","id":"key-language-string-override","depth":3},{"value":"Required Permissions","id":"required-permissions","depth":2}],"frontmatter":{"title":"Transaction Information","seo":{"title":"Transaction Information"}},"lastModified":"2026-08-03T17:00:42.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/payment-gateways/transaction-information","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}