0

I can't work out the syntax for adding a Gift Card product to the cart using the POST /rest/V1/carts/mine/items REST API endpoint. What product options need setting?

I gather that it needs giftcard amount, giftcard message, sender and recipient name and email address but how do I actually format that into a request body?

0

Nevermind solved it. The value in the giftcard_amount field must be saved as an allowed amount against the giftcard. Some extra bits will need doing if it's a "custom amount" giftcard.

{
  "cartItem": {
    "product_option": {
      "extension_attributes": {
        "giftcard_item_option": 
          {
            "giftcard_amount": 50.0000,
            "giftcard_sender_name": "test",
            "giftcard_recipient_name": "test",
            "giftcard_sender_email": "test@test.com",
            "giftcard_recipient_email": "test@test.com",
            "giftcard_message": "magento is stupid"
          }
        
      }
    },
    "qty": 1,
    "quote_id": {{YOUR_QUOTE_ID_HERE}},
    "sku": {{YOUR_SKU_HERE}}
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.