# Create NFT Order

Allows your customer to create a Fiat to NFT order with Banxa. Upon success, the response will contain a checkout URL which will be unique for the order. The customer will  be redirected to this URL to complete the checkout process, which will expire after 1 minute if a redirect does not occur.

Endpoint: POST /api/orders/nft/buy
Version: 1.3
Security: sec0

## Header parameters:

  - `Accept` (string)

  - `X-Request-Id` (string)
    This is the correlation ID related to the request.

## Request fields (application/json):

  - `account_reference` (string, required)
    Unique customer reference provided by you to identify the order in our system

  - `payment_method_id` (integer)
    Payment method ID associated with the order.

  - `source` (string, required)
    Source currency code. i.e. USD, CAD etc.

  - `source_amount` (string)
    Source amount

  - `target` (string, required)
    Target cryptocurrency code. The cryptocurrency the NFT is listed in.

  - `target_amount` (string)
    Target amount. This will be overridden if a source_amount is also passed.

  - `wallet_address` (string, required)
    Wallet address to receive NFT.

  - `blockchain` (string, required)
    Blockchain network code. If not provided, the default blockchain configured for the cryptocurrency will be used. Refer to the [Get Crypto Currencies](ref:get-crypto-currencies) endpoint to retrieve a list of supported blockchain network codes.

  - `return_url_on_success` (string, required)
    Return URL when the customer has completed the checkout process.

  - `return_url_on_cancelled` (string)
    Return URL when the customer cancels the checkout process.

  - `return_url_on_failure` (string)
    Return URL when the customer fails to complete the checkout process.

  - `iframe_domain` (string)
    Used if you are embedding an iFrame. This must be the exact domain where the iFrame will be hosted. e.g. [yourCompany].com. Do not include https:// in front of the domain.

  - `meta_data` (object)

  - `meta_data.purchase_reference` (string, required)
    Please return us the purchase_reference and NFT meta data which includes the contract address and token ID. The other fields are optional.

  - `meta_data.nft` (object)

  - `meta_data.nft.name` (string, required)
    NFT name

  - `meta_data.nft.collection` (string, required)
    NFT Collection name

  - `meta_data.nft.media` (object)

  - `meta_data.nft.media.type` (string, required)
    "image" or "video"

  - `meta_data.nft.media.link` (string, required)
    NFT link

## Response 200 fields (application/json):

  - `data` (object)

  - `data.order` (object)

  - `data.order.id` (string)
    Example: "0164d962448fbd34f644ffd65624d8ef"

  - `data.order.account_id` (string)
    Example: "098f6bcd4621d373cade4e832627b4f6"

  - `data.order.account_reference` (string)
    Example: "098f6bcd4621d373cade4e832627b4f6"

  - `data.order.order_type` (string)
    Example: "NFT-BUY"

  - `data.order.fiat_code` (string)
    Example: "USD"

  - `data.order.coin_code` (string)
    Example: "ETH"

  - `data.order.wallet_address` (string)
    Example: "xxxxxx360"

  - `data.order.blockchain` (object)

  - `data.order.blockchain.code` (string)
    Example: "ERC20"

  - `data.order.blockchain.description` (string)
    Example: "Ethereum"

  - `data.order.created_at` (string)
    Example: "16-May-2022 10:30:43"

  - `data.order.checkout_url` (string)
    Example: "https://[merchant].banxa.com/portal?expires=xxx&oid=xxx&signature=xxx"

## Response 422 fields (application/json):

  - `body` (Invalid Wallet Address (object) or Invalid payment method ID (object)) — one of:
    - Invalid Wallet Address:
      - `errors` (object)
      - `errors.status` (integer)
        Example: 422
      - `errors.code` (integer)
        Example: 422
      - `errors.title` (string)
        Example: "An invalid wallet address was entered."
    - Invalid payment method ID:
      - `errors` (object)
      - `errors.status` (integer)
        Example: 422
      - `errors.code` (integer)
        Example: 422
      - `errors.title` (string)
        Example: "Invalid payment method ID."


