Skip to main content

Usage

const transaction = await sdk.purchaseSku({
  params: {
    wallet: {
      publicKey: "0x...",
      encryptedPrivateKey: "...",
    },
    skuId: "sku-tl-ATT010",
    mxnAmount: 100,
    reference: "5512345678",
    encryptKey: "user-pin",
    externalUserId: "user-123",
  },
  bearerToken,
});

Parameters

ParameterTypeRequiredDescription
params.walletWalletDataYesUser’s wallet (publicKey + encryptedPrivateKey)
params.skuIdstringYesThe SKU identifier to purchase
params.mxnAmountnumberYesAmount to charge in Mexican Pesos (MXN)
params.referencestringYesUnique reference (e.g. phone number for top-ups)
params.encryptKeystringYesUser’s PIN to decrypt the wallet
params.externalUserIdstringYesYour application’s user identifier
bearerTokenstringNoJWT token. Falls back to apiSecretKey if not provided

Return Value

Returns a Promise<Transaction> with the purchase transaction record.

Example

const transaction = await sdk.purchaseSku({
  params: {
    wallet: userWallet,
    skuId: "sku-tl-ATT010",
    mxnAmount: 50,
    reference: "5512345678",
    encryptKey: userPin,
    externalUserId: userId,
  },
  bearerToken,
});

console.log("Purchase TX:", transaction.id);