NFT Linking and Withdrawals

Banq now allows API integrators the ability to connect to an end-user's Banq wallet to view the NFT's they currently own. Through a quick login and approval step, end-user's can give an integrator's platform approval to both view the NFT's they have in their wallet, as well as request withdrawals to on-chain addresses for secondary sales. Accompanied with the checkout widget, integrators now have the ability to host end to end services for NFTs from account creation and purchases to custody and secondary sales.

Below will be a list of steps needed to link wallets and withdraw NFTs.

🚧

Update your Webhook Config!!

This new functionality delivers values via webhooks. To streamline your process as much as possible, be sure to update your webhook config to include new NFT and Linking webhooks.

PATCH /api/v1/account-spaces/{accountSpaceId}/webhook-config
The schema can be found here: https://api.banq.com/core/index.html

Allowing Access to an End User's Wallet

Access is granted via a widget that allows your end-user to input their banq account credentials. Upon successfully logging in and granting permissions to the integrator, a webhook will be sent to the integrator's receiving server with the information they need to continue.

There is both a script as well as a library for the linking widget.

<script src="https://walletnft-widget.sandbox.banq.com/ecommerce.js"></script>
<div id="nft-link-banq"></div>
<script>
  const app = new window.ecommerceBanqWidget({
    selector: '#nft-link-banq',
    // `platformId` is from `banq/AccountSpace`
    platformId: "00000000-0000-0000-0000-000000000000",
    // this function will trigger callback when user will close widget
    onPopUpClose: () => {
      console.log('pop up is closed action');
    },
    // this function will trigger callback after success payment
    onPaymentSuccess: () => {
      console.log('this triggers after payment completed successfully');
    }
  });
  app.bootstrapApp();
</script>

To obtain your platformId, use the following API call:

GET /v1/users/me?include=accountSpaces

The platformId is located in the accountSpaces array, in the identity object labeled as id. Make sure you are grabbing the Id associated with your merchant account.

2026

Viewing NFTs

Once you have been granted access to the end-user's banq wallet, you will be able to follow up with an API call using the values supplied to you in a webhook response pertaining to that particular end-user's banq wallet.

GET /api/v1/user-tokens/{userGuid}/platform-nfts

//userGuid provided in webhook

These values will let you withdraw NFTs to external addresses

Withdrawing NFTs

With access granted, integrators can now view and withdraw NFTs out to external addresses. This allows you to move the NFTs to a marketplace escrow smart contract for secondary sales (or any appropriate external address).

POST /api/v1/nft-transactions/withdraw

{
 "tokenDataId": "", ///obtained from GET /platform-nfts
 "sourceBanq": "",  ///obtained from GET /platform-nfts
 "externalAddress": "",  ///address NFT is being sent to
 "amount": 1,
 "platformId": "",  ///Your platformId
 "userId": "" ///userID of the customer (obtained from webhook after they grant access)
}

Once a withdrawal has been initiated, the customer will receive an email where they will need to confirm the withdrawal out of their account.

810

Upon clicking "Complete Transfer", the end-user will be redirected to the banq web app to approve the transfer

600