PIN Management USA
PIN management in the USA is managed by the processor through web views.
There is no customization available with these views.
Steps
Step 1
Initiate PIN Change
POST {{teller}}/api/v1/card_issuing/accounts/:account_id/pin/direct_render
Response:
{
"url":"https://..."
}
Step 2
Present the web view to the user.
Use the URL returned in the previous step.
Step 3
Handle the verdict
After the user sends their pin change request the processor will respond with one of the following codes:
Status code | Description | Next steps |
0 | Success | Continue the procedure |
-1 | Bad submitter ID or no redirect URL provided | Retry with valid submitter ID or provide redirect URL |
-10 | Invalid token. Token is either expired or not found. | Verify that the token is correct or call the get token endpoint again. |
-11 | Cardholder submitted a form with a token that is no longer valid, because Get Card PIN Change Key was called again, invalidating the previous key. | Verify that the form is using the correct key before calling the get token endpoint again. |
-999 | System error | Contact Berkeley for troubleshooting |
-9999 | Unknown error | Contact Berkeley for troubleshooting |
Step 4
Commit the change if successful.
{{domain}}/api/v1/card_issuing/accounts/:account_id/pin/commit
Note: The PIN will not be changed until commit is called.
Examples
Android (Kotlin)
class MainActivity : AppCompatActivity() {
lateinit var webView: WebView
@SuppressLint("SetJavaScriptEnabled")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
webView = WebView(this)
setContentView(webView)
webView.settings.javaScriptEnabled = true
webView.addJavascriptInterface(WebAppInterface(this), "Android")
webView.webChromeClient = WebChromeClient()
webView.webViewClient = WebViewClient()
webView.loadUrl("https://....")
}
override fun onResume() {
super.onResume()
}
class WebAppInterface(private val context:Context) {
@JavascriptInterface
fun postMessage(code: Int) {
Toast.makeText(context, "Received code $code", Toast.LENGTH_LONG).show()
}
}
}
iOS (Swift)
class ViewController: UIViewController, WKScriptMessageHandler, WKNavigationDelegate {
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
print(message.body);
}
override func viewDidLoad() {
super.viewDidLoad();
let preferences = WKPreferences();
preferences.javaScriptEnabled = true;
let contentController = WKUserContentController();
contentController.add(self, name: "IOS");
let config = WKWebViewConfiguration();
config.preferences = preferences;
config.userContentController = contentController;
let url = URL(string: "https://...");
let webview = WKWebView(frame:
self.view.bounds, configuration: config); self.view.addSubview(webview);
webview.navigationDelegate = self
webview.load( URLRequest( url: url!) );
}
func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) {
webView.evaluateJavaScript("document.documentElement.outerHTML.toString()",
completionHandler: { (html: Any?, error: Error?) in
print(html!)
});
}
}
Updated over 2 years ago