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

# Payment Session

Create temporary payment sessions for onboarded users. The session token is used to authenticate the user in the Payr payment interface (iframe or SDK).

## Create Payment Session

> Create a temporary payment session token for an onboarded user.\
> \
> This token is valid for 15 minutes and is used for client-side payment operations. Pass the token to the Payr payment interface (iframe or SDK) to enable the user to make rent payments.\
> \
> \*\*Note:\*\* The user must have been onboarded via \`/onboarding/\` first, otherwise a \`400\` error is returned.\
> \
> \### Example cURL Request\
> \`\`\`bash\
> curl -X POST <https://api.mypayr.co.uk/thirdparty/user-login/> \\\
> &#x20; -H "Authorization: Token your\_server\_token" \\\
> &#x20; -H "Content-Type: application/json" \\\
> &#x20; -d '{\
> &#x20;   "email": "<john.smith@university.edu>"\
> &#x20; }'\
> \`\`\`\
> \
> \### Example Response\
> \`\`\`json\
> {\
> &#x20; "token": "x9y8z7w6v5u4t3s2r1q0p9o8n7m6l5k4j3i2h1g0f9e8d7c6b5a4",\
> &#x20; "session\_id": "01KH1FZ0N0..."\
> }\
> \`\`\`<br>

````json
{"openapi":"3.0.3","info":{"title":"Payr Integration API","version":"1.0.0"},"tags":[{"name":"Payment Session","description":"Create temporary payment sessions for onboarded users. The session token is used to authenticate the user in the Payr payment interface (iframe or SDK).\n"}],"servers":[{"url":"https://sandbox-api.mypayr.co.uk/thirdparty","description":"Sandbox server"},{"url":"https://api.mypayr.co.uk/thirdparty","description":"Production server"}],"security":[{"TokenAuth":[]}],"components":{"securitySchemes":{"TokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Server-to-server authentication token obtained via the rotate-token endpoint.\nInclude in the Authorization header as: `Authorization: Token <your_token>`\n"}},"schemas":{"LoginRequest":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email","description":"Email address of the user to create a payment session for"}}},"PaymentSessionResponse":{"type":"object","properties":{"token":{"type":"string","description":"Temporary payment session token (valid for 15 minutes)"},"session_id":{"type":"string","description":"Session identifier (valid for 30 minutes)"}}},"ValidationErrorResponse":{"type":"object","additionalProperties":{"oneOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]}},"ErrorResponse":{"type":"object","properties":{"error":{"type":"string","description":"Error message"},"detail":{"type":"string","description":"Detailed error information"}}}}},"paths":{"/user-login/":{"post":{"summary":"Create Payment Session","description":"Create a temporary payment session token for an onboarded user.\n\nThis token is valid for 15 minutes and is used for client-side payment operations. Pass the token to the Payr payment interface (iframe or SDK) to enable the user to make rent payments.\n\n**Note:** The user must have been onboarded via `/onboarding/` first, otherwise a `400` error is returned.\n\n### Example cURL Request\n```bash\ncurl -X POST https://api.mypayr.co.uk/thirdparty/user-login/ \\\n  -H \"Authorization: Token your_server_token\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"email\": \"john.smith@university.edu\"\n  }'\n```\n\n### Example Response\n```json\n{\n  \"token\": \"x9y8z7w6v5u4t3s2r1q0p9o8n7m6l5k4j3i2h1g0f9e8d7c6b5a4\",\n  \"session_id\": \"01KH1FZ0N0...\"\n}\n```\n","operationId":"createPaymentSession","tags":["Payment Session"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}}},"responses":{"200":{"description":"Payment session token created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentSessionResponse"}}}},"400":{"description":"Bad Request - Invalid email or user not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponse"}}}},"401":{"description":"Unauthorized - Invalid or expired server token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
````
