xclade
Store APIPayment collections

Create Payment Collection

Create a payment collection for a cart. This is used during checkout, where the payment collection holds the cart's payment sessions.

POST
/store/payment-collections

Query Parameters

fields?string

Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.

Header Parameters

x-publishable-api-key*string

Publishable API Key created in the Medusa Admin.

Request Body

application/json

cart_id*string

The ID of the cart this payment collection is for.

Response Body

application/json

application/json

text/plain

application/json

application/json

application/json

application/json

curl -X POST "https://{tenant}.api.myxclade.com/store/payment-collections" \  -H "x-publishable-api-key: string" \  -H "Content-Type: application/json" \  -d '{    "cart_id": "string"  }'
{
  "payment_collection": {
    "id": "string",
    "currency_code": "string",
    "amount": 0,
    "authorized_amount": 0,
    "captured_amount": 0,
    "refunded_amount": 0,
    "completed_at": "2019-08-24T14:15:22Z",
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z",
    "metadata": {},
    "status": "canceled",
    "payment_providers": [
      {
        "id": "string"
      }
    ],
    "payment_sessions": [
      {
        "id": "string",
        "amount": 0,
        "currency_code": "usd",
        "provider_id": "string",
        "data": {},
        "context": {
          "customer": {
            "id": "cus_123"
          }
        },
        "status": "authorized",
        "authorized_at": "2019-08-24T14:15:22Z",
        "payment_collection": {},
        "payment": {
          "id": "string",
          "amount": 0,
          "authorized_amount": 0,
          "currency_code": "string",
          "provider_id": "string",
          "data": {},
          "created_at": "2019-08-24T14:15:22Z",
          "updated_at": "2019-08-24T14:15:22Z",
          "captured_at": "2019-08-24T14:15:22Z",
          "canceled_at": "2019-08-24T14:15:22Z",
          "captured_amount": 0,
          "refunded_amount": 0,
          "captures": [
            {
              "id": "string",
              "amount": 0,
              "created_at": "2019-08-24T14:15:22Z",
              "created_by": "string",
              "payment": {}
            }
          ],
          "refunds": [
            {
              "id": "string",
              "amount": 0,
              "refund_reason_id": "string",
              "note": "string",
              "created_at": "2019-08-24T14:15:22Z",
              "created_by": "string",
              "payment": {},
              "refund_reason": {
                "id": "string",
                "label": "string",
                "description": "string",
                "metadata": {},
                "created_at": "2019-08-24T14:15:22Z",
                "updated_at": "2019-08-24T14:15:22Z",
                "code": "string"
              }
            }
          ],
          "payment_collection": {},
          "payment_session": {}
        }
      }
    ],
    "payments": [
      {
        "id": "string",
        "amount": 0,
        "authorized_amount": 0,
        "currency_code": "string",
        "provider_id": "string",
        "data": {},
        "created_at": "2019-08-24T14:15:22Z",
        "updated_at": "2019-08-24T14:15:22Z",
        "captured_at": "2019-08-24T14:15:22Z",
        "canceled_at": "2019-08-24T14:15:22Z",
        "captured_amount": 0,
        "refunded_amount": 0,
        "captures": [
          {
            "id": "string",
            "amount": 0,
            "created_at": "2019-08-24T14:15:22Z",
            "created_by": "string",
            "payment": {}
          }
        ],
        "refunds": [
          {
            "id": "string",
            "amount": 0,
            "refund_reason_id": "string",
            "note": "string",
            "created_at": "2019-08-24T14:15:22Z",
            "created_by": "string",
            "payment": {},
            "refund_reason": {
              "id": "string",
              "label": "string",
              "description": "string",
              "metadata": {},
              "created_at": "2019-08-24T14:15:22Z",
              "updated_at": "2019-08-24T14:15:22Z",
              "code": "string"
            }
          }
        ],
        "payment_collection": {},
        "payment_session": {}
      }
    ]
  }
}

{
  "message": "Discount must be set to dynamic",
  "type": "not_allowed"
}

"Unauthorized"
{
  "message": "Entity with id 1 was not found",
  "type": "not_found"
}
{
  "code": "unknown_error",
  "message": "The request conflicted with another request. You may retry the request with the provided Idempotency-Key.",
  "type": "QueryRunnerAlreadyReleasedError"
}
{
  "code": "invalid_request_error",
  "message": "Discount with code TEST already exists.",
  "type": "duplicate_error"
}

{
  "code": "api_error",
  "message": "An error occured while hashing password",
  "type": "database_error"
}