Nivapay - Product & API Documentation
  • 📖Introduction
    • 🚀What is Nivapay?
    • 🏂Onboarding Process
  • 💡PRODUCTS
    • Onramp to Merchant Deposit
      • How to integrate
    • NFT Checkout
      • How to integrate
    • NFT Minting
      • How to integrate
    • 💸Currency Coverage
    • ⏯️Test Credentials for Sandbox
    • 📒Registering your Smart Contract
  • 🔗Integrations
    • ☁️Environments
    • 🔑Authentication
    • #️⃣API response codes
    • 📦Web SDK (ReactJS)
  • ⚙️API Documentation
    • Onramp to Merchant Deposit
    • NFT Checkout
    • NFT Minting
  • 🌐Webhooks
    • Overview
    • Onramp to Merchant Deposit
    • NFT Checkout
    • NFT Minting
Powered by GitBook
On this page
  • Create Order
  • Generate Crypto Quote

Was this helpful?

  1. API Documentation

NFT Minting

Create Order

POST https://api-purchase-nft.nivapay.com/merchant/hosted/nftCheckout/order

Merchant will call this endpoint to generate a new order. Merchant needs to redirect their user to the hosted checkout URL to complete the journey.

Headers

Name
Type
Description

X-API-KEY*

string

Merchant API key

Request Body

Name
Type
Description

crypto_symbol*

string

Symbol of the virtual asset which user wants to pay in. If the SC function requires funds, then this should be the same currency.

user_last_name

string

Last name of your user

user_first_name

string

First name of your user

user_email_id

string (email)

Email ID of your user

merchant_webhook_url

string (url)

URL where you want to receive webhook events

merchant_redirect_url*

string (url)

URL to which the user will be redirected back at the end of the journey or when user cancels the session. For SDK integration, pass a dummy value.

merchant_txn_id

string

Internal ID provided by the merchant to track this order. This will be passed in the webhook events too.

merchant_user_id*

string

Internal ID provided by the merchant for the user

merchant_id*

string

ID assigned to the merchant by Nivapay

crypto_contract_address

string

Contract address is required, if symbol+network is not a native currency, else can be null

contractExecution*

json

Smart contract (SC) execution details

network_params*

json

Contains network params

totalValue*

string

Total value of crypto to be paid to the function for this particular call (with above function_args). Value must not be in wei. You can use big decimals up to 18 digits.

payableCryptoContractAddress

string

If the virtual asset is an ERC20 / BEP20 token then it’s contract address to uniquely identify it

payableCryptoSymbol*

string

Symbol of the virtual asset to be paid to the SC function

payment

json

Required only if the SC function is expected to receive funds for its successful execution

function_args*

json

JSON containing the list of arguments (key-value pairs) this SC function takes. Arguments must adhere to the data type defined in the function ABI registered. Refer to the example below.

smartContractFunctionId*

string

ID of the SC function registered by the merchant

customGasLimit

string

Gas limit to override the defaultGasLimit specified at the time of registering your SC. If your SC function can vary in terms of computational effort, then it is strongly recommended to set this to avoid “insufficient gas fee” failures.

networkName*

string

Blockchain network on which this SC exists

crypto_network*

string

Blockchain network of this virtual asset

param
type
description
required

order_id

string

Order ID assigned by Nivapay

yes

crypto_symbol

string

Symbol of the virtual asset which user wants to pay in. If the SC function requires funds, then this should be the same currency.

yes

crypto_contract_address

string

Contract address is required, if symbol+network is not a native currency, else can be null

no

crypto_network

string

Blockchain network of this virtual asset

yes

crypto_amount

string

Virtual asset amount to be paid to fulfil this order

yes

hash

string

Secret hash which allows you to access the gateway_url. It is already added as a query param to the gateway_url.

yes

gateway_url

string (url)

URL to the hosted checkout page where you need to redirect your user

yes

{
	"order_id": "VKP3OBZ3XG",
	"crypto_symbol": "ETH",
	"crypto_network": "Ethereum",
	"crypto_amount": "2.01434",
	"hash": "1441a7909c087dbbe7ce59881b9df8b9",
	"gateway_url": "https://purchase-nft.nivapay.com/order?order_id=VKP3OBZ3XG&hash=1441a7909c087dbbe7ce59881b9df8b9"
}
{
	"order_id": "VKP3OBZ3XG",
	"crypto_symbol": "ETH",
	"crypto_network": "Ethereum",
	"crypto_amount": "2.01434",
	"hash": "1441a7909c087dbbe7ce59881b9df8b9",
	"gateway_url": "https://purchase-nft.nivapay.com/order?order_id=VKP3OBZ3XG&hash=1441a7909c087dbbe7ce59881b9df8b9",
	"info": "Secret is not configured for creating X-Nivapay-Webhook-Signature for signing webhook events. There won't be any webhooks events in this order. Contact Nivapay for configuring the secret."
}
{
	"statusCode": 400,
	"timestamp": "2023-07-20T05:19:18.018Z",
	"message": "payableCryptoSymbol #USDC #Ethereum is invalid",
	"path": "/merchant/hosted/nftCheckout/order",
	"status": false
}
{
	"statusCode": 401,
	"timestamp": "2024-02-07T07:03:18.153Z",
	"message": "Unauthorized",
	"path": "/merchant/hosted/nftCheckout/order",
	"status": false
}
Create Order request example (curl)
curl --location 'https://api-purchase-nft.nivapay.com/merchant/hosted/nftCheckout/order' \
--header 'Content-Type: application/json' \
--header 'x-api-key: 2b03fc9e-550e-4ffb-9136-92b627f9988b' \
--data-raw '{
    "crypto_symbol": "ETH",
    "crypto_network": “Ethereum”,

"contractExecution": {
		"smartContractFunctionId": "c6214bdf-051f-4000-8879-590d9b03d4af",
		"function_args": {
			"numberOfNFTs": "3",
			"tokenIds": ["1003","1004","1010"],
			"to_addr": "0x8e23ee67d1332ad560396262c48ffbb01f93d052"
		},
		"payment": {
			"payableCryptoSymbol": "ETH",
			"payableCryptoContractAddress": "",
			"totalValue": "1.98"
		},
		"network_params": {
			"networkName": "Ethereum",
			"customGasLimit": "1320837"
		}
	}

    "merchant_id": "M7184835",
    "merchant_user_id": "1xdeavy",
    "merchant_txn_id": "3589cb4a-0830-497d-a92d-c5178eb2ab9f",
    "merchant_redirect_url": "https://nivapay.com",
    "merchant_webhook_url": "https://hooks.nivapay.com/payment-services/",

    "user_email_id": "daves@yahoo.com",
    "user_first_name": "Dave",
    "user_last_name": "Smith"
}'

Generate Crypto Quote

POST https://api-purchase-nft.nivapay.com/merchant/hosted/nftCheckout/cryptoQuote

Get the amount to be paid in crypto to fulfil the desired NFT Checkout order

Headers

Name
Type
Description

X-API-KEY*

string

Merchant API key

Request Body

Name
Type
Description

crypto_symbol*

string

Symbol of the virtual asset which user wants to pay in. If the SC function requires funds, then this should be the same currency.

merchant_id*

string

ID assigned to the merchant by Nivapay

crypto_contract_address

string

Contract address is required, if symbol+network is not a native currency, else can be null

contractExecution*

json

Smart contract (SC) execution details

network_params*

json

Contains network params

totalValue*

string

Total value of crypto to be paid to the function for this particular call (with above function_args). Value must not be in wei. You can use big decimals up to 18 digits.

payableCryptoContractAddress

string

If the virtual asset is an ERC20 / BEP20 token then it’s contract address to uniquely identify it

payableCryptoSymbol*

string

Symbol of the virtual asset to be paid to the SC function

payment

json

Required only if the SC function is expected to receive funds for its successful execution

function_args*

json

JSON containing the list of arguments (key-value pairs) this SC function takes. Arguments must adhere to the data type defined in the function ABI registered. Refer to the example below.

smartContractFunctionId*

string

ID of the SC function registered by the merchant

customGasLimit

string

Gas limit to override the defaultGasLimit specified at the time of registering your SC. If your SC function can vary in terms of computational effort, then it is strongly recommended to set this to avoid “insufficient gas fee” failures.

networkName*

string

Blockchain network on which this SC exists

crypto_network*

string

Blockchain network of this virtual asset

param
type
description
required

crypto_amount

string

Crypto amount to be paid to fulfil this order

yes

allowed

boolean

Whether this amount is permissible for payment for the given crypto currency. If this is false then the NFT Checkout order also won't get generated.

yes

message

string

Message explaining if it is not allowed or Bad request

no

{
	"crypto_amount": "1.031452",
	"allowed": true,
	"message": ""
}
{
	"statusCode": 401,
	"timestamp": "2024-02-07T07:03:18.153Z",
	"message": "Unauthorized",
	"path": "/merchant/hosted/nftCheckout/cryptoQuote",
	"status": false
}
PreviousNFT CheckoutNextOverview

Last updated 1 year ago

Was this helpful?

⚙️