# 7.3 Buy a membership with Cash Coins

Now you have the 25 CCC to buy a Bronze Membership. Let's do that.

# Use cases

Buys the membership with the given membershipType.

# Tools

The Commercio SDK, our own open source tool to format transactions to Commercio.network.

# Functions and APIs

  • MembershipHelper buyMembership.

# Step by step sequence

  1. Execute the MembershipHelper buyMembership function to buy a membership.

# Code Examples

Here's an example of the implemetation in all the available languages.

# Dart

await MembershipHelper.buyMembership(
  MembershipType.BRONZE, wallet
);
1
2
3

# Kotlin

val mode = TxHelper.BroadcastingMode.BLOCK // optional
val fee = StdFee(gas = "200000", amount = listOf(StdCoin(denom = "ucommercio", amount = "10000"))) // optional

MembershipHelper.buyMembership(
  membershipType = MembershipType.BRONZE,
  wallet = wallet,
  fee = fee, //optional
  mode = mode //optional
)
1
2
3
4
5
6
7
8
9

# C#

static commercio.sacco.lib.NetworkInfo networkInfo = new commercio.sacco.lib.NetworkInfo(
                bech32Hrp: "did:com:",
                lcdUrl: "http://localhost:1317"
              );

String newUserMnemonicString = "push grace power desk arrive horror gallery physical kingdom ecology fat firm future service table little live reason maximum short motion planet stage second";
List<String> newUserMnemonic = new List<String>(newUserMnemonicString.Split(" ", StringSplitOptions.RemoveEmptyEntries));

var newUserWallet = commercio.sacco.lib.Wallet.derive(newUserMnemonic, networkInfo);

var res = commercio.sdk.MembershipHelper.buyMembership(
 commercio.sdk.MembershipType.GOLD,
 newUserWallet
);
1
2
3
4
5
6
7
8
9
10
11
12
13
14