Braintree API returns various internal IDs to business objects including IDs of Subscription
, Plan
, PaymentMethod
, and such. Are there any security issues in sharing these IDs with end-users' applications (the front-end code running on users' devices)? (The end-user would not see these IDs, but they would be transmitted through the wire.)
Detailed example:
The user adds a payment method to the App. The App server forwards the request to Braintree, for example:
val result = gateway.paymentMethod.create(
new PaymentMethodRequest()
.customerId(user.billing.get.braintree.customerID)
.paymentMethodNonce(nonce)
.billingAddressId(user.billing.get.braintree.addressID.get)
.options()
.makeDefault(true)
.verifyCard(true)
.failOnDuplicatePaymentMethod(false)
.done()
)
Then the result is handled as follows:
Option(result.getTarget)
.map {
case card: CreditCard =>
braintreePaymentMethod(
card.getClass.getCanonicalName,
card.getToken,
card.getImageUrl,
card.isDefault,
"ending " + card.getLast4
)
}
.getOrElse(throw Payments.Exception.Braintree(result.getMessage))
The card.getToken
returns the payment method's token as in interface:
public interface PaymentMethod {
String getToken();
boolean isDefault();
String getImageUrl();
String getCustomerId();
List<Subscription> getSubscriptions();
}
The above token acquired by getToken
is then used to check the existence of the payment method, moreover, used to remove, list and update the method.
Internally, in the App, this token could also be used to identify the payment method.
Recap: Are there any security issues to share this token with the user?