Search code examples
wordpresspaymentcheckoutnftcrossmint

How do I embed Crossmint NFT payments in a wordpress blog?


I have an NFT collection, and I am trying to sell it from my own Wordpress hosted website.

How can I do this? Their documentation doesn't explain how to add their NFT checkout SDK inside a wordpress blog.


Solution

  • You can manage this by using the HTML embed block in Wordpress. Here is a code snippet to get you started:

    <script src="https://unpkg.com/@crossmint/[email protected]/lib/index.global.js"></script>
    <crossmint-pay-button
      projectId="_PROJECT_ID_"
      collectionId="_COLLECTION_ID_"
      mintConfig='{
        "type": "erc-721",
        "totalPrice": "_PRICE_PER_NFT_"
      }'
      environment="staging"
    />
    

    You'll need to add your projectId and collectionId for your collection, which can be found in the Crossmint Developer Console.

    If your mint function accepts an argument for quantity, that should be included in the mintConfig object also. For example, if the quantity argument is named _quantity then you'd add "_quantity": "1" to the mintConfig.

    Follow the same pattern for any custom mint function arguments, using the name of the argument as the property.

    Finally, note the environment property. This must match the console you're using.

    staging/testnets: https://staging.crossmint.com/console

    prod/mainnets: https://www.crossmint.com/console

    Here is a link to a recipe on the Crossmint documentation about this: https://docs.crossmint.com/recipes/adding-the-crossmint-button-to-wordpress-squarespace-webflow