v1

latestOpenAPI 3.0.12026-08-0674476716.0 KB
Payments v2

Initiate a payment

The POST /v2/payments endpoint enables you to initiate a payment with a bank.<br/><br/>Once the payment has been initiated, the end user needs to authenticate themselves with their bank.<br/><br/><b>Check payment status:</b><br/><ol><li>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.</li><br/><li>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.</li><br/><li>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.</li><br/><li>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 <a href="https://developer.token.io/token_rest_api_doc/content/e-rest/webhooks.htm" target="_blank">Webhooks</a>).</li><br/><li>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.</li></ol><br/><b>request-timeout header:</b><br/><br/>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.<br/>The following example demonstrates what happens when you set a timeout of 10 seconds and the call to the bank takes 15 seconds:<br/><br/><ol><li>The TPP makes a POST /v2/payments call.</li><br/><li>Token.io creates a resource with the status INITIATION_PENDING.</li><br/><li>Token.io starts the call to the bank.</li><br/><li>After 10 seconds from (1): Token.io returns the payment status INITIATION_PENDING.</li><br/><li>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.</li><br/><li>The TPP makes the GET /v2/payments/{id} call and receives the payment with the status INITIATION_PENDING_REDIRECT_AUTH.</li></ol>

post/v2/payments

Headers

request-timeoutinteger

Sets the number of elapsed seconds until Token.io sends the response back, even if the call is not finished by that time (in which case the call will be completed asynchronously).

Request body

pispConsentAcceptedboolean

This flag indicates whether the user has granted consent for the payment in the TPP's user interface.

initialEmbeddedAuthobject

This field provides a map of the initial embedded authentication fields, with their values. The list of the required initial credentials can be found in the bank metadata. Please use the id of each field as a key in the map. <br/><br/> Using this field is optional. Even if a bank requires initial embedded authentication fields, you may choose not to populate the initialEmbeddedAuth field. In this case you'll be able to provide these fields later in the flow as part of an embedded authentication step.

Example request

{
  "initiation": {
    "bankId": "ob-modelo",
    "refId": "9htio4a1sp2akdr1aa",
    "remittanceInformationPrimary": "Sweepco",
    "remittanceInformationSecondary": "Secondary remittance information.",
    "onBehalfOfId": "c5a863bc-86f2-4418-a26f-25b24c7983c7",
    "amount": {
      "value": "10.23",
      "currency": "EUR"
    },
    "localInstrument": "SEPA",
    "debtor": {
      "iban": "GB29NWBK60161331926819",
      "bic": "BOFIIE2D",
      "address": {
        "addressLine": [
          "The Coach House"
        ],
        "streetName": "221B",
        "buildingNumber": "2C",
        "postCode": "TR26 1EZ",
        "townName": "Saint Ives",
        "state": "Cornwall",
        "country": "GB"
      }
    },
    "creditor": {
      "iban": "GB29NWBK60161331926819",
      "bic": "BOFIIE2D",
      "name": "Customer Inc.",
      "ultimateCreditorName": "Customer Inc.",
      "address": {
        "addressLine": [
          "The Coach House"
        ],
        "streetName": "221B",
        "buildingNumber": "2C",
        "postCode": "TR26 1EZ",
        "townName": "Saint Ives",
        "state": "Cornwall",
        "country": "GB"
      }
    },
    "executionDate": "2023-04-29",
    "returnTokenizedAccount": true,
    "callbackUrl": "https://tpp.com/callback",
    "callbackState": "6242e45e-3063-4c42-8376",
    "chargeBearer": "CRED",
    "risk": {
      "psuId": "0000789123",
      "paymentContextCode": "PISP_PAYEE",
      "paymentPurposeCode": "DVPM",
      "merchantCategoryCode": "4812",
      "beneficiaryAccountType": "BUSINESS",
      "contractPresentIndicator": true,
      "beneficiaryPrepopulatedIndicator": true,
      "deliveryAddress": {
        "addressLine": [
          "Flat 2, The Red Lodge, 1 High Street"
        ],
        "addressType": "BUSINESS",
        "buildingNumber": "1",
        "country": "GB",
        "countrySubDivision": [
          "North Yorkshire"
        ],
        "department": "1",
        "postCode": "YO62 5JB",
        "streetName": "High Street",
        "subDepartment": "Flat 2",
        "townName": "York"
      }
    },
    "flowType": "FULL_HOSTED_PAGES",
    "externalPsuReference": "psu external reference 12345"
  },
  "initialEmbeddedAuth": {
    "username": "John Smith"
  }
}

Response

Successful response

Example response

{
  "payment": {
    "id": "pm:12345abcd:abcd",
    "memberId": "m:123456abcd:abcd",
    "initiation": {
      "bankId": "ob-modelo",
      "refId": "9htio4a1sp2akdr1aa",
      "remittanceInformationPrimary": "Sweepco",
      "remittanceInformationSecondary": "Secondary remittance information.",
      "onBehalfOfId": "c5a863bc-86f2-4418-a26f-25b24c7983c7",
      "amount": {
        "value": "10.23",
        "currency": "EUR"
      },
      "localInstrument": "SEPA",
      "debtor": {
        "iban": "GB29NWBK60161331926819",
        "bic": "BOFIIE2D",
        "address": {
          "addressLine": [
            "The Coach House"
          ],
          "streetName": "221B",
          "buildingNumber": "2C",
          "postCode": "TR26 1EZ",
          "townName": "Saint Ives",
          "state": "Cornwall",
          "country": "GB"
        }
      },
      "creditor": {
        "iban": "GB29NWBK60161331926819",
        "bic": "BOFIIE2D",
        "name": "Customer Inc.",
        "ultimateCreditorName": "Customer Inc.",
        "address": {
          "addressLine": [
            "The Coach House"
          ],
          "streetName": "221B",
          "buildingNumber": "2C",
          "postCode": "TR26 1EZ",
          "townName": "Saint Ives",
          "state": "Cornwall",
          "country": "GB"
        }
      },
      "executionDate": "2023-04-29",
      "returnTokenizedAccount": true,
      "callbackUrl": "https://tpp.com/callback",
      "callbackState": "6242e45e-3063-4c42-8376",
      "chargeBearer": "CRED",
      "risk": {
        "psuId": "0000789123",
        "paymentContextCode": "PISP_PAYEE",
        "paymentPurposeCode": "DVPM",
        "merchantCategoryCode": "4812",
        "beneficiaryAccountType": "BUSINESS",
        "contractPresentIndicator": true,
        "beneficiaryPrepopulatedIndicator": true,
        "deliveryAddress": {
          "addressLine": [
            "Flat 2, The Red Lodge, 1 High Street"
          ],
          "addressType": "BUSINESS",
          "buildingNumber": "1",
          "country": "GB",
          "countrySubDivision": [
            "North Yorkshire"
          ],
          "department": "1",
          "postCode": "YO62 5JB",
          "streetName": "High Street",
          "subDepartment": "Flat 2",
          "townName": "York"
        }
      },
      "flowType": "FULL_HOSTED_PAGES",
      "externalPsuReference": "psu external reference 12345"
    },
    "refundDetails": {
      "refundAccount": {
        "iban": "GB29NWBK60161331926819",
        "bic": "BOFIIE2D",
        "name": "John Smith"
      },
      "paymentRefundStatus": "NONE",
      "settledRefundAmount": {
        "value": "10.23",
        "currency": "EUR"
      },
      "remainingRefundAmount": {
        "value": "10.23",
        "currency": "EUR"
      }
    },
    "status": "INITIATION_COMPLETED",
    "statusReasonInformation": "The payment is settled on the debtor side.",
    "bankPaymentStatus": "ACPC",
    "bankPaymentId": "1231423",
    "bankTransactionId": "2UhwCZ3BMaEcAUK8bZdukor7NL4tH6TBuu6aJMp5KKfX:5zKcENpV",
    "bankVrpStatus": "AcceptedCreditSettlementCompleted",
    "authentication": {
      "redirectUrl": "http://psu-redirect.com"
    },
    "createdDateTime": "2023-04-05T17:02:11.954Z",
    "updatedDateTime": "2023-04-05T17:02:11.954Z",
    "errorInfo": {
      "httpErrorCode": 503,
      "message": "UNAVAILABLE: HTTP connection failed",
      "tokenExternalError": true,
      "tokenTraceId": "eASI3Onqkpi1unAM59O5"
    },
    "paymentLinkStatus": "LINK_ACTIVE"
  }
}