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")
}
@StateObject private var controller = CardNumberInputController(btApiKey: sessionToken)
CardNumberInput(
controller: controller,
onSuccess: { tokenId in
// Send tokenId to your server
}
)
Button("Save Card") {
controller.tokenize()
}
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
| Field | Type | Required | Description |
|---|
tokenId | string | Yes | The PAN token ID returned by the mobile SDK. |
externalUserId | string | Yes | Your identifier for the customer. |
Response
| Field | Type | Description |
|---|
paymentMethodId | string | A unique identifier for the payment method. Store this to create payments. |
Node.js
Python
Kotlin
Java
const paymentMethod = await client.payment.createMethod({
tokenId: "tok_abc123",
externalUserId: "user_12345",
});
// Store paymentMethod.paymentMethodId for future payments
console.log(paymentMethod.paymentMethodId);
payment_method = client.payment.create_method(
token_id="tok_abc123",
external_user_id="user_12345",
)
# Store payment_method.payment_method_id for future payments
print(payment_method.payment_method_id)
val paymentMethod = client.payment().createMethod(
PaymentCreateMethodParams.builder()
.tokenId("tok_abc123")
.externalUserId("user_12345")
.build()
)
// Store paymentMethod.paymentMethodId() for future payments
println(paymentMethod.paymentMethodId())
var paymentMethod = client.payment().createMethod(
PaymentCreateMethodParams.builder()
.tokenId("tok_abc123")
.externalUserId("user_12345")
.build()
);
// Store paymentMethod.paymentMethodId() for future payments
System.out.println(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.