---
page_title: Handling callbacks
product: HyperCredit
platform: Web
page_source: https://juspay.io/in/docs/hyper-credit/web/hyper-explorer/handling-callbacks
llms_txt: https://juspay.io/in/docs/llms.txt
product_llms_txt: https://juspay.io/in/docs/hyper-credit/llms.txt
---


# **Handling callbacks (Exploration)** 



A callback will be provided to merchants in the following format.


#### **eventData** 




| Field | Type | description | Mandatory |
|---|---|---|---|
| event | String | Handle only in case event (“process_result”) | Yes |
| payload | Stringified JSON | payload | Yes |



#### **payload** 




| Field | Type | description | Mandatory |
|---|---|---|---|
| event_type | String | login | checkout | authentication_failed | exit_app | Yes |
| checkout_payload | Stringified Json | checkoutPayload | No |
| action | String |  | No |



#### **checkoutPayload** 




| Field | Type | description | Mandatory |
|---|---|---|---|
| selected_loan_offer_payload | Stringified Json | In case user selects easy emi and event is checkout | No |
| payment_filter | Stringified Json | In case event is checkout | No |



## Following response will be provided for different event_type:




#### Login:



This is for non logged in flow and shall be triggered in case customer_id is not passed. In this case the merchant needs to get the user logged in and needs to process the widget again with a new payload containing customer_id and phone number.


#### Sample Payload Code Snippet:

```sample payload
{
   "event": "process_result",
   "payload": {.1
       "event_type": "login"
   }
}
```



#### Script Code Snippet:

```script
affordabilityExplorer.start(processPayload, explorerCallbackHandler)
```



#### **checkout:** 



This event will be triggered when the user selects an EMI plan. The Merchant shall create order on their system by utilizing payload.payment_filter  received in callback. This payload shall be passed by the merchant during the checkout phase.In case a merchant is using session API to create order on Juspay end, it needs to pass payment_filter and selectedLoanOfferPayload received in callback in session API.


#### Sample Payload Code Snippet:

```sample payload
"event": "process_result",
   "payload": {
       "event_type": "checkout",
       "payment_filter": "{\"selectedEmiPlan\":{\"showOnlyNoCost\":null,\"showOnlyAutoPay\":null,\"mandateConsent\":true,\"emiPlanData\":{\"paymentMethodType\":\"CARD\",\"paymentMethod\":\"CARD\",\"issuer\":{\"tenures\":[{\"txnEmiType\":\"STANDARD_EMI\",\"totalMonthlyAmountPayable\":\"3411.41\",\"totalInterestAmount\":\"234.23\",\"totalInstantDiscountAmount\":null,\"totalCashbackAmount\":null,\"totalAmountPayable\":\"10234.23\",\"tnc\":null,\"tenure\":3,\"supportedGateways\":[{\"supportedFeatures\":null,\"gatewayId\":12,\"gateway\":\"PAYU\"}],\"scheduleOfCharges\":null,\"productDetails\":null,\"otherPaymentInfo\":null,\"offerIds\":null,\"kfsLink\":null,\"interestDiscountAmount\":null,\"bankInterestRate\":\"14.00\",\"additional_processing_fee_info\":{\"userMessage\":\"199 + GST is Applicable\",\"gst\":\"35.82\",\"fee\":\"199.00\"},\"additionalProcessingFee\":\"234.82\",\"additionalDiscountAmount\":null}],\"tenure1\":\"\",\"juspayBankCode\":\"JP_AMEX\",\"issuerName\":\"American Express\",\"emiBank\":\"AMEX\"}},\"emiFlowPlansType\":\"STANDARD_EMI\",\"emiFlowPlans\":\"CREDIT\"}}",
       "action": "paymentPage"
   }
}

```



#### **authentication_failed:** 



This is passed when the client auth token expires. In this case the merchant needs to generate a new client auth token and process the SDK again.


#### Sample Payload Code Snippet:

```sample payload
{
   "event": "process_result",
   "payload": {
       "event_type": "authentication_failed"
   }
}
```



#### Shell Code Snippet:

```shell
affordabilityExplorer.start(processPayload, explorerCallbackHandler)
```



#### **exit_app:** 



In this case the widget has exited. Merchant can terminate the SDK instance if it wants.This can occur if in case for a product we don’t have any emi_plans or some unexpected error occurs.If this happens then the merchant can remove the widget div from the dom.


#### Sample Payload Code Snippet:

```sample payload
{
   "event": "process_result",
   "payload": {
       "event_type": "exit_app"
   }
}

```



#### Script Code Snippet:

```script
affordabilityExplorer.terminateExplorer()
```


---

## See Also

- [Payload](https://juspay.io/in/docs/hyper-credit/web/hyper-explorer/payload)
- [Generic](https://juspay.io/in/docs/hyper-credit/web/request-payloads/generic)
