---
title: Add payment to cart
slug: cms-12/api/add-payment-to-cart
docTags: 
createdAt: 2026-08-28T13:16:06.833Z
---

{
  "id": "RmXmSx953Y25uH8Hk9Rt6",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "/api/episerver/v3.0/me/carts/{cartId}/{language}/payments",
    "servers": [],
    "name": "Add payment to cart",
    "description": "",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "cartId",
          "type": "integer<int32>",
          "description": "The cart id",
          "format": "int32"
        },
        {
          "kind": "required",
          "name": "language",
          "type": "string",
          "description": "The language"
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/problem+json"
          ],
          "default": "application/problem+json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "The model",
          "customType": "payment",
          "schema": [
            {
              "name": "amount",
              "kind": "optional",
              "type": "number<decimal>",
              "description": "Gets or sets the amount.",
              "format": "decimal"
            },
            {
              "name": "authorizationCode",
              "kind": "optional",
              "type": "string",
              "nullable": true,
              "description": "Gets or sets the authorization code."
            },
            {
              "name": "billingAddress",
              "kind": "optional",
              "type": "object",
              "description": "<p>Represents a customer address\r\ntodo: associate with commerce customers via business foundation?\r\ntodo: add more properties.</p>",
              "modelRef": "#/components/schemas/address",
              "customType": "address",
              "schema": [
                {
                  "name": "firstName",
                  "kind": "optional",
                  "type": "string",
                  "nullable": true,
                  "description": "The first name."
                },
                {
                  "name": "lastName",
                  "kind": "optional",
                  "type": "string",
                  "nullable": true,
                  "description": "The last name."
                },
                {
                  "name": "line1",
                  "kind": "optional",
                  "type": "string",
                  "nullable": true,
                  "description": "The line1."
                },
                {
                  "name": "line2",
                  "kind": "optional",
                  "type": "string",
                  "nullable": true,
                  "description": "The line2."
                },
                {
                  "name": "city",
                  "kind": "optional",
                  "type": "string",
                  "nullable": true,
                  "description": "The city."
                },
                {
                  "name": "countryName",
                  "kind": "optional",
                  "type": "string",
                  "nullable": true,
                  "description": "The country name."
                },
                {
                  "name": "countryCode",
                  "kind": "optional",
                  "type": "string",
                  "nullable": true,
                  "description": "The country code."
                },
                {
                  "name": "postalCode",
                  "kind": "optional",
                  "type": "string",
                  "nullable": true,
                  "description": "The postal code"
                },
                {
                  "name": "regionName",
                  "kind": "optional",
                  "type": "string",
                  "nullable": true,
                  "description": "<p>The region name/state</p>"
                },
                {
                  "name": "email",
                  "kind": "optional",
                  "type": "string",
                  "nullable": true,
                  "description": "The email."
                },
                {
                  "name": "phoneNumber",
                  "kind": "optional",
                  "type": "string",
                  "nullable": true,
                  "description": "The phone number."
                },
                {
                  "name": "name",
                  "kind": "optional",
                  "type": "string",
                  "nullable": true,
                  "description": "The name."
                }
              ]
            },
            {
              "name": "savedBillingAddressName",
              "kind": "optional",
              "type": "string",
              "nullable": true,
              "description": "Gets or sets the billing address."
            },
            {
              "name": "customerName",
              "kind": "optional",
              "type": "string",
              "nullable": true,
              "description": "Gets or sets the name of the customer."
            },
            {
              "name": "paymentId",
              "kind": "optional",
              "type": "integer<int32>",
              "description": "Gets the payment identifier.",
              "format": "int32"
            },
            {
              "name": "systemKeyword",
              "kind": "optional",
              "type": "string",
              "nullable": true,
              "description": "Gets or sets the name of the payment method."
            },
            {
              "name": "paymentType",
              "kind": "optional",
              "type": "string",
              "nullable": true,
              "description": "Gets or sets the type of the payment."
            },
            {
              "name": "providerTransactionID",
              "kind": "optional",
              "type": "string",
              "nullable": true,
              "description": "Gets or sets the provider transaction identifier."
            },
            {
              "name": "status",
              "kind": "optional",
              "type": "string",
              "nullable": true,
              "description": "Gets or sets the status."
            },
            {
              "name": "transactionID",
              "kind": "optional",
              "type": "string",
              "nullable": true,
              "description": "Gets or sets the transaction identifier."
            },
            {
              "name": "transactionType",
              "kind": "optional",
              "type": "string",
              "nullable": true,
              "description": "Gets or sets the type of the transaction."
            },
            {
              "name": "validationCode",
              "kind": "optional",
              "type": "string",
              "nullable": true,
              "description": "Gets or sets the validation code."
            },
            {
              "name": "extendedProperties",
              "kind": "optional",
              "type": "array",
              "nullable": true,
              "description": "Custom properties added by partner or customer.",
              "modelRef": "#/components/schemas/extendedProperty",
              "customType": "extendedProperty[]",
              "schema": [
                {
                  "name": "name",
                  "kind": "optional",
                  "type": "string",
                  "nullable": true,
                  "description": "Name of the property"
                },
                {
                  "name": "value",
                  "kind": "optional",
                  "type": "string",
                  "nullable": true,
                  "description": "The property value."
                }
              ]
            }
          ],
          "modelRef": "#/components/schemas/payment",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "OK",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "400",
        "description": "Bad Request",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "403",
        "description": "Forbidden",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "404",
        "description": "Not found",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "n2cy9bUIVyFz4VEQ0N_l2",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url /api/episerver/v3.0/me/carts/{cartId}/{language}/payments \\\n     --header 'accept: application/problem+json'"
        },
        {
          "id": "SHn1IJQBuX6ow2CuLNepO",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/problem+json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"/api/episerver/v3.0/me/carts/{cartId}/{language}/payments\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "xkk5vm_CVkEszKUVPxGTl",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"/api/episerver/v3.0/me/carts/{cartId}/{language}/payments\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/problem+json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "qm4ZU6qMWvVsi1r7w-0Qw",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"/api/episerver/v3.0/me/carts/{cartId}/{language}/payments\"\n\npayload = {}\nheaders = {\n   'accept': 'application/problem+json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "n2cy9bUIVyFz4VEQ0N_l2"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// OK\n"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Bad Request\n"
        },
        {
          "id": "response-2-403",
          "language": "403",
          "code": "// Forbidden\n"
        },
        {
          "id": "response-3-404",
          "language": "404",
          "code": "// Not found\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}