# Visa In-App Provisioning

## In-App Provisioning for Apple Pay

### Create Card Data Apple Pay  v1 - Latest

Card data for provisioning a Visa Token in ApplePay using vCardId or encrypted card as input

#### Request

##### query Parameters

|     |     |
| --- | --- |
| apikey<br>required | string<br>API key from Visa Developer Platform (VDP) |

##### header Parameters

|     |     |
| --- | --- |
| Content-Type<br>required | string<br>application/json |
| x-pay-token<br>required | string<br>API Key-Shared Secret Authentication. Please refer to [https://developer.visa.com/pages/working-with-visa-apis/x-pay-token](https://developer.visa.com/pages/working-with-visa-apis/x-pay-token) for more details. Resource path to be used while building x-pay-token must be 'provisioning/cardData/applePay'. |

##### Request Body schema: application/json

Create Card Data for ApplePay provisioning using vCardID or Encrypted Card.

| deviceCert<br>required | string \[ 0 .. 8192 \] characters <br>Apple device X.509 certificates received from mobile application. |
| nonce<br>required | string 32 characters <br>32 digit random number generated by Apple. |
| nonceSignature<br>required | string \[ 0 .. 512 \] characters <br>Signature signed by Apple on nonce in SE. |
| encCard | string

`Conditional.`

Either of `vCardId` or `encCard` is required.

`vCardId` will take precedence in case both `vCardId` and `encCard` is part of the request body.

Encrypted `CardInfo`

### Example

```
{
  "accountNumber": "4000000000000000",
  "nameOnCard": "Digital Issuance",
  "cvv2": "123",
  "expirationDate": {
      "month": "01",
      "year": "2021"
  },
  "billingAddress": {
    "name": "Digital Issuance",
    "line1": "12301 Research Boulevard",
    "line2": "Research Boulevard",
    "line3": "Visa USA",
    "city": "Austin",
    "state": "TX",
    "countryCode": "US",
    "postalCode": "78759"
  }
}
```

### CardInfo Schema

| Field | Type | Description |
| --- | --- | --- |
| accountNumber | string<br>required<br>minLength: 12<br>maxLength: 18 | PAN (Primary Account Number) of the card to be provisioned or enrolled |
| paymentAccountReference | string<br>optional | A Payment Account Reference (PAR) is a unique reference value associated with a specific cardholder PAN |
| cvv2 | string<br>conditional<br>minLength: 3<br>maxLength: 3 | CVV2 value associated with the PAN on the card |
| nameOnCard | string<br>conditional<br>minLength: 0<br>maxLength: 256 | The full name on the card associated with the issued/enrolled card |
| expirationDate | `ExpirationDate`<br>required | Card’s expiration date |
| billingAddress | `Address`<br>optional | Billing address associated with the card |

### ExpirationDate Schema

| Field | Type | Description |
| --- | --- | --- |
| month | string<br>required<br>minLength: 2<br>maxLength: 2 | The month that the card is set to expire |
| year | string<br>required<br>minLength: 4<br>maxLength: 4 | The year that the card is set to expire |

### Address Schema

| Field | Type | Description |
| --- | --- | --- |
| name | string<br>optional<br>maxLength: 100 | The name of the addressee |
| line1 | string<br>optional<br>maxLength: 140 | First line of the address |
| line2 | string<br>optional<br>maxLength: 140 | Second line of the address |
| line3 | string<br>optional<br>maxLength: 140 | Third line of the address |
| city | string<br>optional<br>maxLength: 100 | Name of the city |
| state | string<br>conditional | Second part of the “country-subdivision” (State or Province) code in ISO 3166-2 format of the country, eg \"TX\" |
| postalCode | string<br>optional<br>minLength: 3<br>maxLength: 16 | The postal code associated with the address, such as zip code |
| countryCode | string<br>required | ISO 3166-1 alpha-2 formatted country code associated with the address | |
| productType | string \[ 0 .. 100 \] characters <br>Specifies the product type for push provisioning. This value is provided by Apple's team based on the card program. If not specified, it defaults to the Visa/Mastercard default productType value. Visa's default productType is `DEFAULT_VISA` and Mastercard's default productType is `DEFAULT_MASTERCARD`. |
| signingKeyID | string \[ 1 .. 100 \] characters <br>Token service provider specific signing key identifier |
| tokenServiceProvider | string 1 characters <br>Indicates which token service provider will process the card data generated for provisioning. The default value is "V".<br>Enum:"V""M" |
| vCardID | string 42 characters <br>`Conditional.`<br>Either of `vCardId` or `encCard` is required.<br>Visa-defined unique ID of the card to produce the ApplePay provisioning card data for. `vCardId` will take precedence in case both `vCardId` and `encCard` is part of the request body. |

### Responses

200
OK

##### Response Schema: application/json

|     |     |
| --- | --- |
| activationData<br>required | string \[ 0 .. 8192 \] characters <br>Activation data consisting of encrypted nonce, noncesignature, and authCode in base64 format. |
| encryptedPassData<br>required | string \[ 0 .. 8192 \] characters <br>Authentication data consisting of encrypted PAN, expiry and datetime in base64 format. |
| ephemeralPublicKey<br>required | string \[ 0 .. 8192 \] characters <br>VISA.ECC.ePK generated while creating MBPAD encryptedInformation. EC point with P-256 curve and uncompressed format. Base64 format. |
| vCardID<br>required | string 42 characters <br>Visa-defined unique ID of the card to produce the provisioning card data for. |
| paymentAccountReference | string 29 characters <br>Payment Account Reference (PAR) is a unique reference value associated with a specific cardholder PAN. |

400
Bad Request

##### Response Schema: application/json

|     |     |
| --- | --- |
| errorResponse | object |
| |     |     |
| --- | --- |
| details | Array of objects<br>Array of fields - Data validation errors should use this field to specify which fields failed the validation using location field. |
| Array

|     |     |
| --- | --- |
| location | string<br>The value of this field is using XPATH expression to point to the field, which failed validation. |
| message | string<br>The specific error for this field. | |
| message | string<br>Message describing the error condition with additional information wherever applicable. |
| reason | string<br>Reason Code for the error condition. Error handling business logic should be driven by this field. |
| status | integer <int32> <br>3-digit HTTP Status Code | |

401
Unauthorized

##### Response Schema: application/json

|     |     |
| --- | --- |
| errorResponse | object |
| |     |     |
| --- | --- |
| message | string<br>Message describing the error condition with additional information wherever applicable. |
| reason | string<br>Reason Code for the error condition. Error handling business logic should be driven by this field. |
| status | integer <int32> <br>3-digit HTTP Status Code | |

403
Forbidden

##### Response Schema: application/json

422
Name on Card not Available. The card referenced in this request is already enrolled but has no nameOnCard value. And, there is no Customer associated with this card so that the nameOnCard can not be derived from Customer name.

##### Response Schema: application/json

502
Bad Gateway

##### Response Schema: application/json

503
Service Unavailable

##### Response Schema: application/json

504
Gateway Timeout

##### Response Schema: application/json
