Tweed Docs
  • Welcome to Tweed
    • What Can Tweed Do?
  • Getting Started
    • Embedded Wallets | WaaS
    • Token Checkout | Payments
      • Flow of Funds: Purchase to Settlement
      • Token Checkout
      • Legacy Token Checkout
        • Basic Checkout Integration
        • Checkout + WaaS + Auth
        • Features
          • Payment links
          • Whitelist
          • Flow of Funds
          • Apple & Google Pay
          • AML & KYC Policy Overview
  • Developer Tools
    • Tweed SDKs
      • core-react
        • useAuth
        • useWallet
        • useTweed
        • usePayments
        • useWeb3
      • core-js
      • core-vue
      • Payments SDKs (v1)
        • Frontend SDKs (Payments)
        • Backend SDK (Payments)
        • How to set up your smart contract for Tweed
        • Tezos chain considerations
    • Management Dashboard
      • Create platform
      • Create application
        • UI Customization
    • Webhooks
      • Checkout Webhooks
    • API
      • API (V1)
      • API (V2)
        • Authorization
        • API reference
          • Contracts
            • Add
            • Add contract function
            • Contract
          • Payouts
            • Add
            • Payout
          • Items
            • Add
            • All
              • Contract
                • Count
              • Payout
                • Count
          • Assets
            • Blockchain
            • All
              • Blockchains
          • Blockchains
            • Multiple
            • Native asset
          • Audit event mappings
          • Platform webhooks
            • Set active
          • Tickets
        • Specification
    • External Integrations
      • Wagmi connector
      • Onramp to Crypto
    • Example Projects
    • Supported Blockchains
    • Pricing
  • Products
    • WaaS
    • Payments
Powered by GitBook
On this page
  1. Developer Tools
  2. Tweed SDKs
  3. Payments SDKs (v1)

Frontend SDKs (Payments)

PreviousPayments SDKs (v1)NextBackend SDK (Payments)

Last updated 8 months ago

This page compliments the guide. Here you will find additional information regarding functions used in the Payments Integration Guide.

Buy with fiat

Depending on whether your use case requires a Token or NFT checkout, The path to the function will be different:

  • For NFT checkout use: frontendSDK.nft.buyWithFiat With the nftId parameter.

  • For Token checkout use: frontendSDK.token.buyWithFiat With the tokenId parameter.

The synopsis for both functions almost identical, with the `tokenId` / `nftId` being the only difference:

type buyWithFiat = (payload: {
    nftId: string;
    data: Record<string, any> | undefined;
    toWalletAddress: string | undefined;
    customMintParams: Record<string, any> | undefined;
    callbacks: WidgetCallbacks<any> | undefined;
    settings: WidgetSettings | undefined;
}): Promise<string>
Field Name
Description

nftID

or tokenID

data

Your custom data that will be passed to Tweed, and later will be sent to you in the Webhook(s).

toWalletAddress

The wallet address that the NFT will be send to, If the wallet was created by tweed the wallet address will be populated automatically.

customMintParams

A key-value set of parameters that will be passed into your on-chain smart contract. Needs to match your contract's ABI!

callbacks

You may define handlers for the following widget events: onSuccess, onError, onClose

try {
      sdkv1.nft.buyWithFiat({
        nftId,
        toWalletAddress,
        customMintParams: {},
        data: {},
        callbacks: {
          onSuccess: (data) => {
            console.log('[buyNft] Freemint success!', data)
          },
          onError: (error) => {
            console.error('[buyNft] Freemint error!', error)
          },
          onClose,
        },
        settings: {
          
        }
      })
    } catch (err) {
      console.error(err)
    }

The ID of the NFT or Token, as defined by your implementation of the Tweed Backend Payment SDK. (Read more about the: )

Example of usage

Basic Payment Integration
​
​
Backend side of the Payments integration