# Retrieve card metadata Use the `onCardBinChanged` event to monitor the card details provided by the customer in real time. This enables you to customize the payment session with the data collected and implement more complex processes. For example, if you want to: - Add custom logic depending on the card scheme. - Modify the payment amount based on additional checkout information. For example, a promotional code or a shipping address that incurs additional delivery fees. > **Information** > > Follow the [Getting started with Flow for mobile](https://www.checkout.com/docs/payments/accept-payments/accept-a-payment-on-your-mobile-app/get-started-with-flow-for-mobile.md) guide before you update your integration with the steps outlined on this page. Add the event to the initialization code for your Flow for mobile configuration. Implement the event logic to customize the payment flow depending on the card details the customer enters. For example, the following code creates branching logic depending on the card scheme detected and rejects credit card payments: **Android** ```java val callbacks = ComponentCallback( onCardBinChanged = { cardMetadata -> // Apply custom logic based on card scheme when (cardMetadata.scheme) { "visa" -> { // apply custom logic for Visa cardholders } "mastercard" -> { // apply custom logic for Mastercard cardholders } else -> { // default case } } // Reject credit cards if (cardMetadata.cardType == "credit") { CallbackResult.Rejected("Credit cards are not accepted.") } else { // Otherwise, proceed with the payment CallbackResult.Accepted } } ) val configuration = CheckoutComponentConfiguration( componentCallback = callbacks ) ``` **iOS** ```swift let callbacks = CheckoutComponents.Callbacks(...onCardBinChanged: { cardMetadata -> CheckoutComponents.CallbackResult in // Apply custom logic based on card scheme switch cardMetadata.scheme { case "visa": // apply custom logic for Visa cardholders break case "mastercard": // apply custom logic for Mastercard cardholders break default: break } // Reject credit cards if cardMetadata.cardType == "credit" { return .rejected(message: "Credit cards are not accepted.") } // Otherwise, proceed with the payment return .accepted }...) let configuration = CheckoutComponents.Configuration(..., callbacks: callbacks) ``` ## Add the handleSubmit event `Client side` The `handleSubmit` [event](https://www.checkout.com/docs/payments/accept-payments/accept-a-payment-on-your-mobile-app/flow-for-mobile-library-reference/ios/componentcallback.md#handleSubmit(SessionData)_:_APICallResult) enables you to submit a modified payment session. Add the event to the initialization code for your Flow for mobile configuration. Implement the callback logic to provide the payment submission data to your server-side integration: **Android** ```java suspend fun handleSubmit(sessionData: SessionData): ApiCallResult { handlePaymentSubmission() } val callback = ComponentCallback(handleSubmit = ::handleSubmit) ``` **iOS** ```swift let callbacks = CheckoutComponents.Callbacks(...handleSubmit: handleSubmit) let configuration = CheckoutComponents.Configuration(..., callbacks: callbacks) ``` --- ## Submit the modified payment session `Server side` Call the [Submit a payment session](https://api-reference.checkout.com/tag/Flow/#operation/SubmitPaymentSession) endpoint and provide the payment session ID as the `{id}` path parameter. In your request, provide the payment session data from the `handleSubmit` event in `session_data`. You can also modify any of the following fields: - `3ds` - `amount` - `items` - `reference` > **Information** > > Your base URL's `{prefix}` value is unique to your account and environment. To learn how to retrieve your base URLs for the sandbox and production environments, see [API endpoints](https://www.checkout.com/docs/developer-resources/api/api-endpoints.md). **Production** `POST` `https://{prefix}.api.checkout.com/payment-sessions/{id}/submit` **Sandbox** `POST` `https://{prefix}.api.sandbox.checkout.com/payment-sessions/{id}/submit` ### Request example ```json { "session_data": "{SESSION_DATA_FROM_FLOW}", "3ds": { "enabled": true } } ``` ### Response example ```json { "id": "pay_f2ws3hn4ijquzbytp3v5lsfxge", "status": "Action Required", "type": "card", "action": { "type": "3ds", "url": "http://3ds2.checkout.com/interceptor/sid_y3oqhf46pyzuxjbcn2giaqnb44" } } ``` --- ## Handle the payment response `Client side` You must provide the unmodified response to the `handleSubmit` event in the client-side integration. Flow handles any additional required actions.