# Get Started

Welcome to Winter! :snowflake:

You're on your way to integrating an NFT checkout for **FREE**!

:clock1: Total time: 10 minutes

## 📝 Step 0: Make sure your smart contracts conform to our standards

Check out the smart contract APIs we support!

* [Ethereum, Polygon, and EVM based blockchains](/primary-mint-smart-contracts/eth-polygon-and-evm)
* [Solana](/primary-mint-smart-contracts/solana)

## 📝 Step 1: Login to our dashboard & create a project

Go here <https://business.usewinter.com/>

1. Login
2. Fill out the form to begin the process of verification
3. Create a project
4. Integrate into your website & test
5. Push project to production and finalize verification

## 📝 Step 2: Integrate on your front end

Choose between the following based on the frontend code for your website:

* [React](/front-end-integration/react) (THIS IS PROBABLY WHAT YOU NEED)
* [Plain HTML](/front-end-integration/plain-html)

## 📝 Step 3: Push to production!

{% hint style="warning" %}
Note! Pushing to production can take 1-3 business days to approve. Plan accordingly!
{% endhint %}

Push your project to production!&#x20;

Here's a quick video tutorial on how to do that

{% embed url="<https://www.loom.com/share/9ea1f91a995c436ab6269f1bbbe937e7>" %}


# Project Testing

Once you set up your Winter Testnet project in the business dashboard, you can test your checkout to make sure it's working as intended.

### Step 1: Go to your Winter Testnet project’s Sandbox checkout link

[https://sandbox-winter-checkout.onrender.com/?projectId={PROJECT\_ID}](https://sandbox-winter-checkout.onrender.com/?projectId=%7BPROJECT_ID%7D)

**NOTE:** If you are passing in any extraMintParams into your mint function, you will also need to pass through those extraMintParams here. [Go here for more information](https://docs.usewinter.com/front-end-integration/react).

### Step 2: Confirm the checkout is working

If your checkout is not rendering correctly, here are a few common fixes:

1. Make sure your Testnet project is active in the [business dashboard](https://business.usewinter.com/)
2. Make sure your Winter project is configured with your Testnet smart contract
3. If you have a custom Pricing function, make sure it's configured correctly
4. If you are passing in [extraMintParams](https://docs.usewinter.com/front-end-integration/react) to your mint function, make sure they are being passed in correctly

If you still need help, feel free to reach out to our team at <support@usewinter.com>!

### Step 3: Enter test credit card number

You can use testing card details to complete your checkout. For example, enter in "**4242424242424242**" for credit card number plus any CVC and expiration date. Click "Submit order"! You can find a full list of accepted testing card details [here](https://stripe.com/docs/testing).

{% embed url="<https://www.youtube.com/watch?v=Q3DifuHFQ_I>" %}
Demo checkout using testing credit card details
{% endembed %}

That's it! Congratulations on completing your Winter checkout test. Good luck on your launch!


# Push to Production

{% hint style="warning" %}
Note! Pushing to production can take 1-3 business days to approve. Plan accordingly!
{% endhint %}

Push your project to production!

Need help? Email <dev@usewinter.com>

{% embed url="<https://www.loom.com/share/9ea1f91a995c436ab6269f1bbbe937e7>" %}

Make sure you turn on your project so that it's active! In the dashboard under your project details, you can click "Edit" to turn on your project (see screenshot below)

<figure><img src="https://2773691719-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuwSa3bbSf8TSLBQxlRQ%2Fuploads%2FZ7bCqHCBkWewO8b3h4fA%2FScreen%20Shot%202022-09-28%20at%202.44.34%20PM.png?alt=media&amp;token=d0be72c2-79bc-4420-a982-9258d53b9928" alt=""><figcaption></figcaption></figure>


# Marketplaces

Are you an NFT marketplace? This is for you!

### 🛠 Our docs have moved! Take a look at [Marketplace integrations](/marketplace-integrations/intro)


# How do I get paid?

**We pay out instantly & directly into the smart contract!**

For example, if an NFT costs 1 ETH (\~$2000), we charge the buyer $2000 to their credit card and instantly mint & pay 1 ETH into the smart contract mint function. Same thing with Solana NFTs.

Currencies & blockchains we pay out:

* Ethereum Mainnet - We only pay out ETH
* Polygon Mainnet - We only pay out MATIC&#x20;
  * We unfortunately do NOT support wETH as payment on Polygon
* Solana Mainnet - We only pay out SOL

Looking for USDC as payment? Contact `dev@usewinter.com`&#x20;

{% hint style="info" %}
**How does fraud/chargeback work?**

For most merchants, we handle fraud & chargebacks. Don't worry, since we pay out instantly into a smart contract, you still get your crypto payments. That's how confident we are in our fraud & chargeback tech 😉
{% endhint %}


# Payment methods & locations

Payment methods we currently support:

* All credit card brands (American Express, Visa, Mastercard, Discover, etc)
* All debit card brands
* ACH (US only)
* Apple Pay (email us at <help@usewinter.com> to activate)
* Google Pay

We support customers from most major locations (North America, Europe, LatAm, Asia, etc). However, there are a few countries we cannot accept payments from, such as sanctioned countries (Russia, North Korea).

In the United States, we support all 50 states and Washington D.C.


# Foreign Currencies

The price is always displayed in USD (since we are a US based business and we operate in USD)

However, we support credit cards & payments in any currency! Users will be subject to bank foreign exchange fees since their bank will convert to USD to send to us (we charge their credit card in USD)&#x20;

Example: if someone from France sees $20 USD. They put in their French CC, their French CC gets charged the equivalent of $20 USD (and whatever other fees their bank adds). We get $20 USD


# Apple Pay

We support Apple Pay! 🍎💳

However, because of Apple Pay specific details, we have to open up a separate tab for Apple Pay to work.

The flow will be

1. User sees NFT on example.com
2. User clicks "Buy with card" button example.com
3. Winter widget opens on example.com
4. User clicks "Apple Pay" payment method
5. Winter will open up a new checkout tab with our own domain (usewinter.com)
6. User will complete the checkout

This is because Apple Pay only works on Apple & Winter verified domains ([Apple docs](https://developer.apple.com/documentation/applepaywebmerchantregistrationapi/preparing_merchant_domains_for_verification)).&#x20;


# Whitelists/Allowlists

Winter supports whitelists & allowlists!

We support:

* "Naked" address whitelists
* Merkle proof whitelists

{% hint style="info" %}
Make sure you whitelist the addresses we mint from! Our mainnet address is `0x1e05A8Ba7EE05eCbA22A102d0288E043478006e6` and our testnet address is `0xe0CB05cBf3dBeb647394905848d9361Daa99dE28`
{% endhint %}

For Merkle Proof whitelists, upload your FULL list of addresses in the [Business Dashboard](https://business.usewinter.com/). Then, make sure the merkle root hash is the same. Then, we will construct merkle proofs and automatically send them in the mint function!

🚨If the merkle root hash is NOT the same, mints are guaranteed to fail!

We can handle lists up to 10,000 addresses. Email us at `dev@usewinter.com` if you anticipate more. We can handle larger lists but they may require use of our API!


# Intro

Welcome! Are you a degen NFT marketplace? Are you a gaming platform? Are you just curious? Well, this is the place for you to learn how to setup Winter's checkout with your marketplace!

{% hint style="info" %}
Ready to get started? Email us at `marketplaces@usewinter.com` and we can help guide you!
{% endhint %}

So you have your own NFT marketplace?&#x20;

You're looking to add credit card/cross-chain payments? Or custodial wallets?

Then look no further! 🎉

As of now, we support NFT marketplaces on a few main blockchains:

* Ethereum (ETH)
* Polygon (MATIC)
* Solana (SOL)
* Cardano (ADA)
* Avalanche (AVAX)
* Tezos (XTZ)
* Binance (BNB & BUSD) (🚧 In beta)

You're probably wondering "How do I integrate?" Well, at a high level:

### 👆Step 0 - [Choose your implementation strategy](/marketplace-integrations/implementation-strategy) (aka how you want to integrate)

### 📧 Step 1 - Email us at `marketplaces@usewinter.com` to apply and get your API key to go live!

### 🛠 Step 2 -  [Integrate our React widget in your front end!](/front-end-integration/react-marketplace)&#x20;

### 🚀 Step 3 - Go live!


# Implementation strategy

At a high level, there are four different and distinct ways marketplaces can integrate with Winter!&#x20;

1. [Directly with smart contracts](/marketplace-integrations/implementation-strategy/directly-with-smart-contracts) (hardest!)
2. [Aggregation APIs](/marketplace-integrations/implementation-strategy/aggregation-apis) (e.g. Reservoir) (easiest!)
3. [Winter can call your APIs to build a transaction](/marketplace-integrations/implementation-strategy/apis-to-build-a-transaction)
4. [Winter can call your APIs to both build and submit a transaction](/marketplace-integrations/implementation-strategy/build-and-submit-a-transaction)

🚧 Coming soon - a self serve dashboard for you to integrate on your own!

For all implementation strategies, we require some type of API like `getNFTDetails` that returns:

1. NFT metadata (name, image, tokenId, etc)
2. NFT order data
3. Listing status (e.g. available, sold, etc)
4. NFT type (e.g. 721 vs 1155)
5. Seller details (e.g. wallet address)


# Directly with smart contracts

Integrate with NFT marketplace smart contracts directly

As of now, we only support integrating directly with smart contracts on these chains:

* ETH
* MATIC
* AVAX
* BNB

🚨 Note! This is likely the most difficult and most involved type of integration. We highly recommend using another option. This is because we have to figure out how to build the transaction to send directly to your smart contract

Please email `marketplaces@usewinter.com` for more specific guidance

Generally, we'll require a few things to do this type of integration:

* Smart contract buy/sell functions (e.g. `atomicMatch` on Seaport)
* A way to build the parameters to pass into the buy/sell function


# Aggregation APIs

This is the EASIEST type of integration!

Aggregation APIs we currently support:

* Reservoir (ETH)
* Reservoir (Polygon) 🚧 Coming soon!
* Hyperspace (Solana) 🚧 Coming soon!

All you need to do is email us `marketplaces@usewinter.com` for you API key and you can get started integrating our [React package](/front-end-integration/react-marketplace) (takes less than 1 hour)!


# APIs to build a transaction

This type of integration is where we call your API (e.g. \`marketplace.com/buildTx\`) and your API returns a transaction for us to sign!

This is the most common type of integration!&#x20;

🚧 Coming soon - a self serve dashboard for you to integrate on your own!

These are the chains we currently support for this type of integration:

* ETH
* MATIC
* SOL
* ADA
* XTZ
* AVAX
* BNB

At a high level, your API should take in a few things (passed in this format):

* `tokenId`
* `contractAddress`
* `quantity (optional)`

We then expect a complete **unsigned** transaction back, which we will then sign and submit using our own RPC!

To get started, email us at `marketplaces@usewinter.com!`

### What does the API need to take and what does it need to return?

At a high level, your API should accept:

* `tokenId`
* `contractAddress`
* buyerWalletAddress

It should then take this and return back a built transaction for us to sign.

Generally, you'll also need this type of transaction to send to a wallet, like Metamask!&#x20;


# Build and submit a transaction

This type of integration is where we call your API (e.g. \`marketplace.com/buildTx\`), we sign the transaction, and then we pass it to your API (e.g. \`marketplace.com/submitTx\`) and you submit it to your RPC!

These types of integrations are for **high volume** marketplaces where having consistency is important! With this type of integration, you can control the flow and show all pending transactions (e.g. only allow 1 buy order on each NFT to prevent gas wars)

🚧 Coming soon - a self serve dashboard for you to integrate on your own!

These are the chains we currently support for this type of integration:

* ETH
* MATIC
* SOL
* ADA
* XTZ
* AVAX
* BNB

At a high level, your API should take in a few things (passed in this format):

* `tokenId`
* `contractAddress`
* `quantity (optional)`

We then expect a complete **unsigned** transaction back, which we will then sign!

We then expect a second api to take in a **signed** transaction and return back:

* `isSubmitSuccessful`
* `txHash`

To get started, email us at `marketplaces@usewinter.com!`


# 🚨Requirements

ETH, Polygon, and EVM requirements - [check here](/primary-mint-smart-contracts/eth-polygon-and-evm)

Solana - must use Candy Machine!


# ETH, Polygon, and EVM

{% hint style="info" %}
Have a multi-contract NFT sale? [Check out these docs](/primary-mint-smart-contracts/eth-polygon-and-evm/multi-contract)
{% endhint %}

This is for all EVM based blockchains (Ethereum, Polygon, Avalanche, etc)

We support ERC-721, ERC-721A, ERC-721R and ERC-1155 smart contracts!

Note we **require** all smart contracts to have a mint function with an address parameter! This is so that if a user wants to mint to their own wallet, we can do this in one transaction (save on gas fees and a faster mint)!

We also **require** that there is no limit of how many mints we can mint. You can do this by making sure the address that is passed in is checked for limits and not the msg.sender

For example:&#x20;

```
function mint(uint256 _amount, address _recipient) external payable {
    require(totalNFTs(_recipient) <= MAX_WALLET_LIMIT,"Wallet has too many NFTs");
    ...
}
```


# Multi-contract

Winter supports multi-contract mints! Contact us at `dev@usewinter.com` to set it up

If you have a "seller" contract that then calls an ERC-721/ERC-1155, we support that use case. (As of now, we only support 2 smart contracts. If you have more than that, email `dev@usewinter.com` and let's chat!)

As a reminder, we **require** all smart contracts to have a mint function with an address parameter! This is so that if a user wants to mint to their own wallet, we can do this in one transaction (save on gas fees and a faster mint)!

For example, a "seller" contract would look like:&#x20;

```
function purchase(uint256 _amount, address _recipient) external payable {
    ...
}
```

Note that we will expect you to implement standard ERC-721 and ERC-1155 functions (e.g. tokenURI)


# Drop types we support

There's two "styles" of NFT drops:

* Candy Machine style - put in crypto, get a random NFT
* Vending Machine style - choose a specific NFT, put in specific amount of crypto, and get that specific NFT


# Solana

We only support standard [Candy Machine](https://docs.metaplex.com/candy-machine-v2/getting-started) mints on Solana at this time


# Crypto pricing

Please make all testnet pricing 0.001 or under

### Classic Winter: Hardcoded pricing

A typical Winter flow takes a hardcoded mint price:

* You tell Winter the cost per mint during project setup
* Your smart contract asserts that hardcoded cost in the mint function
* In this case, we do **not** require your contract to have a price function.&#x20;

Needs to be 0.001 or under on testnet

### Optional: Dynamic pricing

Winter also supports dynamic mint prices set on your contract! If you want to change the price of a mint during the live, Winter will need the following:

* Your smart contract contains a method that Winter can call to get the current price of an NFT, e.g. mintPrice()&#x20;

During setup, you'll tell Winter the name of your price function, e.g. `mintPrice`. That's it! During checkout, Winter will call that function to get the cost per mint.&#x20;

Once your project is live,  you can update the mint price on your smart contract and rest assured that the new price is reflected on Winter.&#x20;

Please make the price 0.001 or under on testnet


# Customization

Each checkout can be customized!

Things you can customize:

* "Brand" image to display to user on checkout
* Price
* Require a crypto address/wallet
* A quantity selector (e.g. Mint up to 5 NFTs in one order)
* Turn on/off whitelist


# Pre-fill (email, wallet, etc)

Need to pass in parameters to prefill email or wallet address? We support that!

Use the optional `walletAddress` to pre-fill the wallet address

Use the optional `email` to pre-fill the email

Example:&#x20;

```
  <WinterCheckout
    // Your projectId, will be the same in sandbox/production
    projectId={20}
    // When false we use tesntet & when true we use mainnet
    production={false}
    // This is a boolean that opens the widget when true
    showModal={showWinter}
    // Can pass in the customer's wallet address if you have it
    walletAddress='0x64EE4e11E0992D18C5986bA99F2d7DF8fc7A3dC3'
    // Can pass in the customer's email if you have it
    email="laila@usewinter.com"
    // Can pass in the mint quantity if the quantity is chosen before our modal is opened
    mintQuantity={5}
  />
```

If you've embedded the iframe directly, this example applies:&#x20;

<https://checkout.usewinter.com/?projectId=1&walletAddress=0xabcdefg&email=sean@awesome.com>


# React

### Example

See [here](https://github.com/lkc93/lailaland-drop/blob/main/src/App.js#L21-L38) for an example React integration.&#x20;

### Steps

Install [Winter's checkout package](https://www.npmjs.com/package/@usewinter/checkout)

```
npm i @usewinter/checkout

OR 

yarn add @usewinter/checkout
```

Use the component in your React app

```
import { WinterCheckout } from '@usewinter/checkout';

<WinterCheckout 
    projectId={YOUR_PROJECT_ID} 
    production={false} 
    showModal={showWinter} 
    // pass in a function to be called when a successful purchase happens
    onSuccess={() => setParty(true)}
    // pass in a function to be called when the modal is closed
    onClose={() => setShowWinter(false)}
    // Extra mint params are params besides 'address, amount, proof'
    // The key needs to exactly match the name of the param provided to Winter
    // The value will be passed in as the param
    extraMintParams={{tier: 'diamond', type: 'super-rare'}}
    // Price function params
    // The key needs to exactly match the name of the param provided to Winter
    // The value will be passed in as the param
    priceFunctionParams={{tier: 'gold', type: 'rare'}}
    // Language - supports spanish, chinese, chineseT (chinese traditional), japanese, korean, french
    language={'chinese'}
    // If you want to customize the css of the checkout widget
    appearance={{
        leftBackgroundColor: "#131317",
	rightBackgroundColor: "#22222d",
	buttonTextColor: "black",
	buttonColor: "#f59e0c",
	primaryTextColor: "white",
	secondaryTextColor: "#85868a",
	fontFamily: "Montserrat,sans-serif",
	buttonAndInputBoxShadow: "0 3px 6px 1px rgba(217, 119, 6, 0.2)",
	buttonAndInputFocusBoxShadow: "0 3px 6px 1px rgba(217, 119, 6, 0.8)",
        quantityButtonPlusMinusSvgFilter: "invert(100%) sepia(100%) saturate(1%) hue-rotate(135deg) brightness(105%) contrast(101%)",
        inputBackgroundColor: "#131317",
        mintingClipLoaderColor: "white",
        borderColor: "rgba(245,158,11)"
    }}
/>
```

ProjectId - Get this from the Winter team!&#x20;

Production - false while testing, true when you go live&#x20;

showModal - this variable toggles true or false depending on the state of your "Pay with Card" button

Make sure to handle the close modal and post purchase properly. You can find the details here [<mark style="color:purple;">post purchase</mark>](/front-end-integration/post-purchase).&#x20;


# React (Marketplace)

Insert this typescript component

Install our React component for marketplaces with this command

`npm i @usewinter/checkout`

🚨Note: Depending on your marketplace's smart contracts, this integration may differ. Please contact us at `marketplaces@usewinter.com` and we can help you!

Then pass in the contract address and token ID! Copy the code snippet below!

```
<WinterCheckout
  showModal={showWinterModal}
  // optional
  walletAddress={account.isConnected ? account.address : undefined}
  // optional
  email={customersEmail}
  contractAddress={clickedContractAddress}
  tokenId={clickedTokenId}
  // This will be the domain of the marketplace you want to pull the orders from
  orderSource={'opensea.io','x2y2.io', or 'looksrare.org' or any other evm marketplace}
  // This will be the domain of the marketplace you want the order to be fulfilled on
  fillSource={'opensea.io','x2y2.io', or 'looksrare.org' or any other evm marketplace}
  production={process.env.WINTER_ENV == 'production' ? true : false }
  
  // Language - supports spanish, chinese, chineseT (chinese traditional), japanese, korean, french
  language={'chinese'}
  onClose={() => {
    setShowWinterModal(false)
  }}
  // If you want to customize the css of the checkout widget
  appearance={{
        leftBackgroundColor: "#131317",
	rightBackgroundColor: "#22222d",
	buttonTextColor: "black",
	buttonColor: "#f59e0c",
	primaryTextColor: "white",
	secondaryTextColor: "#85868a",
	fontFamily: "Montserrat,sans-serif",
	buttonAndInputBoxShadow: "0 3px 6px 1px rgba(217, 119, 6, 0.2)",
	buttonAndInputFocusBoxShadow: "0 3px 6px 1px rgba(217, 119, 6, 0.8)",
        quantityButtonPlusMinusSvgFilter: "invert(100%) sepia(100%) saturate(1%) hue-rotate(135deg) brightness(105%) contrast(101%)",
        inputBackgroundColor: "#131317",
        mintingClipLoaderColor: "white",
        borderColor: "rgba(245,158,11)"
    }}
/>
```


# Plain HTML

You can use this option if you are using a website builder like Wix which can only take direct html.

Note: You will need to style the button with your own CSS! !

Note: You will need to update the checkout URL "<https://sandbox-winter-checkout.onrender.com/?projectId=102>" with your own that we give you!

```
<script>
	window.addEventListener('message', (event) => {
          console.log(`Received message: ${event.data}`);
	  if (event.data === "closeWinterCheckoutModal") {
             // properly close the winter modal so it can be opened again
   	     document.getElementById("winter-checkout").style.visibility = "hidden";
	     document.getElementById("winter-checkout").style.display = "none";
          } else if (event.data.name === 'successfulWinterCheckout') {
            // Successfully checked out. This event contains information 
            // you can use to continue the flow: 
            console.log(event.data.transactionhash) // do what you need with the txhash here! 
            console.log(event.data.email) // email that the user bought an NFT with
          }
        });
	function openWinterCheckout () {
		var iframe = document.getElementById("winter-checkout");
		document.body.appendChild(iframe);
		iframe.style.visibility = "visible";
		document.getElementById("winter-checkout").style.display = "inline";
	}
	document.getElementById("winter-checkout").addEventListener('close', event => {
		var iframe = document.getElementById("winter-checkout");
		iframe.style.visibility = "hidden";
	});
</script>
<button id="winterCheckout" onclick="openWinterCheckout()">Mint with Card</button>
<iframe id="winter-checkout" src="https://sandbox-winter-checkout.onrender.com/?projectId=102" style="position: fixed;
top: 0px;
bottom: 0px;
right: 0px;
width: 100%;
border: none;
margin: 0;
padding: 0;
overflow: hidden;
z-index: 999999;
height: 100%;
visibility:hidden;
display: none;" allowtransparency="true" ></iframe>
```

If you have **extra mint params** (mint params besides 'address', 'amount', and 'proof') you will need to add the params to the url like so:

```
// Make sure the key exactly matches the param name provided to us
url += `&extraMintParams=${encodeURIComponent(JSON.stringify({a: 1, b: 2}))}`
```

If you have **price function params** (mint params besides 'address', 'amount', and 'proof') you will need to add the params to the url like so:

```
// Make sure the key exactly matches the param name provided to us
url += `&priceFunctionParams=${encodeURIComponent(JSON.stringify({tier: 'gold
, type: 'rare'}))}`
```

If you want to customize the css of the checkout widget you will need to add the "appearance" to the url like so:

```
url += `&priceFunctionParams=${encodeURIComponent(JSON.stringify({
        leftBackgroundColor: "#131317",
	rightBackgroundColor: "#22222d",
	buttonTextColor: "black",
	buttonColor: "#f59e0c",
	primaryTextColor: "white",
	secondaryTextColor: "#85868a",
	fontFamily: "Montserrat,sans-serif",
	buttonAndInputBoxShadow: "0 3px 6px 1px rgba(217, 119, 6, 0.2)",
	buttonAndInputFocusBoxShadow: "0 3px 6px 1px rgba(217, 119, 6, 0.8)",
        quantityButtonPlusMinusSvgFilter: "invert(100%) sepia(100%) saturate(1%) hue-rotate(135deg) brightness(105%) contrast(101%)",
        inputBackgroundColor: "#131317",
        mintingClipLoaderColor: "white",
        borderColor: "rgba(245,158,11)"
    }))}`
```


# Post-purchase

Know when your customer finishes checking out with Winter.

The Winter widget emits events that tell you when your customer finishes purchasing an NFT. You can listen for these events and use the information as needed in your application - for instance, to redirect the user to a post-purchase page.&#x20;

Message events we emit:

* "successfulWinterCheckout" - emitted when a successful purchase has been completed and the user is on the order confirmation screen
  * With a successful checkout, we also emit details of the purchase, such as transaction hash and email (see example below)
* "closeWinterCheckoutModal" - emitted when a user closes the Winter checkout

## successfulWinterCheckout

This event emits information from the checkout including:&#x20;

* transactionHash - the transaction hash on the blockchain. You can use this to query etherscan, polygonscan or solscan for the mint transaction.&#x20;
* transferHash - the transfer hash on the blockchain if there is one. You can use this to query etherscan, polygonscan, solscan, and tzkt for the transfer transaction.&#x20;
* email - in case you need it.&#x20;
* nftQuantity - the number of NFTs purchased
* amountUSD - the price of the purchase in cents
* nftTokenIds - the token ids of each nft purchased
* nftUrls - the url for the image of each NFT
* openseaUrls -  the opensea url for each NFT purchased

```
    function handleWindowEvent(event) {
        if (event.data.name === "closeWinterCheckoutModal") {
          // properly close the winter modal so it can be opened again
          setShowWinter(false)
        } else if (event.data.name === 'successfulWinterCheckout') {
          // Successfully checked out. This event contains information 
          // You can see the full message body below
          // you can use to continue the flow: 
          console.log(event.data.transactionHash) // do what you need with the txhash here! 
          console.log(event.data.email) // email that the user bought an NFT with
          console.log(event.data.nftQuantity) // the number of NFTs bought
          console.log(event.data.amountUSD) // the price of the purchase in cents
          console.log(event.data.nftTokenIds) // the token ids of each nft purchased
          console.log(event.data.nftUrls) // the url for the image of each NFT
          console.log(event.data.openseaUrls) // the opensea url for each NFT purchased
        }
    }

    useEffect(() => {
        window.addEventListener("message", handleWindowEvent)
        return () => window.removeEventListener("message", handleWindowEvent)
    }, [])
```

```
// This is what the successful checkout message looks like
{
    "name": "successfulWinterCheckout",
    "email": "evan@usewinter.com",
    "amountUSD": 2100,
    "nftQuantity": 1,
    "nftUrls": [
        "https://winternft.mypinata.cloud/ipfs/QmbQ3bPVoFBAM6pAcVXb2xRU3bmDsUZ3qcTJJv43cA53tL/1.png"
    ],
    "nftTokenIds": [
        1211
    ],
    "openseaUrls": [
        "https://testnets.opensea.io/assets/matic/0x39c05f113835883a9a53a928a5b8763d1f32df71/1211"
    ],
    "transactionHash": "0x7783f21ac0aab93a9a24b3df77b33dba674457bc83a0bdf73f27adb97868f068"
}
```


# CSS customization

You can alter the look of our checkout to match your branding!

```
// Pass in the appearance prop into the WinterCheckout component
<WinterCheckout appearance={{
        // The checkout is split into two halves
        leftBackgroundColor, - The left background will also be applied to inputs & the wallet buttons
        rightBackgroundColor, - The right background will also be applied to the section with all of the numbers
        fontFamily, - The font family for the entirety of the checkout modal
        borderColor, - There's a border around the wallet buttons & input fields
        primaryTextColor, 
        secondaryTextColor,
        buttonColor, - This will be applied to the quantity buttons, the “pay with card”, and the “submit order” button 
        buttonTextColor, - The color of the text in the "pay with card", "submit order", and "here" button
        quantityButtonPlusMinusSvgFilter, - The color for the svg plus, minus nft quantity buttons, & arrows > at the top of the right side of the checkout 
        buttonClipLoaderColor, - This is the color of the spinning loader when you click "submit order" inside of the button
        buttonAndInputBoxShadow,
        buttonAndInputFocusBoxShadow,
        // If you want to add more customization to the payment component you can use the values below
        // By default it will grab the customization from above unless these are altered
        paymentInputBackgroundColor,
        paymentTextColor,
        paymentPlaceholderColor,
        paymentInputBoxShadow,
        paymentInputFocusBoxShadow
    }} 
/>

// Color's accept any css color
// BoxShadow's need to be in this format "0 3px 6px 1px rgba(56, 177, 247, 0.15)"
// SvgFilter should look like this "invert(100%) sepia(100%) saturate(1%) hue-rotate(135deg) brightness(105%) contrast(101%)"
// You can go here https://codepen.io/sosuke/pen/Pjoqqp to see what a specific color's svg filter would look like

Here's an example appearance prop
  
const appearance = {
        leftBackgroundColor: "#131317",
	rightBackgroundColor: "#22222d",
	buttonTextColor: "black",
	buttonColor: "#f59e0c",
	primaryTextColor: "white",
	secondaryTextColor: "#85868a",
	fontFamily: "Montserrat,sans-serif",
	buttonAndInputBoxShadow: "0 3px 6px 1px rgba(217, 119, 6, 0.2)",
	buttonAndInputFocusBoxShadow: "0 3px 6px 1px rgba(217, 119, 6, 0.8)",
        quantityButtonPlusMinusSvgFilter: "invert(100%) sepia(100%) saturate(1%) hue-rotate(135deg) brightness(105%) contrast(101%)",
        inputBackgroundColor: "#131317",
        buttonClipLoaderColor: "white",
        borderColor: "rgba(245,158,11)"
        }
```


# Intro (read this first!)

What you need to know about Winter's platform API.

Welcome to Winter's Platform API!&#x20;

**The problem** was there were a lot of no-code NFT creation platforms and launchpads that were interested in integrating Winter's checkout for their businesses. They had 10+ launches a day and all integrations were manual through our dashboard.

Now, we offer a way to create checkout's at scale via our API - everything can now be done programmatically!

**Things to note:**

A Winter checkout is predicated on a project ID -- the project ID is how Winter knows what UI to display and which NFTs to mint. The platform API gives you, a Winter user, a way to create and update projects.&#x20;

Given a project ID, you can access your checkout as follows:&#x20;

* Livemode: [https://checkout.usewinter.com/?projectId={PROJECT\_ID}](https://checkout.usewinter.com/?projectId=666)
* Testmode: [https://sandbox-winter-checkout.onrender.com/?projectId={PROJECT\_ID}](https://sandbox-winter-checkout.onrender.com/?projectId=98)

## Prerequisites

* Get an API key from the Winter team! <help@usewinter.com>
* Have your smart contract and project info ready -- let's have some fun!&#x20;

You can use [/createProject](/platform-api/createproject) and [/updateProject](broken://pages/rQTPPBR08E2MDu7uZY0K) to make project IDs.&#x20;

##


# testmode -> livemode

You can test Winter based on your testmode contract and push that to production with your mainnet contract.

Winter allows you to create `sandbox` checkouts minting on your testnet smart contract to ensure that the integration is working smoothly.&#x20;

Once that is working, you can create a corresponding `livemode` checkout for that project.&#x20;

Let's say your test contract is deployed to Mumbai under the address `0xTestContract`.&#x20;

You'll create a `sandbox` Winter checkout as follows:&#x20;

```
/createProject({
    sandbox: true, // NOTE! This param tells us this is a sandbox project. 
    contractAddress: 0xTestContract,
    ...
    // corresponding test contract info 
})
```

Let's say you get back project ID 10 for this sandbox checkout. You can then test the sandbox checkout via the following URL:

<https://sandbox-winter-checkout.onrender.com/?projectId={PROJECT_ID}>\
\
Let's say that all works (fingers crossed!) and you go ahead and deploy your contract to Polygon Mainnet under the address `0xMainnetContract`.&#x20;

You'll then create a livemode Winter project by calling

```
/createProject({
    projectId: 10 // Send Winter the project ID you got in sandbox
    sandbox: false, // NOTE! This param tells us this is a mainnet project. 
    contractAddress: 0xMainnetContract,
    ...
    // corresponding mainnet contract info 
})
```

Voila! Now you can use that same project ID in livemode as follows: \
[https://checkout.usewinter.com/?projectId={PROJECT\_ID}](https://checkout.usewinter.com/?projectId=666)

Congrats on getting a live, mainnet Winter checkout up and running via API!&#x20;


# /createProject

Base URL: https\://winter-api.usewinter.com

Create a project from scratch!

Returns a Winter specific projectId that you can then use for the [front end integration](/front-end-integration/react#example)

## Create a project on Winter.&#x20;

<mark style="color:green;">`POST`</mark> `/createProject`

Authenticate with basic auth where the username is your API key, e.g.&#x20;

`curl -X POST https://winter-api.usewinter.com/createProject -u sk_live_abcd=:`

`await axios.post(url,{ BODY }, { auth: { username: 'sk_live_abcd=' }})`

#### Request Body

| Name                                                 | Type    | Description                                                                                                                                                                                                                                                                                                             |
| ---------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| email<mark style="color:red;">\*</mark>              | String  | The email associated with the API key -- this is the email that can log into the [dashboard](<https://business.usewinter.com >) later to edit the project.                                                                                                                                                              |
| contractAddress<mark style="color:red;">\*</mark>    | String  | The address of the contract on which Winter should call mint. For Solana projects, this is the candyMachine ID.                                                                                                                                                                                                         |
| contractABI                                          | String  | The ABI of the contract -- this is nullable for Solana but required for Eth and Polygon projects.                                                                                                                                                                                                                       |
| projectName<mark style="color:red;">\*</mark>        | String  | This will show up on your checkout.                                                                                                                                                                                                                                                                                     |
| brandImageURL<mark style="color:red;">\*</mark>      | String  | Address to an image or gif that will be presented on your checkout before the user mints an NFT.                                                                                                                                                                                                                        |
| mintFunction<mark style="color:red;">\*</mark>       | String  | Name of the mint function Winter should call on the smart contract.                                                                                                                                                                                                                                                     |
| tokenSymbol<mark style="color:red;">\*</mark>        | String  | One of: `ETH`, `MATIC`, `SOL`                                                                                                                                                                                                                                                                                           |
| mintFunctionParams<mark style="color:red;">\*</mark> | String  | <p>One of: </p><p><code>address,amount</code></p><p><code>amount,address</code></p><p><code>address</code></p><p><code>amount</code></p>                                                                                                                                                                                |
| sandbox                                              | Boolean | <p>True if you want to create a project in sandbox to test with fake payments. False if you want to create a live project! </p><p></p><p>Defaults to false. </p>                                                                                                                                                        |
| costPerMint                                          | Number  | Cost per mint in the token (ETH, MATIC, SOL) -- optional if given a contract price function to pull price from.                                                                                                                                                                                                         |
| maxNumberOfMints                                     | Number  | The max NFTs that can be purchased in one sale. If this is > 1, you \*must\* also set allowMultiplePurchases to `true`.                                                                                                                                                                                                 |
| ercType                                              | String  | Either `1155` or `721`                                                                                                                                                                                                                                                                                                  |
| isActive                                             | Boolean | <p>true for project active (can accept payments), false for project disabled (can not accept payments). When it is turned off/false the widget can still appear, but it will say "Can't mint right now".</p><p></p><p>Note: isActive is default false for production projects (sandbox=false)! You must turn it on!</p> |
| requireAddress                                       | Boolean | option to mint to a specific address, false for the checkout to also show the Winter wallet.                                                                                                                                                                                                                            |
| contractPriceFunctionParams                          | String  | <p>These are the param identifiers used to match the priceFunctionParams passed into the component/url. Make sure they are separated by a comma.   </p><p><code>ex: tier, tokenId, bundle</code></p>                                                                                                                    |
| contractPriceFunction                                | String  | This is the function on the smart contract that we can call to get the price of the NFT                                                                                                                                                                                                                                 |

{% tabs %}
{% tab title="200: OK If successful, you'll get a projectId in the response. " %}

```javascript
{
  "success": true,
  "project_id": 6736
}
```

{% endtab %}
{% endtabs %}


# /updateProject

Base URL: https\://winter-api.usewinter.com

Update a project!

Things you can do:

* Change smart contract address
* Turn project on/off
* Change project name/image/details

## Update a project on Winter.&#x20;

<mark style="color:green;">`POST`</mark> `/updateProject`

Authenticate with basic auth where the username is your API key, e.g.&#x20;

`curl -X POST https://winter-api.usewinter.com/updateProject -u sk_live_abcd=:`

`await axios.post(url,{ BODY }, { auth: { username: 'sk_live_abcd=' }})`

#### Request Body

| Name                                        | Type    | Description                                                                                                                                                                                                                                                                     |
| ------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| email<mark style="color:red;">\*</mark>     | String  | The email associated with the API key -- this is the email that can log into the [dashboard](<https://business.usewinter.com >) later to edit the project.                                                                                                                      |
| contractAddress                             | String  | The address of the contract on which Winter should call mint. For Solana projects, this is the candyMachine ID.                                                                                                                                                                 |
| contractABI                                 | String  | The ABI of the contract -- this is nullable for Solana but required for Eth and Polygon projects.                                                                                                                                                                               |
| projectName                                 | String  | This will show up on your checkout.                                                                                                                                                                                                                                             |
| brandImageURL                               | String  | Address to an image or gif that will be presented on your checkout before the user mints an NFT.                                                                                                                                                                                |
| mintFunction                                | String  | Name of the mint function Winter should call on the smart contract.                                                                                                                                                                                                             |
| tokenSymbol                                 | String  | One of: ETH, MATIC, SOL                                                                                                                                                                                                                                                         |
| mintFunctionParams                          | String  | <p>One of: </p><p><code>address,amount</code></p><p><code>amount,address</code></p><p><code>address</code></p><p><code>amount</code></p>                                                                                                                                        |
| sandbox                                     | Boolean | <p>True if you want to create a project in sandbox to test with fake payments. False if you want to create a live project! </p><p></p><p>Defaults to false. </p>                                                                                                                |
| costPerMint                                 | Number  | Cost per mint in the token (ETH, MATIC, SOL) -- optional if given a contract price function to pull price from.                                                                                                                                                                 |
| maxNumberOfMints                            | Number  | The max NFTs that can be purchased in one sale. If this is > 1, you \*must\* also set allowMultiplePurchases to true.                                                                                                                                                           |
| projectId<mark style="color:red;">\*</mark> | String  | The project id that is being updated                                                                                                                                                                                                                                            |
| \*                                          | String  | You need at least 1 param from /updateProject to update in this request.                                                                                                                                                                                                        |
| contractPriceFunction                       | String  | This is the function on the smart contract that we can call to get the price of the NFT                                                                                                                                                                                         |
| ercType                                     | String  | Either `1155` or `721`                                                                                                                                                                                                                                                          |
| isActive                                    | Boolean | <p>true for project active (can accept payments), false for project disabled (can not accept payments). When it is turned off/false the widget can still appear, but it will say "Can't mint right now".</p><p></p><p>Note: isActive is default false! You must turn it on!</p> |
| requireAddress                              | Boolean | If true, requires a customer to enter in their own non-custodial wallet address (like metamask) and removes Winter's custodial wallet option. If False, Winter's custodial wallet will be an option for user's to store their NFTs                                              |
| contractPriceFunctionParams                 | String  | <p>These are the param identifiers used to match the priceFunctionParams passed into the component/url. Make sure they are separated by a comma.   </p><p><code>ex: tier, tokenId, bundle</code></p>                                                                            |

{% tabs %}
{% tab title="200: OK If successful, you'll get a projectId in the response. " %}

```javascript
{
  "success": true,
  "project_id": 6736
}
```

{% endtab %}

{% tab title="400: Bad Request Return success = false and the error message" %}

```javascript
{
  "success": false,
  // Error message
  "error": "Did not send the owner email in the 'email' field"
}
```

{% endtab %}
{% endtabs %}


# /deleteProject

Base URL: https\://winter-api.usewinter.com

Delete a project!

## Delete your project on Winter.&#x20;

<mark style="color:red;">`DELETE`</mark> `/deleteProject`

Authenticate with basic auth where the username is your API key, e.g.&#x20;

`curl -X POST https://winter-api.usewinter.com/createProject -u sk_live_abcd=:`

`await axios.post(url,{ BODY }, { auth: { username: 'sk_live_abcd=' }})`

#### Request Body

| Name                                        | Type    | Description                                                                                                                                                |
| ------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| email<mark style="color:red;">\*</mark>     | String  | The email associated with the API key -- this is the email that can log into the [dashboard](<https://business.usewinter.com >) later to edit the project. |
| sandbox<mark style="color:red;">\*</mark>   | Boolean | <p>True if you want to delete a project in sandbox. False if you want to delete a mainnet project! </p><p></p><p>Defaults to false. </p>                   |
| projectId<mark style="color:red;">\*</mark> | String  | The id of the project you want to delete.                                                                                                                  |

{% tabs %}
{% tab title="200: OK If successful, you'll get a projectId in the response. " %}

```javascript
{
  "success": true,
  "project_id_deleted": 6736
}
```

{% endtab %}

{% tab title="400: Bad Request If not successful, you'll get this message" %}

```javascript
{
  success: false,
  message: 'Reason why'
}
```

{% endtab %}
{% endtabs %}


# /updateWhitelist

Base URL: https\://winter-api.usewinter.com

Update a project's whitelist info

🚨Note! If you update the whitelist addresses, it overwrites all previous addresses

Things you can do:

* Turn whitelist on/off for a project
* Add in whitelisted addresses
* Choose either a standard or Merkle Tree whitelist

## Update a project you've already created.&#x20;

<mark style="color:green;">`POST`</mark> `/updateWhitelist`

Authenticate with basic auth where the username is your API key, e.g.&#x20;

`curl -X POST https://winter-api.usewinter.com/updateWhitelist -u sk_live_abcd=:`

`await axios.post(url,{ BODY }, { auth: { username: 'sk_live_abcd=' }})`

#### Request Body

| Name                                        | Type    | Description                                                                                                                                                                                                                                                                                   |
| ------------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| email<mark style="color:red;">\*</mark>     | String  |                                                                                                                                                                                                                                                                                               |
| projectId<mark style="color:red;">\*</mark> | Number  |                                                                                                                                                                                                                                                                                               |
| \*                                          | String  | You need at least 1 param from /updateWhitelist to update in this request.                                                                                                                                                                                                                    |
| whitelistedAddresses                        | String  | An array of whitelist strings (e.g. \['0x123','0x456','0x789']). Note, adding/updating new whitelistedAddresses DELETES all previously whitelisted addresses. Make sure you add in ALL whitelistedAddresses you need                                                                          |
| whitelistStatus                             | Boolean | `true` for whitelist on, `false` for whitelist off (public mint). This also turns off or on the required address field. For example when the whitelist is turned on the required address field is turned on which takes away Winter's custodial wallet option in the checkout and vice versa. |
| whitelistType                               | String  | `merkle` or `naked` . Merkle is using a merkle proof (and will return a root hash for you to check against) and a naked whitelist is you're checking raw addresses in smart contract                                                                                                          |
| sandbox                                     | Boolean | <p><code>true</code> if you want to update a project in sandbox. <code>false</code> if you want to update a live project! </p><p></p><p>Defaults to <code>false</code>. </p>                                                                                                                  |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "success": true,
    "project_id": "6672",
    // If the whitelist is a merkle 
    "merkleHash": "0xe3d474873f2145a69f3d3c422c60489ff6acc328f27948cca5c4bea9eece0657"
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
  "success": false,
  // The error message
  "error": "Need to valid param such as whitelistStatus, whitelistType, whitelistedAddresses"
}
```

{% endtab %}
{% endtabs %}


# /getProjects

Base URL: https\://winter-api.usewinter.com

Get all projects for an admin

Things you can do:

* Query an admins projects
* See all of the relevant fields for your projects

## Get the projects you've already created.&#x20;

<mark style="color:blue;">`GET`</mark> `/getProjects`

Authenticate with basic auth where the username is your API key, e.g.&#x20;

`curl -X GET https://winter-api.usewinter.com/updateWhitelist&email=evan@usewinter.com&sandbox=true -u sk_live_abcd=:`

`await axios.get(url, { auth: { username: 'sk_live_abcd=' }})`

#### Path Parameters

| Name                                      | Type    | Description                                                                                                      |
| ----------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------- |
| sandbox<mark style="color:red;">\*</mark> | Boolean | This determines if you are querying your sandbox `true` or production projects `false`.                          |
| email<mark style="color:red;">\*</mark>   | String  | The email of the admin who's projects you are querying. The email will need to match the API key for that email. |

{% tabs %}
{% tab title="200: OK " %}

```javascript
[
 {
  "projectId": 6786,
  "costPerMint": "0.001",
  "tokenSymbol": "MATIC",
  "smartContract": "0x386670e4386580a08e1edd500d2ab20e2ddd30d6",
  "contractABI": "[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"mintAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"mintNFT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]",
  "projectName": "cryptooooo",
  "usdCostPerMint": null,
  "mintFunction": "mintMeAwesomeNFT",
  "mintParams": "amount, address",
  "brandImage": "https://i.imgur.com/Wx1eNkN.png",
  "requireAddress": null,
  "whitelistActive": false,
  "isActive": true,
  "maxMintQuantity": 2,
  "ownerEmail": "evan@usewinter.com",
  "ercType": "1155",
  "contractPriceFunction": null,
  "isMerkleProofWhitelist": false,
  "startTime": null,
  "endTime": null,
  "status": true,
  "winterApproved": true,
  "whitelistedAddresses": "",
  "merkleRootHash": null
 },
 {
  "projectId": 6670,
  "costPerMint": "5",
  "tokenSymbol": "MATIC",
  "smartContract": "0x386670e4386580a08e1edd500d2ab20e2ddd30d6",
  "contractABI": "[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"mintAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"mintNFT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]",
  "projectName": "NO WAY LAY DAY",
  "usdCostPerMint": null,
  "mintFunction": "mintNFT",
  "mintParams": "amount, address",  
  "brandImage": "https://i.imgur.com/Wx1eNkN.png",
  "requireAddress": true,
  "whitelistActive": true,
  "isActive": false,
  "maxMintQuantity": 1,
  "ownerEmail": "evan@usewinter.com",
  "ercType": "721",
  "contractPriceFunction": null,
  "isMerkleProofWhitelist": true,
  "startTime": null,
  "endTime": null,
  "status": false,
  "winterApproved": true,
  "whitelistedAddresses": "0x386670e4386580a08e1edd500d2ab20e2ddd30d6, 0x20fe10b966708b772e912458932a1206aa8d7e40, 0xca73aa2034a6670312c949f99797606e7450c607, 0x0be2cd6deaee51fa2a29183fa82061c720fdd19a",
  "merkleRootHash": "0xe3d474873f2145a69f3d3c422c60489ff6acc328f27948cca5c4bea9eece0657"
 }
]
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
"success": false,
// The error message
"error": "Attempted to make authenticated call without proper authentication"
}
```

{% endtab %}
{% endtabs %}


# Intro

Winter's custodial wallet is offered for **free** to both businesses implementing Winter's credit card checkout and to customers storing NFTs on Winter's service.

However, if the NFT is on Ethereum, it will cost a small gas fee for users to transfer the NFT out of Winter's wallet and into their own wallet. NFTs on Polygon and Solana do not cost any gas fees.

Check out some of our [FAQs](< https://winternfts.notion.site/Winter-F-A-Q-cf77158256a042b8814872ce58fe1b58>) here on how to transfer!


# /getNFTs

🚨 You'll need to contact `dev@usewinter.com` for your API keys!<br>

<mark style="color:blue;">`GET`</mark> `https://winter-api.usewinter.com/getNFTs`

This API will return back all NFTs associated with a given email

#### Query Parameters

| Name                                    | Type   | Description                                                                    |
| --------------------------------------- | ------ | ------------------------------------------------------------------------------ |
| email<mark style="color:red;">\*</mark> | String | email to get NFTs for                                                          |
| chain                                   | String | Optional chain to get NFTs only on chain                                       |
| projectId                               | String | (Project ID is specific to Winter) Filter NFTs by a Winter-specific project ID |

{% tabs %}
{% tab title="200: OK Success" %}

```javascript
[
   {
      "project_id":104,
      "email":"laila@usewinter.com",
      "mint_id":"01a2e7b5fb11d9342320b3edd1006800",
      "token_id":19,
      "tokenuri":"ipfs://QmQxTMxsAtkNodUJ26mbtchsnqTekKqgDvkjnzWir4vTxZ/19",
      "token_symbol":"MATIC",
      "smart_contract_address":"0xc9a1c857172974978641fde7463c22f4a6111d77",
      "imageURL":{
         "videoURL":null,
         "imageURL":"https://winternft.mypinata.cloud/ipfs/QmbQ3bPVoFBAM6pAcVXb2xRU3bmDsUZ3qcTJJv43cA53tL/19.png"
      }
   },
   {
      "project_id":666,
      "email":"laila@usewinter.com",
      "mint_id":"64195de0db061612dd4490bceb998ffb",
      "token_id":-1,
      "tokenuri":"9aY6UPwDWkbGmfr3fzmYXyzWvRjiMHT9g1WetYrJHbv3",
      "token_symbol":"SOL",
      "smart_contract_address":"A1cUGJcorNQeo9eRAQ1pWzXca61dFc6UZnmb36nubXFG",
      "imageURL":{
         "videoURL":null,
         "imageURL":"https://arweave.net/ndR05Z1de-KGkc7Ryps_0j8sJlNJMM8-i4y37VCQRFc?ext=png"
      }
   },
   {
      "project_id":666,
      "email":"laila@usewinter.com",
      "mint_id":"c572fb99fe66ef2633361fdaed0ae023",
      "token_id":-1,
      "tokenuri":"2CkNeZEVTaiPPmB73Tk7hPUbgPcAJzQeraUZXJvNkVRC",
      "token_symbol":"SOL",
      "smart_contract_address":"A1cUGJcorNQeo9eRAQ1pWzXca61dFc6UZnmb36nubXFG",
      "imageURL":{
         "videoURL":null,
         "imageURL":"https://arweave.net/2dB3j2sFa43lBPEhND3839IdzwuEcMSSGUmrQAPtYnk?ext=png"
      }
   },
   {
      "project_id":666,
      "email":"laila@usewinter.com",
      "mint_id":"0272ca76acd7703213c04bdb6ff01ed3",
      "token_id":-1,
      "tokenuri":"5RvDTJumuaFcfrhzWFw32bdPLHRkPp2X5q6JfED2RUjz",
      "token_symbol":"SOL",
      "smart_contract_address":"A1cUGJcorNQeo9eRAQ1pWzXca61dFc6UZnmb36nubXFG",
      "imageURL":{
         "videoURL":null,
         "imageURL":"https://arweave.net/YhOBlrgPPnHh5GkzWCEPklMrFbEkwiJ7PiKs8cO8tPY?ext=png"
      }
   },
   {
      "project_id":666,
      "email":"laila@usewinter.com",
      "mint_id":"acda33d8b7ff4ecd6f48d4f0ac10f4b5",
      "token_id":-1,
      "tokenuri":"3xqdazwQK2ZLRjdZL1bsxkUkPbjQmuyuJ4fHeaDq2zn1",
      "token_symbol":"SOL",
      "smart_contract_address":"A1cUGJcorNQeo9eRAQ1pWzXca61dFc6UZnmb36nubXFG",
      "imageURL":{
         "videoURL":null,
         "imageURL":"https://arweave.net/4c7ROpck3GtEUYBTrwhURHUlRLTJKpavRYJZelJKr1s?ext=png"
      }
   },
   {
      "project_id":666,
      "email":"laila@usewinter.com",
      "mint_id":"6c8900f02a88666b5566c70d6b3a7304",
      "token_id":-1,
      "tokenuri":"5idQyMYGFGpwrN5dZ1NroJvrsYe6QvzQ6ZvtN9vPaPwh",
      "token_symbol":"SOL",
      "smart_contract_address":"A1cUGJcorNQeo9eRAQ1pWzXca61dFc6UZnmb36nubXFG",
      "imageURL":{
         "videoURL":null,
         "imageURL":"https://arweave.net/BQNZzsTlvplAxQ1FJRfmO0zHlhLQ0dD3zu0OqrkDXMM?ext=png"
      }
   },
   {
      "project_id":666,
      "email":"laila@usewinter.com",
      "mint_id":"4552258c0d94095e48524c49f835649b",
      "token_id":-1,
      "tokenuri":"8EB4ztYvasMgc6NmP9XAksHd7knJYrG6esvVQhq391ui",
      "token_symbol":"SOL",
      "smart_contract_address":"A1cUGJcorNQeo9eRAQ1pWzXca61dFc6UZnmb36nubXFG",
      "imageURL":{
         "videoURL":null,
         "imageURL":"https://arweave.net/PnLvbtB-DbVRE1QQa8gYaM8bKKpEaiUlPoVkCgue0i8?ext=png"
      }
   },
   {
      "project_id":104,
      "email":"laila@usewinter.com",
      "mint_id":"17caa7aa1cd28439e78783060b9fd6bc",
      "token_id":24,
      "tokenuri":"ipfs://QmQxTMxsAtkNodUJ26mbtchsnqTekKqgDvkjnzWir4vTxZ/24",
      "token_symbol":"MATIC",
      "smart_contract_address":"0xc9a1c857172974978641fde7463c22f4a6111d77",
      "imageURL":{
         "videoURL":null,
         "imageURL":"https://winternft.mypinata.cloud/ipfs/QmbQ3bPVoFBAM6pAcVXb2xRU3bmDsUZ3qcTJJv43cA53tL/24.png"
      }
   },
   {
      "project_id":104,
      "email":"laila@usewinter.com",
      "mint_id":"86ba77955bf32d4c419a9d89c2cac82b",
      "token_id":25,
      "tokenuri":"ipfs://QmQxTMxsAtkNodUJ26mbtchsnqTekKqgDvkjnzWir4vTxZ/25",
      "token_symbol":"MATIC",
      "smart_contract_address":"0xc9a1c857172974978641fde7463c22f4a6111d77",
      "imageURL":{
         "videoURL":null,
         "imageURL":"https://winternft.mypinata.cloud/ipfs/QmbQ3bPVoFBAM6pAcVXb2xRU3bmDsUZ3qcTJJv43cA53tL/25.png"
      }
   }
]
```

{% endtab %}
{% endtabs %}

This API will return back all NFTs associated with a given email

E.g. /getNFTs?email=<bob@usewinter.com> returns:

```
[
   {
      "project_id":104,
      "email":"bob@usewinter.com",
      "mint_id":"01a2e7b5fb11d9342320b3edd1006800",
      "token_id":19,
      "tokenuri":"ipfs://QmQxTMxsAtkNodUJ26mbtchsnqTekKqgDvkjnzWir4vTxZ/19",
      "token_symbol":"MATIC",
      "smart_contract_address":"0xc9a1c857172974978641fde7463c22f4a6111d77",
      "imageURL":{
         "videoURL":null,
         "imageURL":"https://winternft.mypinata.cloud/ipfs/QmbQ3bPVoFBAM6pAcVXb2xRU3bmDsUZ3qcTJJv43cA53tL/19.png"
      }
   },
   {
      "project_id":666,
      "email":"laila@usewinter.com",
      "mint_id":"64195de0db061612dd4490bceb998ffb",
      "token_id":-1,
      "tokenuri":"9aY6UPwDWkbGmfr3fzmYXyzWvRjiMHT9g1WetYrJHbv3",
      "token_symbol":"SOL",
      "smart_contract_address":"A1cUGJcorNQeo9eRAQ1pWzXca61dFc6UZnmb36nubXFG",
      "imageURL":{
         "videoURL":null,
         "imageURL":"https://arweave.net/ndR05Z1de-KGkc7Ryps_0j8sJlNJMM8-i4y37VCQRFc?ext=png"
      }
   },
   {
      "project_id":666,
      "email":"laila@usewinter.com",
      "mint_id":"c572fb99fe66ef2633361fdaed0ae023",
      "token_id":-1,
      "tokenuri":"2CkNeZEVTaiPPmB73Tk7hPUbgPcAJzQeraUZXJvNkVRC",
      "token_symbol":"SOL",
      "smart_contract_address":"A1cUGJcorNQeo9eRAQ1pWzXca61dFc6UZnmb36nubXFG",
      "imageURL":{
         "videoURL":null,
         "imageURL":"https://arweave.net/2dB3j2sFa43lBPEhND3839IdzwuEcMSSGUmrQAPtYnk?ext=png"
      }
   },
   {
      "project_id":666,
      "email":"laila@usewinter.com",
      "mint_id":"0272ca76acd7703213c04bdb6ff01ed3",
      "token_id":-1,
      "tokenuri":"5RvDTJumuaFcfrhzWFw32bdPLHRkPp2X5q6JfED2RUjz",
      "token_symbol":"SOL",
      "smart_contract_address":"A1cUGJcorNQeo9eRAQ1pWzXca61dFc6UZnmb36nubXFG",
      "imageURL":{
         "videoURL":null,
         "imageURL":"https://arweave.net/YhOBlrgPPnHh5GkzWCEPklMrFbEkwiJ7PiKs8cO8tPY?ext=png"
      }
   },
   {
      "project_id":666,
      "email":"laila@usewinter.com",
      "mint_id":"acda33d8b7ff4ecd6f48d4f0ac10f4b5",
      "token_id":-1,
      "tokenuri":"3xqdazwQK2ZLRjdZL1bsxkUkPbjQmuyuJ4fHeaDq2zn1",
      "token_symbol":"SOL",
      "smart_contract_address":"A1cUGJcorNQeo9eRAQ1pWzXca61dFc6UZnmb36nubXFG",
      "imageURL":{
         "videoURL":null,
         "imageURL":"https://arweave.net/4c7ROpck3GtEUYBTrwhURHUlRLTJKpavRYJZelJKr1s?ext=png"
      }
   },
   {
      "project_id":666,
      "email":"laila@usewinter.com",
      "mint_id":"6c8900f02a88666b5566c70d6b3a7304",
      "token_id":-1,
      "tokenuri":"5idQyMYGFGpwrN5dZ1NroJvrsYe6QvzQ6ZvtN9vPaPwh",
      "token_symbol":"SOL",
      "smart_contract_address":"A1cUGJcorNQeo9eRAQ1pWzXca61dFc6UZnmb36nubXFG",
      "imageURL":{
         "videoURL":null,
         "imageURL":"https://arweave.net/BQNZzsTlvplAxQ1FJRfmO0zHlhLQ0dD3zu0OqrkDXMM?ext=png"
      }
   },
   {
      "project_id":666,
      "email":"laila@usewinter.com",
      "mint_id":"4552258c0d94095e48524c49f835649b",
      "token_id":-1,
      "tokenuri":"8EB4ztYvasMgc6NmP9XAksHd7knJYrG6esvVQhq391ui",
      "token_symbol":"SOL",
      "smart_contract_address":"A1cUGJcorNQeo9eRAQ1pWzXca61dFc6UZnmb36nubXFG",
      "imageURL":{
         "videoURL":null,
         "imageURL":"https://arweave.net/PnLvbtB-DbVRE1QQa8gYaM8bKKpEaiUlPoVkCgue0i8?ext=png"
      }
   },
   {
      "project_id":104,
      "email":"laila@usewinter.com",
      "mint_id":"17caa7aa1cd28439e78783060b9fd6bc",
      "token_id":24,
      "tokenuri":"ipfs://QmQxTMxsAtkNodUJ26mbtchsnqTekKqgDvkjnzWir4vTxZ/24",
      "token_symbol":"MATIC",
      "smart_contract_address":"0xc9a1c857172974978641fde7463c22f4a6111d77",
      "imageURL":{
         "videoURL":null,
         "imageURL":"https://winternft.mypinata.cloud/ipfs/QmbQ3bPVoFBAM6pAcVXb2xRU3bmDsUZ3qcTJJv43cA53tL/24.png"
      }
   },
   {
      "project_id":104,
      "email":"laila@usewinter.com",
      "mint_id":"86ba77955bf32d4c419a9d89c2cac82b",
      "token_id":25,
      "tokenuri":"ipfs://QmQxTMxsAtkNodUJ26mbtchsnqTekKqgDvkjnzWir4vTxZ/25",
      "token_symbol":"MATIC",
      "smart_contract_address":"0xc9a1c857172974978641fde7463c22f4a6111d77",
      "imageURL":{
         "videoURL":null,
         "imageURL":"https://winternft.mypinata.cloud/ipfs/QmbQ3bPVoFBAM6pAcVXb2xRU3bmDsUZ3qcTJJv43cA53tL/25.png"
      }
   }
]
```


# /transferNFT

🚨 You'll need to contact `dev@usewinter.com` for your API keys!

<mark style="color:green;">`POST`</mark> `https://winter-api.usewinter.com/transferNFT`

This API will transfer a specific NFT from one user to another user. This transfer will always be an on-chain transaction!

#### Request Body

| Name                                                   | Type   | Description                                                       |
| ------------------------------------------------------ | ------ | ----------------------------------------------------------------- |
| fromEmail<mark style="color:red;">\*</mark>            | String | Email to send NFT from                                            |
| toEmail                                                | String | Email to send NFT to                                              |
| smartContractAddress<mark style="color:red;">\*</mark> | String | Address of ERC-721/1155/Candy Machine NFT of the NFT to send      |
| tokenId                                                | String | (Required for ERC-721/1155 transfers) Token ID of NFT to transfer |
| chain<mark style="color:red;">\*</mark>                | String | Blockchain to do transfer on                                      |
| toWalletAddress                                        | String | Wallet address to send NFT to (optional)                          |

{% tabs %}
{% tab title="200: OK Returns back success and tx hash" %}

```javascript
{
      "tokenId":104,
      "toEmail":"laila@usewinter.com",
      "fromEmail":"michael@usewinter.com",
      "txHash":"0x3c865fa72e45119593abe27ea35161b36e38b73f5b70af2d52fee0c7798dd0c1",
      "status":"SUCCESS"
   }
```

{% endtab %}
{% endtabs %}

This API will transfer a specific NFT from one user to another user. This transfer will always be an on-chain transaction!

E.g. /transferNFT returns:

```
{
    "tokenId":104,
    "toEmail":"bob@usewinter.com",
    "fromEmail":"alice@usewinter.com",
    "txHash":"0x3c865fa72e45119593abe27ea35161b36e38b73f5b70af2d52fee0c7798dd0c1",
    "status":"SUCCESS"
}
```


# Intro

Looking to build a bespoke experience with NFTs? This the set of APIs you want!

{% hint style="info" %}
Email us at <help@usewinter.com> to get your API key!
{% endhint %}

Some common use cases we serve:

* Free NFT claims
* Rewards/loyalty programs
* Games with NFTs
* NFTs backed with physical items

Note: We do NOT help write smart contracts! These APIs are for if you already have a smart contract and you need help claiming/transferring/distributing without wanting to pay gas.

In developer speak, we help manage all the "writes" to the blockchain! Like calling a state-changing function on a smart contract.

Some common reasons why people choose to use our API:

* No need to manage gas fees (Winter handles this for you)
* No need to manage custodial wallets
* No need to manage nonces at scale
* No need to build your own infrastructure (pay as you go)
* Fully whitelabeled experience


# /mintNFT

🚨 You'll need to contact `dev@usewinter.com` for your API keys!<br>

This set of APIs is for when you want to mint (free or paid) NFTs directly from a smart contract.

{% hint style="info" %}
Because this API supports paid mints (e.g. we can mint NFTs that cost 0.05 ETH), usage of this API will require a signed business agreement.&#x20;
{% endhint %}

An example use case is if a user buys a video game item as an NFT, you can collect the payment from Apple In App Purchases (IAP), and call this API to mint an NFT!

<mark style="color:green;">`POST`</mark> `https://winter-api.usewinter.com/mintNFT`

This API will return back all NFTs associated with a given email

#### Request Body

| Name                                        | Type    | Description                                                                                                                |
| ------------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------- |
| projectId<mark style="color:red;">\*</mark> | Integer | projectId set up in Winter's dashboard (a project ID will correspond to smart contract address, ABI, etc)                  |
| chain<mark style="color:red;">\*</mark>     | String  | Chain to mint on                                                                                                           |
| email                                       | String  | Optional string to send user an email confirmation                                                                         |
| mintParams                                  | JSON    | Optional JSON object with extra mint params (e.g. if you want to specify a specific tier of an item, this is what you use) |

{% tabs %}
{% tab title="200: OK Success" %}

```javascript
{
   "project_id":104,
   "success": true,
   "mint_id":"01a2e7b5fb11d9342320b3edd1006800",
   "token_id":19,
   "tokenuri":"ipfs://QmQxTMxsAtkNodUJ26mbtchsnqTekKqgDvkjnzWir4vTxZ/19",
   "token_symbol":"MATIC",
   "smart_contract_address":"0xc9a1c857172974978641fde7463c22f4a6111d77",
   "txHash": "0x8259801df6220e4e47960fcdd0dff998973ee70bb1e24688370460fba8a8ae49"
}
```

{% endtab %}
{% endtabs %}

This API will return back if the mint was success or failure and additional details such as tx hash, token\_id, and other details!

E.g. /mintNFT returns:

```
{
   "project_id":104,
   "success": true,
   "mint_id":"01a2e7b5fb11d9342320b3edd1006800",
   "token_id":19,
   "tokenuri":"ipfs://QmQxTMxsAtkNodUJ26mbtchsnqTekKqgDvkjnzWir4vTxZ/19",
   "token_symbol":"MATIC",
   "smart_contract_address":"0xc9a1c857172974978641fde7463c22f4a6111d77",
   "txHash": "0x8259801df6220e4e47960fcdd0dff998973ee70bb1e24688370460fba8a8ae49"
}
```


# /mintFreeNFT

🚨 You'll need to contact `dev@usewinter.com` for your API keys!<br>

This set of APIs is for when you want to mint specifically a FREE NFT directly from a smart contract.

An example use case is if you want to reward a user with a free loyalty NFT!

<mark style="color:green;">`POST`</mark> `https://winter-api.usewinter.com/mintNFT`

This API will return back all NFTs associated with a given email

#### Request Body

| Name                                        | Type    | Description                                                                                                                |
| ------------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------- |
| projectId<mark style="color:red;">\*</mark> | Integer | projectId set up in Winter's dashboard (a project ID will correspond to smart contract address, ABI, etc)                  |
| chain<mark style="color:red;">\*</mark>     | String  | Chain to mint on                                                                                                           |
| email                                       | String  | Optional string to send user an email confirmation                                                                         |
| mintParams                                  | JSON    | Optional JSON object with extra mint params (e.g. if you want to specify a specific tier of an item, this is what you use) |

{% tabs %}
{% tab title="200: OK Success" %}

```javascript
{
   "project_id":104,
   "success": true,
   "mint_id":"01a2e7b5fb11d9342320b3edd1006800",
   "token_id":19,
   "tokenuri":"ipfs://QmQxTMxsAtkNodUJ26mbtchsnqTekKqgDvkjnzWir4vTxZ/19",
   "token_symbol":"MATIC",
   "smart_contract_address":"0xc9a1c857172974978641fde7463c22f4a6111d77",
   "txHash": "0x8259801df6220e4e47960fcdd0dff998973ee70bb1e24688370460fba8a8ae49"
}
```

{% endtab %}
{% endtabs %}

This API will return back if the mint was success or failure and additional details such as tx hash, token\_id, and other details!

E.g. /mintFreeNFT returns:

```
{
   "project_id":104,
   "success": true,
   "mint_id":"01a2e7b5fb11d9342320b3edd1006800",
   "token_id":19,
   "tokenuri":"ipfs://QmQxTMxsAtkNodUJ26mbtchsnqTekKqgDvkjnzWir4vTxZ/19",
   "token_symbol":"MATIC",
   "smart_contract_address":"0xc9a1c857172974978641fde7463c22f4a6111d77",
   "txHash": "0x8259801df6220e4e47960fcdd0dff998973ee70bb1e24688370460fba8a8ae49"
}
```


# /transferNFT

🚨 You'll need to contact `dev@usewinter.com` for your API keys!

<mark style="color:green;">`POST`</mark> `https://winter-api.usewinter.com/transferNFT`

This API will transfer a specific NFT from one user to another user. This transfer will always be an on-chain transaction!

#### Request Body

| Name                                                   | Type   | Description                                                       |
| ------------------------------------------------------ | ------ | ----------------------------------------------------------------- |
| fromEmail<mark style="color:red;">\*</mark>            | String | Email to send NFT from                                            |
| toEmail                                                | String | Email to send NFT to                                              |
| smartContractAddress<mark style="color:red;">\*</mark> | String | Address of ERC-721/1155/Candy Machine NFT of the NFT to send      |
| tokenId                                                | String | (Required for ERC-721/1155 transfers) Token ID of NFT to transfer |
| chain<mark style="color:red;">\*</mark>                | String | Blockchain to do transfer on                                      |
| toWalletAddress                                        | String | Wallet address to send NFT to (optional)                          |

{% tabs %}
{% tab title="200: OK Returns back success and tx hash" %}

```javascript
{
      "tokenId":104,
      "toEmail":"laila@usewinter.com",
      "fromEmail":"michael@usewinter.com",
      "txHash":"0x3c865fa72e45119593abe27ea35161b36e38b73f5b70af2d52fee0c7798dd0c1",
      "status":"SUCCESS"
   }
```

{% endtab %}
{% endtabs %}

This API will transfer a specific NFT from one user to another user. This transfer will always be an on-chain transaction!

E.g. /transferNFT returns:

```
{
    "tokenId":104,
    "toEmail":"bob@usewinter.com",
    "fromEmail":"alice@usewinter.com",
    "txHash":"0x3c865fa72e45119593abe27ea35161b36e38b73f5b70af2d52fee0c7798dd0c1",
    "status":"SUCCESS"
}
```


# Intro

Cross-chain payments enables your customers to buy an NFT with crypto tokens - even if the tokens aren't native to your chain!

For example, a user can buy an ETH NFT with SOL tokens with cross-chain payments!

Why use cross-chain payments?

* Free for sellers/platforms
* No KYC
* Saves buyers from fees (gas fees to transfer to an exchange, exchange fees, etc)
* Increases conversion rates for buyers (easier for NFT buyers!)

{% hint style="info" %}
Email`help@usewinter.com` to get your API key to get started!
{% endhint %}

What chains do we support payments from?

* Ethereum (ETH)
* Solana (SOL)
* Polygon (MATIC)
* USDC (ERC-20)
* Avalanche (AVAX)
* Binance (BNB)
* BUSD (BEP-20)

Want to see a new payment token? Email us at `help@usewinter.com` and we'd love to help!


# Integration

{% hint style="info" %}
Email `help@usewinter.com` for your API key!
{% endhint %}

Install [Winter's checkout package](https://www.npmjs.com/package/@usewinter/checkout)

```
npm i @usewinter/checkout

OR 

yarn add @usewinter/checkout
```

Use the component in your React app

```
import { WinterCheckout } from '@usewinter/checkout';

<WinterCheckout 
    projectId={YOUR_PROJECT_ID} 
    production={false} 
    showModal={showWinter} 
    // pass in a function to be called when a successful purchase happens
    onSuccess={() => setParty(true)}
    // pass in a function to be called when the modal is closed
    onClose={() => setShowWinter(false)}
    // Replace with your desired crypto token payment method
    // e.g. 'ETH' or 'SOL' or 'MATIC'
    paymentMethod={'ETH'}
    // This will be the domain of the marketplace you want to pull the orders from
    orderSource={'opensea.io'}
    // This will be the domain of the marketplace you want the order to be fulfilled on
    fillSource={'opensea.io'}
/>
```


