# Add Card Payment v2.0Beta

The Add Card Payment endpoint adds a payment to a cart. A card payment will be created and submitted to our payment processor. The value of the payment will be the balance remaining on the cart.

The Payment Status endpoint can be used to track the status of the payment as it is processed by the payment processor.

# Request

POST /v2.0/customers/{profileKey}/carts/{cartId}/payments/card

# Authorization

An OAuth 2.0 Bearer token with the Cart.Write and Payment.Write scopes is required. For more information, see Authentication.

# Path Parameters

A list of the supported path parameters is described below.

Name Required Type Description
profileKey true guid The profile key for the customer.
cartId true guid The cart id for the cart.

# Request Body

The request body takes an AddCardPayment object which is described below.

# AddCardPayment

Name Required Type Description
cardId false string(50) The identifier of the payment card that the customer selected to use for payment. Usually is the value of the cardId property from the selected card from the Discover Payment Cards endpoint.

If not provided, the customer will be prompted for their card details in the card payment flow.
# Payment Cards

The customer may either pay using an existing card they have already saved against their profile or they can use a different card. The payment processor handles this flow and will adapt the form they display to the customer.

Therefore, if the customer does not select the card to use, simply do not provide a value for cardId and the customer will be asked for card details by the payment processor.

# Sample

{
    "cardId": "5e5edd8a-ff4b-44b7-9239-500f456471e8"
}

# Response

200
OK
Returns an ApiResponse envelope.

# Response Body

The endpoint returns our ApiResponse envelope. The data property of the response will contain a paymentId that can be used to check the status of the payment using the Payment Status endpoint.

Name Required Type Description
paymentId true string The unique identifier for the payment that was created.

# Sample

{
    "message": "The operation succeeded!",
    "notifications": [
        {
            "severity": "Success",
            "text": "The payment was added to the cart and submitted for processing.",
            "code": null,
            "additionalData": null
        }
    ],
    "data": {
        "paymentId": "177680d8-e27a-4e91-a690-116bb825688e"
    }
}

# Errors

The standard error responses apply.

400
Bad Request
When the request fails validation.
401
Unauthorized
When authentication fails.
403
Forbidden
When authorisation fails.
404
Not Found
When the cart cannot be found.