> ## Documentation Index
> Fetch the complete documentation index at: https://help.cryptolens.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Python 3: PaymentForm

> Create payment-form sessions from your server.

Python 3 package `licensing 0.54`. [Reviewed source revision](https://github.com/Cryptolens/cryptolens-python/tree/8f38b5a37580f2aba1c9374f581cdc85e251950f).

```python theme={null}
from licensing.methods import PaymentForm
```

<a id="licensing.methods.PaymentForm.create_session" />

## create\_session

Create a single-use payment-form session from your server.

```python theme={null}
PaymentForm.create_session(
    token,
    payment_form_id,
    currency,
    expires,
    price=None,
    heading=None,
    product_name=None,
    custom_field='',
    metadata=None
)
```

### Parameters

| Parameter | Default | Meaning |
| - | - | - |
| `token` | Required | Your access token. It needs the permission required by the linked Web API method. |
| `payment_form_id` | Required | The numeric payment-form ID. |
| `currency` | Required | The ISO currency code, for example `USD`. |
| `expires` | Required | How many seconds the payment session should remain valid. |
| `price` | `None` | The amount to charge, for example `12.5`. |
| `heading` | `None` | The heading shown on the payment form. |
| `product_name` | `None` | The name of the item being purchased. |
| `custom_field` | `''` | Custom field content passed through the payment form. |
| `metadata` | `None` | Additional metadata saved after a successful transaction. |

### Result

Returns `(response_dict, '')`; the session identifier is in `response_dict['sessionId']`.

Returns `(None, message)` for API rejection or a handled request failure. Malformed response data can raise an exception.

### Checks

The API checks the access token's permissions. This method does not verify a signed license response.

[Web API reference](/api-reference/generated/PFCreateSession).

[Python SDK Reference](/libraries/python-api)
