Skip to main content

Tokens purchase

Overview

To purchase memberships or tokens, call the openUI function with the required configuration. This method is similar to the stored value purchase process.

Usage Example

Here is an example of how to use the openUI function to purchase a membership or tokens:

typescript
import { Passport } from '@credenza3/passport-sui'

const passport = new Passport()
await passport.init()

passport.openUI(Passport.pages.PAYMENT, {
  title: 'Purchase',
  subtitle: 'Select a payment method and complete your purchase',
  payments: {
    credenzaStoredValue: {
      disabled: false
    },
    stripe: {
      disabled: false
    }
  },
  asset: {
    packageId: "packageId",
    type: "credenza_asset_collection" // "decom" | "membership" | "credenza_asset_collection",
    assetId: "1" // used only for credenza_asset_collection type,
    amount: "1" // used only for credenza_asset_collection type
  },
  email: {
    templateId: 'custom-template-id'  // Optional custom email template
  }
})

This is going to open passport window where a user can finish his transaction:

Entering Payment Details

After confirming their stored value selection, users see the Order Summary modal. Here, they can choose a payment method such as Credit Card or Credenza Balance. For credit card payments, they'll input their card number and can use the Autofill link for convenience. They then click the Pay button.

Confirming Payment

Upon successful payment, a Success! modal confirms the transaction. Users can acknowledge the message and proceed with other activities.