Setting up Convert to Credit

Used when allowing users to withdraw money in credits relevant to your internal system.

lucraClient.sendMessage.enableConvertToCredit()

Enables the convert to credit option in the withdraw funds screen. Call this when your application supports credit conversion for withdrawals.

Example:

lucraClient.sendMessage.enableConvertToCredit();

lucraClient.sendMessage.convertToCreditResponse(...)

Call this after receiving a convertToCredit message when the user attempts to withdraw funds. The user-requested amount to convert will be sent along in the original message:

// TypeScript
export type LucraConvertToCreditBody = { amount: number }

Example payload:

lucraClient.sendMessage.convertToCreditResponse({
  id: "xyz-123",
  title: "Game Credits",
  iconUrl: "https://example.com/icon.png",
  conversionTerms: "Instant transfer",
  convertedAmount: "<amount from the convertToCredit message>",
  convertedDisplayAmount: "<desired formatted version of amount>",
  shortDescription: "Convert to game credits",
  longDescription:
    "Withdraw your winnings as game credits that can be used immediately in-game.",
  metaData: {
    ...
  },
});

Last updated