Baskets with a minimum set of fields

Submit minimum product information within your payment.

Overview

A basket with a minimal set of fields is used for simple payment requests with minimum resources required for a transaction and if you don’t want to show discounts or shipment costs in your basket. To learn more about basket API, go to the API reference guide.

Supported Payment methods

This basket supports all payment methods other than Secured. For these payment methods, you require additional details for the basket that are later required for charge or authorization.

Create a basket

To create a basket, send a POST request to the basket API. Note that you cannot change or replace a basket once it is associated with a charge or authorization.

POST https://api.unzer.com/v2/baskets
{
    "currencyCode": "EUR",
    "orderId": "{{randomOrderId}}",
    "basketItems": [
        {
            "title": "Macbook pro",
            "basketItemReferenceId": "item-1",
            "quantity": 1,
            "amountPerUnitGross": 2000.00,
            "vat": 19
        },
        {
            "title": "AC adapter",
            "basketItemReferenceId": "item-2",
            "quantity": 1,
            "amountPerUnitGross": 30.00,
            "vat": 19
        }
    ]
}
Parameter Type Validation Description
currencyCode (required) string N Currency code in ISO_4217 format
orderId (optional) string N Specify the unique orderID. It is used for authorizing and/or charging the transaction for this specific basket.
If not provided, the API sets the final orderID.
basketItems
title(required) string N Title of the basket item
basketItemReferenceId(optional) string N Unique basket item reference ID (within the basket); If not provided, the ID is automatically generated by Unzer.
quantity(required) number N Quantity of the basket item
amountPerUnitGross (required) number N Amount per unit including VAT
vat(required) number N VAT value for the basket item in percent

A basket is created with a unique ID.

{
    "id": "s-bsk-ac1c7c46bf12"
}

Review basket details

To review the details of a basket, send a GET request with the basket ID in the request.

GET https://api.unzer.com/v2/baskets/{basket ID}

{
    "id": "s-bsk-ac1c7c46bf12",
    "currencyCode": "EUR",
    "orderId": "order-1612875029-188",
    "basketItems": [
        {
            "basketItemReferenceId": "item-1",
            "quantity": "1",
            "vat": "20.0000000",
            "amountPerUnitGross": "2000.0000",
            "title": "Macbook pro"
        },
        {
            "basketItemReferenceId": "item-2",
            "quantity": "1",
            "vat": "20.0000000",
            "amountPerUnitGross": "30.0000",
            "title": "AC adapter"
        }
    ]
}

Update a minimum basket

To update a basket, send a PUT request to the basket API. You cannot update the basket ID once it is created. You can only update the basket item details.

PUT https://api.unzer.com/v2/basket/{{basketId}}

{
  "currencyCode": "EUR",
  "orderId": "{{randomOrderId}}",
  "basketItems": [
        {
            "basketItemReferenceId": "item-1",
            "quantity": "1",
            "vat": "20.0000000",
            "amountPerUnitGross": "1500.0000",
            "title": "Macbook pro"
        },
        {
            "basketItemReferenceId": "item-2",
            "quantity": "1",
            "vat": "20.0000000",
            "amountPerUnitGross": "30.0000",
            "title": "AC adapter 12V"
        }
  ]
}
{
    "id": "s-bsk-ac1c7c46bf12"
}

You can review the updated details for the basket by sending a GET request to the basket resource.

GET https://api.unzer.com/v2/marketplace/baskets/{{basket_id}}

{
  "id": "s-bsk-ac1c7c46bf12",
  "currencyCode": "EUR",
  "orderId": "{{randomOrderId}}",
  "basketItems": [
        {
            "basketItemReferenceId": "item-1",
            "quantity": "1",
            "vat": "20.0000000",
            "amountPerUnitGross": "1500.0000",
            "title": "Macbook pro"
        },
        {
            "basketItemReferenceId": "item-2",
            "quantity": "1",
            "vat": "20.0000000",
            "amountPerUnitGross": "30.0000",
            "title": "AC adapter 12V"
        }
  ]
}

Calculating voucher amount for a minimum basket

A basket item is considered as a voucher if item.type == voucher && item.amountPerUnitGross == 0 && item.amountDiscountPerUnitGross > 0. This amount is deducted from the total basket amount.

        {
            "type": "voucher",
            "basketItemReferenceId": "item-1",
            "quantity": 1,
            "amountPerUnitGross": 0,
            "amountDiscountPerUnitGross": "10",
            "vat": "1",
            "title": "10 EUR voucher newsletter registration"
        }

See also