-
Notifications
You must be signed in to change notification settings - Fork 54
Register Card
Farhan Yuda Pahlevi edited this page Nov 7, 2018
·
3 revisions
Register card is a feature to allow customer save credit card token without doing transactions.
This feature is only enabled on core SDK only.
To implement it, you can use below code.
MidtransSDK.getInstance().cardRegistration(cardNumber, cvv, expiryMonth, expiryYear, new CardRegistrationCallback() {
@Override
public void onSuccess(CardRegistrationResponse response) {
String savedTokenId = response.getSavedTokenId();
String maskedCard = response.getMaskedCard();
}
@Override
public void onFailure(CardRegistrationResponse response, String reason) {
// Handle failure here
}
@Override
public void onError(Throwable error) {
// Handle error here
}
});
Notes:
- Card expiry consists of
expiryMonth
andexpiryYear
. Both areString
and should follow this format : 2 digit forexpiryMonth
(for example : "02"), and 4 digit forexpiryYear
(for example : "2020"). - CVV is
String
too, with number of digit between 3 or 4, based on card. Mastercard, Visa, or JCB usually has 3 digit CVV, while American Express has 4. - Number of digit for expiryMonth (example : it must be 2 digits) Reason : there is an error while merchant try to input 1 digit for this parameter, but there is no clue what’s gone wrong regarding the code.
- Number of digit for expiryYear (example : it must be 4 digits)
- Number of digit for cvv (example : it must be 3 digits)