---
title: "Request to create a digital card account"
method: POST
path: "/createCardAccount"
---

# Request to create a digital card account

`POST /createCardAccount`

This method is used by TSH to request the creation of a digital card account to the TES.</br> This request can come with a payment order which comprises a payment instrument and either the identifier of wallet card used or the wallet account used for the payment</br> In this case, the TES is responsible for returning an order confirmation in the form of a purchase identifier in all cases where the user may be deducted money.</br> The TES shall also create a new card account associated to a unique identifier. In case of stored value account, the card account identifier shall be the card iedntifier.

## Headers

- `x-actor-id` string, required

## Request body

- CreateCardAccountReq
  - `requestHeader` RequestHeader, required
    - `requestId` string, required — Unique request identifier
    - `sessionId` string, required — Unique session identifier used to trace the calls across systems during a use case.
    - `generationDateTime` string, date-time — Date time representing when the request or response has been generated.<br/>RFC3339 format.<br/> Examples:<li>"2018-12-24T17:32:28Z"<li>"2019-10-02T10:00:00-05:00"
  - `issuerId` string, required
  - `walletProviderId` string, required — The Wallet Provider Identifier.<br/>For example:<li>APPLE_PAY<li>HUAWEI_PAY<li>XIAOMI_PAY
  - `productId` string, required — The Product Identifier. Unique for each product.</br> It is used by TSH to find the right metadata (e.g. card arts) associated to the product.
  - `order` Order
    - `orderId` string, required — The Order Identifier. Unique for each order.</br> It is generated by the wallet SDK provider.
    - `amount` number, float, required — The amount of the purchase order.
    - `currency` string, required — The currency specified as 3 letters code (ISO4217)
    - `paymentInstrument` PaymentInstrument, required — payment instrument
      - `paymentData` string, required — The payment instrument parameter contains the base64 representation of the payment instrument/crendial to be used by the PSP to authorize the payment.</br> The base64 format is specific to the type of payment instrument (e.g. Apple Pay In-App cryptogram).</br> The Apple Pay in-app cryptogram can be found in : https://developer.apple.com/library/archive/documentation/PassKit/Reference/PaymentTokenJSON/PaymentTokenJSON.html
      - `type` 'IN-APP_CRYPTO', required — The type of payment instrument used for the purchase order.</br> Only IN-APP_CRYPTO is supported in this version.
      - `version` 'EC_v1' | 'RSA_v1', required — Version information about the payment token.</br> The token uses EC_v1 for ECC-encrypted data, and RSA_v1 for RSA-encrypted data.
      - `signature` string, required — detached PKCS7 signature, Base64 encoded as string.</br> The signature includes the signing certificate, its intermediate CA certificate, and information about the signing algorithm.
      - `header` object, required — Contains the ephemeralPublicKey/wrappedKey, transactionId, and publicKeyHash.</br> These values are required in order to locate the right Private Key in order to decrypt the payment data
        - `ephemeralPublicKey` string — ephemeral public key used for EC_v1 only
        - `wrappedKey` string — encrypted symmetric key used for RSA_v1 only
        - `transactionId` string, required
        - `publicKeyHash` string, required
  - `opaqueServiceProviderData` OpaqueServiceProviderData — This object gives additional service provider data captured by the wallet provider during a payment.</br>The structure of this object is opaque to TSH.

## Response `200`

createCardAccount response payload

- CreateCardAccountRes
  - `responseHeader` ResponseHeader, required
    - `responseId` string, required — Unique response identifier
    - `sessionId` string, required — Unique session identifier used to trace the calls across systems during a use case.
    - `generationDateTime` string, date-time — Date time representing when the request or response has been generated.<br/>RFC3339 format.<br/> Examples:<li>"2018-12-24T17:32:28Z"<li>"2019-10-02T10:00:00-05:00"
    - `statusCode` number, required — Status code to the request |Status code | Description| |-------|-------| |0|OK| |111|Missing mandatory parameter| |112|Bad parameter format| |113|Unknown issuer| |118|Unknown session| |119|Unknown virtual card| |432|Operation is not allowed with current card state| |911|Operation failed| |921|Unexpected server error|
    - `statusMessage` string — Textual status message
  - `cardAccountId` string — The Card Account Identifier. Unique for each card account.
  - `purchaseId` string
  - `signature` string — Signature covering the concatenation of the UTF-8 encoded bytes of orderId followed by purchaseId.</br> It is a ECDSA signature in PKCS7 format.

## Other responses

- `500` — Internal Server Error

---

[API](https://skmtc.net/thalescloud/apis/d1-oauth-api.md) · [All operations](https://skmtc.net/thalescloud/apis/d1-oauth-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/thalescloud/d1-oauth-api/versions/96089514858c/schema)
