On This Page

{#jumplink-list}  
[Markdown](/docs/vas/en-us/digital-accept-flex/developer/all/rest/digital-accept-flex/uc-intro/uc-appendix/uc-appendix-uc-examples/uc-appendix-uc-sale-dm-intro.md)  
Filter  
FILTER BY TAG

`Unified Checkout` with Sale and `Decision Manager` {#uc-appendix-uc-sale-dm-intro}
===================================================================================

This section contains the capture context and JavaScript examples to integrate `Unified Checkout` into your e-commerce page. You can use these examples to collect your customer's payment information and process a sale while also invoking the `Decision Manager` fraud solution. Before the sale is initiated, `Decision Manager` is invoked for fraud screening.  
For information on the capture context, see [Capture Context API](/docs/vas/en-us/digital-accept-flex/developer/all/rest/digital-accept-flex/uc-intro/uc-setup-capture-context.md "").

Example: `Unified Checkout` with Sale and `Decision Manager` {#uc-appendix-uc-sale-dm-ex}
=========================================================================================

Capture Context Request

```
{
  "targetOrigins" : [ "https://test.com" ],
    "clientVersion": "0.34",
    "buttonType": "CHECKOUT_AND_CONTINUE",
    "allowedCardNetworks": [
        "VISA",
        "MASTERCARD"
    ],
    "allowedPaymentTypes": [
        "PANENTRY",
        "CLICKTOPAY",
        "APPLEPAY",
        "GOOGLEPAY"
    ],
    "completeMandate": {
        "type": "CAPTURE",
        "decisionManager": true
        },
        "country": "US",
    "locale": "en_US",
    "captureMandate": {
        "billingType": "FULL",
        "requestEmail": true,
        "requestPhone": true,
        "requestShipping": true,
        "shipToCountries": [
            "US",
            "GB"
        ],
        "showAcceptedNetworkIcons": true
    },
"data":
 {
    "orderInformation": {
        "billTo": {
            "country": "US",
            "firstName": "NEW",
            "lastName": "Test",
            "phoneNumber": "1234567890",
            "address2": "Desk M3-5573",
            "address1": "901 Metro Center Blvd",
            "buildingNumber": "150",
            "postalCode": "94404",
            "locality": "Foster City",
            "administrativeArea": "CA",
            "email": "test@example.com"
        },
        "shipTo": {
            "country": "US",
            "firstName": "NEW",
            "lastName": "Test",
            "address2": "Desk M3-5573",
            "address1": "901 Metro Center Blvd",
            "buildingNumber": "150",
            "postalCode": "94404",
            "locality": "Foster City",
            "administrativeArea": "CA"
        },
        "amountDetails": {
            "totalAmount": "13.00",
            "currency": "USD"
        }
    },
    "clientReferenceInformation": {
      "code": "TAGX001"
    }
  }
}
```

{#uc-appendix-uc-sale-dm-ex_codeblock_c51_vmt_gwb}  
JavaScript

```
&lt;script type="text/javascript"&gt;
    const sidebar = true;
    const captureContext = document.getElementById("captureContext").value;
    const showArgs = {
      containers: { paymentSelection: "#buttonPaymentListContainer" }
    };
    
    async function launchCheckout() {
      try {
        const accept = await Accept(captureContext);
        const up = await accept.unifiedPayments(sidebar);
        const tt = await up.show(showArgs);
        const completeResponse = await up.complete(tt);
    
        console.log(completeResponse); // merchant logic for handling complete response
      } catch (error) {
        // merchant logic for handling issues
        console.error("something went wrong: " + error);
      }
    }

    // Call the function
    launchCheckout();
  &lt;/script&gt;
```

RELATED TO THIS PAGE

