# Gateway Tokens

*Article Topics:* [*Billers*](/getting-started/common-topics/billers.md)

## Setting up in NATS

### Gateway Join Page

In order to use the gateway token system with Netbilling, you will need to modify your gateway join page. Login to your Nats admin and go to the Sites Admin. Locate the site you want to use tokens with and "Edit Site Templates". Find gateway\_join and edit to make the following changes:

1. The gateway\_join template must be wrapped in \<HTML>\</HTML> (and must also have \<head>\</head> and \<body>\</body> sections
2. The sign-up form must have a name parameter
3. Smarty code must check for the surfer's customer identification code (when passed memberid and billerid)
4. If the Smarty code doesn't find the identification code, it must have the surfer fill in their billing information
5. If the Smarty code does find the identification code, it should use that code and automatically submit the form using Javascript

For example:

```
{* 1. The gateway_join template must be wrapped in <HTML></HTML> 
      (and must also have <head></head> and <body></body> sections *}
<html>
<head></head>
<body>


{* 2. The sign-up form must have a name field *}
<form action="signup.php" method="POST" name="purchase_netbilling_token">


{* 3. Smarty code must check for the surfer's customer identification code
 * 4. If the Smarty code doesn't find the identification code, it must have the surfer 
      fill in their billing information *}

{nats_get_gateway_token memberid=$smarty.request.memberid billerid=$billerid}

{if !$gateway_token}
    <input type="hidden" name="nextra[NETBILLING][cisp_storage]" value="1">
    ....


{* 5. If the Smarty code does find the identification code, it should use that code 
      and automatically submit the form using Javascript *}
{else}
    <input type="hidden" name="signup[cc]" value="CS:{$gateway_token}">
    </form>

    <script language="JavaScript">
        document.purchase_netbilling_token.submit();
    </script>
{/if}
</body>
</html>
```

### Renaming Members

This feature works when REUSE\_MATCHING\_USERNAME is enabled (Configuration admin -> Surfers tab). However since usernames are unique at Netbilling, you need to enable the following configuration variable in your includes/config.php file

```
$config['NETBILLING_RENAME_USERNAME'] = 1;
$config['NETBILLING_NONRECURRING_USERNAME'] = 1;
```

This will attempt to rename away the current username at Netbilling so a new subscription can be created for this member.

## Related Articles

{% content-ref url="/pages/4oCdTzMm6VuxAkrDGrCg" %}
[NETbilling](/getting-started/integrations/supported-billers/netbilling.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.toomuchmedia.com/getting-started/integrations/supported-billers/gateway-tokens.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
