# Create scheme token

Request to create a scheme token, representing payment data according to scheme rules.

Endpoint: POST /token-vault/{ownerType}/{ownerId}/vaults/scheme-tokens
Version: 1.0.0

## Path parameters:

  - `ownerId` (string, required)
    The identifier of the vault owner. This must match the owner type. For example, provide your merchant group ID when `ownerType` is `MerchantGroup`.

  - `ownerType` (string, required)
    The type of entity that owns the token vault. Use with `ownerId` to identify which vault to use.

## Request fields (application/json):

  - `card` (object, required)
    Details about the card for tokenisation.

  - `card.primaryAccountNumber` (string, required)
    The unique number assigned to a payment card, such as a credit or debit card. This number typically contains 16 digits, structured in a specific format to indicate the card network, issuing bank, and account number.
    Example: 4111111111111111

  - `card.expiryMonth` (string, required)
    The expiry month of the card, as a number from 1 to 12. Typically zero-padded to two digits (for example, `03`).
    Example: 03

  - `card.expiryYear` (string, required)
    The expiry year of the card (`YYYY`).
    Example: 2025

  - `card.holderName` (string, required)
    The full name of the individual who owns the payment card. This name is printed on the physical card and is used for verifying the cardholder's identity during transactions. The cardholder name is a vital component for transaction processing, especially in cases of card-not-present transactions like online purchases. It should be treated with confidentiality to safeguard the cardholder's privacy and prevent potential misuse.
    Example: Mr John Doe

  - `card.cardVerificationCode` (string)
    The Card Verification Code (CVC) associated with the payment card, a security feature for transactions where the card is not physically present. The security code is typically a 3 or 4 digit number found on the card, used to verify that the cardholder is in possession of the card during non-face-to-face transactions.
    Example: 123

  - `customerConsent` (object)
    Optional details about the customer's consent to store their payment card. Include this when you create the token if you might need to revoke consent later.

  - `customerConsent.hasCustomerConsent` (boolean)
    Whether the customer has consented to storing their payment card details.
    Example: true

  - `customerConsent.merchantId` (string)
    The merchant identifier associated with the consent.
    Example: MERCHANT-001

  - `customerConsent.merchantShopperId` (string)
    Your unique identifier for the shopper. Use the same value when you revoke consent. Matching is case-sensitive and doesn't ignore spaces.
    Example: 6152

## Response 200:

  - `200` (unknown)
    Successful creation of the scheme token

## Response 200 fields (application/json):

  - `schemeTokenId` (string)
    The unique scheme token ID generated by PXP. It is used as a reference to extract the schemeTokenNumber.

  - `fundingSource` (string)
    The funding source type of the card.
    Enum: "Credit", "Debit", "Prepaid"

## Response 400:

  - `400` (unknown)
    Bad request due to invalid input

## Response 400 fields (application/json):

  - `correlationId` (string)
    The unique identifier for this error response. Include it when contacting PXP support.
    Example: 81f32b80-2ba0-4430-8ecd-0b559274ba9c

  - `details` (array)
    Additional details about the error.

  - `errorCode` (string)
    The error code returned for the operation.
    Example: INVALID_REQUEST

  - `errorReason` (string)
    The error reason returned for the operation.
    Example: The request parameters are invalid.

## Response 401:

  - `401` (unknown)
    Unauthorised access

## Response 401 fields (application/json):

  - `correlationId` (string)
    The unique identifier for this error response. Include it when contacting PXP support.
    Example: 81f32b80-2ba0-4430-8ecd-0b559274ba9c

  - `details` (array)
    Additional details about the error.

  - `errorCode` (string)
    The error code returned for the operation.
    Example: INVALID_REQUEST

  - `errorReason` (string)
    The error reason returned for the operation.
    Example: The request parameters are invalid.

## Response 403:

  - `403` (unknown)
    Forbidden access

## Response 403 fields (application/json):

  - `correlationId` (string)
    The unique identifier for this error response. Include it when contacting PXP support.
    Example: 81f32b80-2ba0-4430-8ecd-0b559274ba9c

  - `details` (array)
    Additional details about the error.

  - `errorCode` (string)
    The error code returned for the operation.
    Example: INVALID_REQUEST

  - `errorReason` (string)
    The error reason returned for the operation.
    Example: The request parameters are invalid.

## Response 404:

  - `404` (unknown)
    Resource not found

## Response 404 fields (application/json):

  - `correlationId` (string)
    The unique identifier for this error response. Include it when contacting PXP support.
    Example: 81f32b80-2ba0-4430-8ecd-0b559274ba9c

  - `details` (array)
    Additional details about the error.

  - `errorCode` (string)
    The error code returned for the operation.
    Example: INVALID_REQUEST

  - `errorReason` (string)
    The error reason returned for the operation.
    Example: The request parameters are invalid.

## Response 413:

  - `413` (unknown)
    Payload too large

## Response 413 fields (application/json):

  - `correlationId` (string)
    The unique identifier for this error response. Include it when contacting PXP support.
    Example: 81f32b80-2ba0-4430-8ecd-0b559274ba9c

  - `details` (array)
    Additional details about the error.

  - `errorCode` (string)
    The error code returned for the operation.
    Example: INVALID_REQUEST

  - `errorReason` (string)
    The error reason returned for the operation.
    Example: The request parameters are invalid.

## Response 422:

  - `422` (unknown)
    Unprocessable entity due to semantic errors

## Response 422 fields (application/json):

  - `correlationId` (string)
    The unique identifier for this error response. Include it when contacting PXP support.
    Example: 81f32b80-2ba0-4430-8ecd-0b559274ba9c

  - `details` (array)
    Additional details about the error.

  - `errorCode` (string)
    The error code returned for the operation.
    Example: INVALID_REQUEST

  - `errorReason` (string)
    The error reason returned for the operation.
    Example: The request parameters are invalid.

## Response 500:

  - `500` (unknown)
    Internal server error

## Response 500 fields (application/json):

  - `correlationId` (string)
    The unique identifier for this error response. Include it when contacting PXP support.
    Example: 81f32b80-2ba0-4430-8ecd-0b559274ba9c

  - `details` (array)
    Additional details about the error.

  - `errorCode` (string)
    The error code returned for the operation.
    Example: INVALID_REQUEST

  - `errorReason` (string)
    The error reason returned for the operation.
    Example: The request parameters are invalid.

## Response 200 examples:

  - `Create Scheme Token Response` (unknown)

