# Card Payout to a wallet

## Flow

1. Integrate with your mobile wallet provider: [Apple Pay](/products/wallets/applepay) and [Google Pay](/products/wallets/googlepay).
2. Integrate with our Card Payments API - use our [`customerInitiatedTransactions` endpoint](/products/card-payments/openapi/other/authorize) endpoint with your encrypted payload, including the `customerAgreement` object.
3. You receive a token (`tokens:token`) in your response.
4. Integrate with our Card Payouts API - use your token to [make a payout](/products/card-payouts/payouts) with a `payoutInstrument.type` value of `card/tokenized`.


## Authorization request

`POST`  `https://try.access.worldpay-bsh.securedataplatform.com/cardPayments/customerInitiatedTransactions`

Request body

Amount
You may leave the `amount` as `0` if no immediate payment is due.

Apple Pay

```json
{
    "transactionReference": "Memory265-13/08/1876",
    "channel": "ecom",
    "merchant": {
        "entity": "default"
    },
    "instruction": {
        "requestAutoSettlement": {
            "enabled": false
        },
        "customerAgreement": {
            "type": "cardOnFile",
            "storedCardUsage": "first"
        },
        "narrative": {
            "line1": "Mind Palace"
        },
        "value": {
            "currency": "GBP",
            "amount": 0
        },
        "paymentInstrument": {
            "type": "card/wallet+applepay",
            "walletToken": "{\"version\": \"EC_v1\",\"data\": \"kdHd..GQ==\",\"signature\": \"MIAGCSqGSIb3DQEH...AAA\",\"header\": {\"transactionId\": \"d3b28af..f8\",\"ephemeralPublicKey\": \"MFkwE..Q==\",\"publicKeyHash\": \"dxCK..6o=\" }}"
        }
    }
}
```

Google Pay

```json
{
    "transactionReference": "Memory265-13/08/1876",
    "channel": "ecom",
    "merchant": {
        "entity": "default"
    },
    "instruction": {
        "requestAutoSettlement": {
            "enabled": false
        },
        "customerAgreement": {
            "type": "cardOnFile",
            "storedCardUsage": "first"
        },
        "narrative": {
            "line1": "Mind Palace"
        },
        "value": {
            "currency": "GBP",
            "amount": 250
        },
        "paymentInstrument": {
            "type": "card/wallet+googlepay",
            "walletToken": "{\"protocolVersion\":\"ECv1\",\"signature\":\"MEQCIH6Q4OwQ0jAceFEkGF0JID6sJNXxOEi4r+mA7biRxqBQAiAondqoUpU/bdsrAOpZIsrHQS9nwiiNwOrr24RyPeHA0Q\\u003d\\u003d\",\"signedMessage\":\"{\\\"tag\\\":\\\"jpGz1F1Bcoi/fCNxI9n7Qrsw7i7KHrGtTf3NrRclt+U\\\\u003d\\\",\\\"ephemeralPublicKey\\\":\\\"BJatyFvFPPD21l8/uLP46Ta1hsKHndf8Z+tAgk+DEPQgYTkhHy19cF3h/bXs0tWTmZtnNm+vlVrKbRU9K8+7cZs\\\\u003d\\\",\\\"encryptedMessage\\\":\\\"mKOoXwi8OavZ\\\"}\"}"
        }
    }
}
```

## Authorization response

#### Successful response

You receive:

* an HTTP code `201`
* an `"outcome": "authorized"`
* risk factors (only returned if issuer identifies conflict)
* a scheme reference
* a `paymentInstrument` detailing brand information about the card that was used
* links to [cancel](/products/card-payments/manage-payments#cancel-an-authorization), [settle](/products/card-payments/manage-payments#settle-an-authorization), or [partially settle](/products/card-payments/manage-payments#partially-settle-an-authorization) the payment
* a token link you can use to make a Payout


#### Refused response

You receive:

* an HTTP code `201`
* an `"outcome": "refused"`
* a [refusal code](/products/reference/refusal-response)
* a `description` which gives additional context on the refusal
* risk factors (only returned if issuer identifies conflict)
* a `paymentInstrument`


#### Example response

Successful

```json
{
    "outcome": "authorized",
    "paymentId": "paygN28d-s18ncZnsDL02n470",
    "commandId": "cmdWP_h29znMbajSr2-911U70",
    "riskFactors": [
        {
            "risk": "notChecked",
            "detail": "postcode",
            "type": "avs"
        },
        {
            "risk": "notChecked",
            "detail": "address",
            "type": "avs"
        }
    ],
    "issuer": {
        "authorizationCode": "12345A"
    },
    "scheme": {
        "reference": "060720116005060"
    },
    "paymentInstrument": {
        "type": "card/network+masked",
        "cardBin": "444433",
        "lastFour": "1111",
        "tokenNumber": "444433******1111",
        "countryCode": "GB",
        "expiryDate": {
            "month": 2,
            "year": 2028
        },
        "cardBrand": "visa",
        "fundingType": "debit",
        "category": "consumer",
        "issuerName": "Some Issuer PLC",
        "paymentAccountReference": "Q1HJZ28RKA1EBL470G9XYG90R5D3E"
    },
    "_links": {
        "cardPayments:cancel": {
            "href": "https://try.access.worldpay-bsh.securedataplatform.com/payments/authorizations/cancellations/eyJrIjoiazUyOTVhMSIsImxpbmtWZXJzaW9uIjoiMy4wLjAifQ==.7uyuNo1ShOgM5rTwStg86LXzb0a2wdLW1lwX:DIQ2Ecrp4gw65VLnHmjsAVqzpa2NcwixaBb2p8R2x5NPXdRpybJ2ndKlbkNOc9gj+ruN20iaTdYqv2FNgB3ZAw3g+yyUMUlQDFD8DU++ZswXpUQe8YTBHmTP8zHQUXrSORn9IaI6kzJnMu2HWwEJOqKnWLvRCMy:fr4ptatJJrmRVON8WTjisJL:sd3TJ9uDcO:gD+q+Q01y++Mzop0k8y3bDcnNBpsG:8xf4uKGGYO3EcAWA=="
        },
        "cardPayments:partialCancel": {
            "href": "https://try.access.worldpay-bsh.securedataplatform.com/payments/authorizations/cancellations/partials/eyJrIjoiazUyOTVhMSIsImxpbmtWZXJzaW9uIjoiMy4wLjAifQ==.7uyuNo1ShOgM5rTwStg86LXzb0a2wdLW1lwX:DIQ2Ecrp4gw65VLnHmjsAVqzpa2NcwixaBb2p8R2x5NPXdRpybJ2ndKlbkNOc9gj+ruN20iaTdYqv2FNgB3ZAw3g+yyUMUlQDFD8DU++ZswXpUQe8YTBHmTP8zHQUXrSORn9IaI6kzJnMu2HWwEJOqKnWLvRCMy:fr4ptatJJrmRVON8WTjisJL:sd3TJ9uDcO:gD+q+Q01y++Mzop0k8y3bDcnNBpsG:8xf4uKGGYO3EcAWA=="
        },        
        "cardPayments:settle": {
            "href": "https://try.access.worldpay-bsh.securedataplatform.com/payments/settlements/full/eyJrIjoiazUyOTVhMSIsImxpbmtWZXJzaW9uIjoiMy4wLjAifQ==.7uyuNo1ShOgM5rTwStg86LXzb0a2wdLW1lwX:DIQ2Ecrp4gw65VLnHmjsAVqzpa2NcwixaBb2p8R2x5NPXdRpybJ2ndKlbkNOc9gj+ruN20iaTdYqv2FNgB3ZAw3g+yyUMUlQDFD8DU++ZswXpUQe8YTBHmTP8zHQUXrSORn9IaI6kzJnMu2HWwEJOqKnWLvRCMy:fr4ptatJJrmRVON8WTjisJL:sd3TJ9uDcO:gD+q+Q01y++Mzop0k8y3bDcnNBpsG:8xf4uKGGYO3EcAWA=="
        },
        "cardPayments:partialSettle": {
            "href": "https://try.access.worldpay-bsh.securedataplatform.com/payments/settlements/partials/eyJrIjoiazUyOTVhMSIsImxpbmtWZXJzaW9uIjoiMy4wLjAifQ==.7uyuNo1ShOgM5rTwStg86LXzb0a2wdLW1lwX:DIQ2Ecrp4gw65VLnHmjsAVqzpa2NcwixaBb2p8R2x5NPXdRpybJ2ndKlbkNOc9gj+ruN20iaTdYqv2FNgB3ZAw3g+yyUMUlQDFD8DU++ZswXpUQe8YTBHmTP8zHQUXrSORn9IaI6kzJnMu2HWwEJOqKnWLvRCMy:fr4ptatJJrmRVON8WTjisJL:sd3TJ9uDcO:gD+q+Q01y++Mzop0k8y3bDcnNBpsG:8xf4uKGGYO3EcAWA=="
        },
        "cardPayments:events": {
            "href": "https://try.access.worldpay-bsh.securedataplatform.com/payments/events/eyJrIjoiazUyOTVhMSIsImxpbmtWZXJzaW9uIjoiMy4wLjAifQ==.7uyuNo1ShOgM5rTwStg86LXzb0a2wdLW1lwX:DIQ2Ecrp4gw65VLnHmjsAVqzpa2NcwixaBb2p8R2x5NPXdRpybJ2ndKlbkNOc9gj+ruN20iaTdYqv2FNgB3ZAw3g+yyUMUlQDFD8DU++ZswXpUQe8YTBHmTP8zHQUXrSORn9IaI6kzJnMu2HWwEJOqKnWLvRCMy:fr4ptatJJrmRVON8WTjisJL:sd3TJ9uDcO:gD+q+Q01y++Mzop0k8y3bDcnNBpsG:8xf4uKGGYO3EcAWA=="
        },
        "tokens:token": {
            "href": "https://access.worldpay-bsh.securedataplatform.com/tokens/linkData"
        },
        "curies": [{
            "name": "cardPayments",
            "href": "https://try.access.worldpay-bsh.securedataplatform.com/rels/payments/{rel}",
            "templated": true
        }]
    }
}
```

Refused

```json
{
    "outcome": "refused",
    "paymentId": "pay38Ndh3N-cS18i023-hksO0",
    "commandId": "cmd93Ng8_KvnwI9sK7dJakl90",
    "description": "Do not honor",
    "refusalCode": "83",
    "refusalDescription": "Fraud/Security related reasons",
    "riskFactors": [
        {
            "risk": "notChecked",
            "detail": "postcode",
            "type": "avs"
        },
        {
            "risk": "notChecked",
            "detail": "address",
            "type": "avs"
        }
    ],
    "scheme": {
        "reference": "060720116005060"
    },
    "paymentInstrument": {
        "type": "card/network+masked",
        "cardBin": "444433",
        "lastFour": "1111",
        "tokenNumber": "444433******1111",
        "countryCode": "GB",
        "expiryDate": {
            "month": 2,
            "year": 2028
        },
        "cardBrand": "visa",
        "fundingType": "debit",
        "category": "consumer",
        "issuerName": "Some Issuer PLC",
        "paymentAccountReference": "Q1HJZ28RKA1EBL470G9XYG90R5D3E"
    }
}
```

You can use the `payments:settle` action link to [settle the payment](/products/card-payments/manage-payments#settle-an-authorization) straight away. Alternatively you can cache the response and use the link to settle the payment later.

## Making a Payout

Once you have submitted an authorization request and received a `tokens:token` in the response, you can make a [card payout with the token](/products/card-payouts/payouts#fast-access-request) you have received in your [authorization response](#authorization-response).

`POST`  `https://try.access.worldpay-bsh.securedataplatform.com/payouts/fastAccess`

Token payout

```json
{
    "transactionReference": "Memory265-13/08/1876",
    "merchant": {
        "entity": "default"
    },
    "instruction": {
        "narrative": {
            "line1": "The Mind Palace Ltd",
            "line2": "Memory265-13/08/1876"
        },
        "value": {
            "currency": "GBP",
            "amount": 100
        },
        "payoutInstrument": {
            "type": "card/tokenized",
            "href": "https://try.access.worldpay-bsh.securedataplatform.com/tokens/eyJrIjoxLCJkIjoiMjZ5OUp3Q2dEeDVjWEZBcjhjSmRlcmZTcE44ZzRoazFMcmNCSzlqaEVWcz0ifQ"
        }
    }
}
```

The response body for payouts to mobile wallets is identical to that of other [card-based payout instruments](/products/card-payouts/payouts#fast-access-response).