Zain Iraq
Two Click Integration with your Landing or Payment Page
Two Click is allowed in a small number of cases using Header Enrichment which incorporates fraud prevention mechanisms.
Flow
A typical flow would be:
- User is directed to your landing page
- On the landing page include the SLA fraud script which will return a Token.
- Redirect to SLA using the token as a query param.
- SLA will handle the fraud detection, 2nd page submission and attempt to subscribe the user.
Step by Step Guide
- Direct the user to your Landing or Payment Page. Include a form with the following hidden inputs:
<form>
<input type="hidden" name="transaction_id" value="< Create a unique transaction ID >">
<input type="hidden" name="redirect_url" value="< Your Redirect Url >"
<input type="hidden" name="merchant" value="< Your merchant URI >"
<input type="hidden" name="service" value="< Your campaign URI >"
<input type="submit" id="continue" value="subscribe" />
<input type="hidden" name="confirm" value="false">
</form>
Include the following Javascript immediately before the closing body tag of your page.
<script>
window.onload = function () {
var ids = {
form: "purchase_form",
confirm_button: "form_submit_btn",
cancel_button: "form_cancel_btn",
};
var partner = "< your partner uri >";
var service = "< your campaign uri >;
const detector = new Detector(ids, partner, service);
detector.setup();
var form = document.getElementById(ids["form"]);
form.addEventListener("submit", function (e) {
e.preventDefault();
function fraudDetectorLoaded() {
var loaded = document.getElementById("fraudDetectorIsLoaded");
if (loaded && loaded.value == "yes") {
form.submit();
} else if ("requestIdleCallback" in window) {
var submit = document.getElementById(ids["confirm_button"]);
submit.setAttribute("disabled", true);
submit.setAttribute("value", "Loading...");
requestIdleCallback(fraudDetectorLoaded);
} else {
var submit = document.getElementById(ids["confirm_button"]);
submit.setAttribute("disabled", true);
submit.setAttribute("value", "Loading...");
setTimeout(fraudDetectorLoaded, 100);
}
}
fraudDetectorLoaded();
});
};
</script>
- A TOKEN is made available via the SLA script and will be appended to the form as a hidden input as follows:
<input type="hidden" name="token" value="123abcexample1e6bdcff-9fee-4764-ab7f-4f23934625be">
Info
A token is only valid for two minutes.
-
User submits form, redirect to: http://checkout.sla-alacrity.com/mcp_click_he/redirect?merchant={merchant_uri}&service={service_uri}&redirect_url={url}&transaction_id={string}&token={returned fraud token}
-
SLA handles fraud detection check. A second confirmation page will shown to the user. Once user clicks the button, SLA will redirect back to Merchant using the provided redirect URL.
Example: {redirect_url}?status=success&transaction_id={string}&msisdn={msisdn}
Example: {redirect_url}?status=error&message{reason for failure}&transaction_id={correlator}&msisdn={msisdn} -
If the redirect has status error, you should fall back to PIN SMS flow.
-
Welcome SMS
After a customer subscribes it is required that a merchant send a welcome SMS with the details of how to access a service. This reduces the likelihood of a customer losing access to the service thereby reducing customer complaints.
Please review the Send SMS API usage page for details.
Error Handling
If the status is error then message will contain the reason for the error. Some possible values for message can be seen here.
Message | Description |
---|---|
NoHe | Header Enrichment is not available and you should redirect the customer to your PIN flow experience |
Subscriptions Exceeded | The customer can only subscribe once within a 24 hour period. |
Transaction Not Found in System | This is caused when the token is invalid |
All HTTP request parameters should be passed in URL Query String - query_params.