Skip to main content
A payment method represents a tokenized EBT card tied to a customer. Once created, you can reuse the same paymentMethodId across multiple payments without asking the customer to re-enter their card number.

How tokenization works

Card data never touches your servers. The mobile SDK tokenizes the card number securely, and your app receives a tokenId that your server exchanges for a permanent paymentMethodId via the Benny API.

Collect the card number

Use the CardNumberInput component from the Benny mobile SDK to render a secure card input field. When the user submits, the SDK tokenizes the card and returns a tokenId through the onSuccess callback.
val controller = rememberCardNumberInputController(btApiKey = sessionToken)

CardNumberInput(
    controller = controller,
    onSuccess = { tokenId ->
        // Send tokenId to your server
    },
)

Button(onClick = { controller.tokenize() }) {
    Text("Save Card")
}
For the complete component API, see the Android SDK or iOS SDK reference.

Create a payment method

Once your server receives the tokenId from the mobile app, call POST /v1/payment/method to create a payment method.

Request

FieldTypeRequiredDescription
tokenIdstringYesThe PAN token ID returned by the mobile SDK.
externalUserIdstringYesYour identifier for the customer.

Response

FieldTypeDescription
paymentMethodIdstringA unique identifier for the payment method. Store this to create payments.
const paymentMethod = await client.payment.createMethod({
  tokenId: "tok_abc123",
  externalUserId: "user_12345",
});

// Store paymentMethod.paymentMethodId for future payments
console.log(paymentMethod.paymentMethodId);

Reusing payment methods

A paymentMethodId is stable and works across multiple payment intents for the same customer. Store the ID in your database alongside the customer record so returning users can pay without re-entering their card details.
If a customer needs to use a different EBT card, repeat the tokenization flow to create a new payment method.