# Payments v2

Creates and initiates a single immediate payment or a future-dated payment. Also supports initiating a Variable Recurring Payment (VRP) using an existing VRP mandate that has been created and authorised via the `/vrp-consent` endpoint.

## Initiate a payment

 - [POST /v2/payments](https://docs.token.io/products/tpp/api/reference/payments-v2/initiatepayment.md): The POST /v2/payments endpoint enables you to initiate a payment with a bank.Once the payment has been initiated, the end user needs to authenticate themselves with their bank.Check payment status:If the status in the initiation response is INITIATION_PENDING_REDIRECT_AUTH or INITIATION_PENDING_REDIRECT_HP, redirect the user to the redirect url found in the authentication payload of the payment, to authenticate at the bank or at Token.io's Hosted Pages.If the status in the initiation response is INITIATION_PENDING_REDIRECT_PBL, redirect the user to the payment link (redirect URL) found in the authentication payload. The user will be taken to Token.io’s Hosted Pages, where any missing information (such as amount or reference) can be provided before proceeding with payment authentication.If the status in the initiation response is INITIATION_PENDING_EMBEDDED_AUTH, collect the requested data listed in the authentication payload of the payment and use the POST /v2/payments/{paymentId}/embedded-auth endpoint to provide the requested field values.If the status in the initiation response is INITIATION_PENDING, Token.io needs more time to process this request with the bank. In the case of a successful scenario, the status will be updated to INITIATION_PENDING_REDIRECT_AUTH, INITIATION_PENDING_EMBEDDED_AUTH or INITIATION_PENDING_DECOUPLED_AUTH when the authentication details are ready. The update can be checked by the GET /v2/payments/{paymentId} endpoint or received via a webhook (see Webhooks).If the status is INITIATION_PENDING_DECOUPLED_AUTH, the bank has requested a decoupled authentication from the user and Token.io is awaiting the result. No further action is required.request-timeout header:Banks may take some time to respond when a request is made. Therefore, Token.io recommends that you set a request-timeout header in your API-only POST /v2/payments requests to match the timeout of your client and avoid DEADLINE_EXCEEDED errors. If this is set, Token.io sends a response when this timeout period has passed and will update payment status as soon as the bank has responded.The following example demonstrates what happens when you set a timeout of 10 seconds and the call to the bank takes 15 seconds:The TPP makes a POST /v2/payments call.Token.io creates a resource with the status INITIATION_PENDING.Token.io starts the call to the bank.After 10 seconds from (1): Token.io returns the payment status INITIATION_PENDING.After 15 seconds from (3): Token.io receives a response from the bank and changes the status to, for example, INITIATION_PENDING_REDIRECT_AUTH. The update will be sent in a webhook, if TPP is subscribed for webhooks.The TPP makes the GET /v2/payments/{id} call and receives the payment with the status INITIATION_PENDING_REDIRECT_AUTH.

## Get payments

 - [GET /v2/payments](https://docs.token.io/products/tpp/api/reference/payments-v2/getpayments.md): The GET /v2/payments endpoint provides you with a list of payments and their details.

## Get a payment

 - [GET /v2/payments/{paymentId}](https://docs.token.io/products/tpp/api/reference/payments-v2/getpayment.md): The GET /v2/payments/{paymentId} endpoint provides you with details of an individual payment and checks the payment status for the next step, if any.

## Provide information for embedded authentication

 - [POST /v2/payments/{paymentId}/embedded-auth](https://docs.token.io/products/tpp/api/reference/payments-v2/provideembeddedfields.md): The POST /v2/payments/{paymentId}/embedded-auth endpoint provides you with the requested information when the payment status is INITIATION_PENDING_EMBEDDED_AUTH. The requested information can be found in the authentication field of the payment.   It's possible that some banks might request the user's input multiple times. In this case you might need to call this endpoint again for a new field set.

## Generate QR code

 - [GET /qr-code](https://docs.token.io/products/tpp/api/reference/payments-v2/getqrcode.md): The GET /qr-code endpoint generates a QR code in fixed SVG format (240x240 px). This allows TPPs to programmatically obtain a scannable QR code .

