> For the complete documentation index, see [llms.txt](https://docs.payrexx.com/developer/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payrexx.com/developer/guides/gateway/build.md).

# Build Your Gateway

Payrexx comes into play as soon as your buyer has submitted their data on your website and starts the payment.

## Gateway Creation

Please read the [API reference](https://developers.payrexx.com/) for all necessary information.

You will learn about [API request basics](https://developers.payrexx.com/reference/rest-api) at Payrexx and can continue with [creating a Gateway](https://developers.payrexx.com/reference/create-a-gateway).

### Payload

In addition to the required data, you are free to choose what you would like to transfer to Payrexx.\
Here are some parameters that might be interesting for you:

| Parameter                        | Data Type | Description                                                                                                                                                                              |
| -------------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| successRedirectUrl               | string    | After a successful payment, a redirection to this URL is made. Must be *encoded*.                                                                                                        |
| failedRedirectUrl                | string    | After a failed payment, a redirection to this URL is made. Must be *encoded*.                                                                                                            |
| cancelRedirectUrl                | string    | After a cancelled payment, a redirection to this URL is made. Must be *encoded*.                                                                                                         |
| basket                           | array     | A list of all product items. Used for email notifications and invoices                                                                                                                   |
| pm                               | string\[] | Restrict the available payment methods with the according [identifiers](/developer/general-info/payment-method.md)                                                                       |
| preAuthorization                 | bool      | <p>Process a <a href="/pages/-McyiEbATEMXrthqhcPE">tokenization </a>payment</p><p><a href="/pages/-McyiEbATEMXrthqhcPE">Find out more</a></p>                                            |
| reservation                      | bool      | <p>Process a <a href="/pages/-Mcyi9ljxSdEtllkVGeR">pre-authorization</a> payment</p><p><a href="/pages/-Mcyi9ljxSdEtllkVGeR">Find out more</a></p>                                       |
| referenceId                      | string    | This can be used to assign the Payrexx transaction to an order later on                                                                                                                  |
| [fields](#all-possible-fields)   | array     | Customer data goes here                                                                                                                                                                  |
| skipResultPage                   | bool      | Skip the Payrexx result page **Note**: If a gateway is created with the `skipResultPage` flag and then used in an iframe integration, `&appview=1` needs to be added to the gateway link |
| chargeOnAuthorization            | bool      | [Tokenization ](/developer/guides/gateway/payment-types/tokenization.md)- Execute an initial charge immediately                                                                          |
| validity                         | int       | For how long should your payment gateway be available                                                                                                                                    |
| subscriptionState                | bool      | Set to true if you want to execute [subscriptions](/developer/guides/gateway/payment-types/subscriptions.md)                                                                             |
| subscriptionInterval             | string    | Subscription - Payment interval ([PHP interval specification](https://www.php.net/manual/dateinterval.construct.php))                                                                    |
| subscriptionPeriod               | string    | Subscription - Duration ([PHP interval specification](https://www.php.net/manual/dateinterval.construct.php))                                                                            |
| subscriptionCancellationInterval | string    | Subscription - How long a cancellation is possible ([PHP interval specification](https://www.php.net/manual/dateinterval.construct.php))                                                 |
| lookAndFeelProfile               | string    | If you got multiple Look & Feel profiles, decide which one to use                                                                                                                        |

### All Possible Fields

* title
* forename
* surname
* company
* street
* postcode
* place
* country
* delivery\_title
* delivery\_forename
* delivery\_surname
* delivery\_company
* delivery\_street
* delivery\_postcode
* delivery\_place
* delivery\_country
* phone
* email
* date\_of\_birth
* terms
* privacy\_policy
* custom\_field\_1
* custom\_field\_2
* custom\_field\_3
* custom\_field\_4
* custom\_field\_5

#### Examples

```bash
fields[forename][value]=John
fields[lastname][value]=Doe
fields[email][value]=john@doe.com
fields[street][value]=Burgstrasse 20
fields[postcode][value]=3600
fields[place][value]=Thun
fields[country][value]=CH
```

### Languages

If multi-language support is enabled in the merchant backend, it is possible to provide multiple language translations in the API for `Name` and `Description` attributes.

Each language is identified by an ID:

| ID | Language   |
| -- | ---------- |
| 1  | German     |
| 2  | English    |
| 3  | French     |
| 4  | Italian    |
| 7  | Dutch      |
| 8  | Portuguese |
| 9  | Turkish    |
| 10 | Polish     |
| 11 | Spanish    |
| 12 | Danish     |
| 13 | Swedish    |
| 14 | Norwegian  |

#### Examples

```php
# Without translation
fields[custom_field_1][name]=Fieldname 

# With German and English translation
fields[custom_field_1][name][1]=Feldname
fields[custom_field_1][name][2]=Fieldname
```

### Response

After the gateway was created successfully, you will get a link in the response of your request.\
Redirect the shopper to this link for processing the payment.

{% hint style="info" %}
Also, store the gateway ID in your software, you might need this later.
{% endhint %}

## Payment

Your shopper can choose a payment method in the Gateway and process the payment:

![](/files/-MhIucJkB6w5ngcPUQV8)

### After Payment

The shopper is redirected to the matching URL depending on the outcome of the payment process. (success-/cancel-/failedRedirectUrl)

{% hint style="warning" %}
The decision of whether a transaction was successful should not be made based on the redirect URL used.\
Always use the Payrexx Webhook or API to determine a transaction status.
{% endhint %}

## Next Steps

Now you have to perform further steps based on the payment result.
