# Create a card

To create an order in Toggle, make a mutation request to `createOrder`. The typical use cases for this type of integration are;

* Digital sales - Toggle fulfils
* Digital sales - Partner fulfils
* Physical Sales - Toggles warehouse fulfils

{% tabs %}
{% tab title="Digital - Toggle fulfils" %}
If you would like Toggle to fulfil the email to the guest, then you will need to ensure that;

* `fulfilment_method_id` = 1&#x20;
* `fulfilment_email` = guest to receive gift card

```graphql
mutation CreateOrder {
    createOrder(
        account_id: 1
        currency: "GBP"
        merchant_id: 24
        group_fulfilment: true
        auto_fulfil_group_fulfilment: false
        group_fulfilment_postage_category_id: 576
        group_fulfilment_address: {
            name: "John Smith"
            address_line_1: "123 made up street"
            address_line_2: "Tixall"
            town_city: "Sheffield"
            postcode: "S01 1AA"
        }
        merchant_transaction_reference: "abc-def-123-123-423-aaasdf105"
        unit_epos_reference: "2251799825000010"
        total: 6000
        sales_channel_id: 3
        order_items: [
            {
                product_id: 3983
                custom_price_modifier_value: 5000
                fulfilment_method_id: 2
                generate_card_reference: false
                message: "This is my personal message!"
            }
        ]
        receipt_contact: {
            email: "john.smith+purchaser@usetoggle.co.uk"
            first_name: "john"
            last_name: "smith"
        }
    ) {
    id,
    LineItems{
        id
        Card{
            id
            card_reference
            pin
            balance
            expiry_time
            card_alias_card_reference
            product_name
        }
    }
  }
}

```

{% endtab %}

{% tab title="Digital - Partner fulfils" %}
If you would like to fulfil the email to the guest, then you will need to ensure that;

* `fulfilment_method_id` = 8

The card reference can be specified to return in the response, which can then be passed onto the guest.

```graphql
mutation CreateOrder {
    createOrder(
        account_id: 1
        currency: "GBP"
        merchant_id: 24
        group_fulfilment: false
        auto_fulfil_group_fulfilment: true
        merchant_transaction_reference: "912321-2139433213-12323421_26062021"
        total: 0
        sales_channel_id: 3
        note: "Guest had a terrible experience, £10 offered"
        order_items: [
            {
                product_id: 3532
                custom_price_modifier_value: 5000
                fulfilment_method_id: 8
                generate_card_reference: true
                message: "This is my personal message!"
                discounts: [{
                    discount_type_id: 1
                    value: 5000
                }]
            }
        ]
    ) {
    id,
    LineItems{
        id
        Card{
            id
            card_reference
            pin
            balance
            expiry_time
            card_alias_card_reference
            product_name
        }
    }
  }
}

```

{% endtab %}

{% tab title="Physical" %}
If you would like Toggle to fulfil the email to the guest, then you will need to ensure that;

* `fulfilment_method_id` = 2
* `auto_group_fulfilment` = false (Physical orders are fulfiled by our warehouse, so this is set to true by them once the card is sent)
* `group_fulfilment_postage_cagegory_id` = This can be obtained from the get Products call, as different products can have different postage options
* `group_fulfilment_address` = The address which the gift card should be delivered to
* `total` = This needs to be the total value of the order (`custom_price_modifier_value` + `discount` if applicable + postage amount)
* `receipt_contact` = optional, if you want Toggle to send a confirmation to the guest on purchase

```graphql
mutation CreateOrder {
    createOrder(
        account_id: 1
        currency: "GBP"
        merchant_id: 24
        group_fulfilment: true
        auto_fulfil_group_fulfilment: false
        group_fulfilment_postage_category_id: 576
        group_fulfilment_address: {
            name: "Anthony Moore"
            address_line_1: "123 made up street"
            address_line_2: "Tixall"
            town_city: "Stone"
            postcode: "ST01 1AA"
        }
        merchant_transaction_reference: "abc-def-123-123-423-aaasdf105"
        total: 6000
        sales_channel_id: 3
        order_items: [
            {
                product_id: 3983
                custom_price_modifier_value: 5000
                fulfilment_method_id: 2
                generate_card_reference: false
                message: "This is my personal message!"
            }
        ]
        receipt_contact: {
            email: "anthony.moore+purchaser@airship.co.uk"
            first_name: "Anthony"
            last_name: "Moore"
        }
    ) {
    id,
    LineItems{
        id
        Card{
            id
            card_reference
            pin
            balance
            expiry_time
            card_alias_card_reference
            product_name
        }
    }
  }
}

```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.usetoggle.com/partner-guides/custom-web-shops/create-a-card.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
