Integrating with the API

👍

Endpoint Information:

https://api-sandbox.ca-dev.co/v2/omnichannel/send-link

Flow On The Customer's Device

Flow On The Merchant's Device (in-store only)

API Details

📘

What do I need in order to finish this step?

You would need to provide a Private API key provided by ChargeAfter for this step to work.

The ChargeAfter's omnichannel API as described should be invoked on the serverside (Server to Server).

The call should include:

  • Customer information (required)
  • Cart information (only for the checkout flow)

Request

curl https://api-sandbox.ca-dev.co/v2/omnichannel/send-link \
    -X POST \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer private-api-key' \
    -d '{
   
    channel: "call_center", //"in_store", "e_commerce"
    flow: "apply", // or "checkout"
    storeId: "", // Optional store id
    posType: "", // Optional POS type: "GenericConsumerDevice", "GenericMerchantDevice", "SelfServiceTerminal"
    posId: "", // Optional POS identifier
          
    consumerDetails: { 
        firstName: "John", 
        lastName: "Doe",
        email: "[email protected]",  
        mobilePhoneNumber: "2124445555", 
        merchantConsumerId: "merchant-internal-consumer-id",
        shippingAddress: {
            line1: "3 My Street",
            line2: "My Building, 4th floor",
            city: "New York",
            zipCode: "10019",
            state: "NY"
        },
        billingAddress: {
            line1: "3 My Street",
            line2: "My Building, 4th floor",
            city: "New York",
            zipCode: "10019",
            state: "NY"
        }
    },
      
    createCharge: false, // Optional, if true will create a Charge on approval
    
    sendUsing: "email", // send an email (from ChargeAfter domain) with a link to launch the experience
      // "redirectUrl" - return a link to launch the experience (Merchant is responsible to send)
      // "scriptUrl" - return a script that opens the experience (to be directly loaded into the browser)
    
    // Required if flow == "checkout"
    cartDetails: {
        items: [
            {
                name: "Awesome Product",
                price: 1999.0,
                sku: "AWSMPRDCT",
                quantity: 2,
                leasable: true,
                productCategory: "Product category",
                warranty: {
                    name: "Awesome Warranty",
                    price: 100.0,
                    sku: "AWSMWRNTY"
                }
            }
        ],
        discounts: [
            {
                name: "Birthday discount",
                amount: 20
            }
//If no discount amount then should not be added to the cartDetails.
        ],
        taxAmount: 199.0,
        shippingAmount: 19.0,
        totalAmount: 4296.0
    },
    
    merchantOrderId: "", // Optional field for merchant use,
    correlationId: "", // Optional id. is reflected in responses and postbacks 
      
    requestedLoanAmount: 300, // optional field to suggest a desired loan amount
      
    tags: {}, // Optional key-value object. Each tag has a name and optional primitive value.
      // Tags are reflected in responses and postbacks, used in rules and analytics
    
    finalPostbackURL: "https://yourFinalPostBackURL.com", // Required for checkout flow, optional for apply
    dataUpdatePostbackURL: "https://yourDataUpdatePostBackURL.com", // Optional
    postbackAuthKey: "<UUID>", // A bearer authentication key that will be passed in postback calls
    redirectOnSuccessURL: "https://merchant.com/financing/approved", // merchant page to show if financing was approved
    redirectOnFailureURL: "https://merchant.com/financing/declined", // merchant page to show if financing was not approved
}

The Consumer Details Object
The Cart Details Object

Details on the Postback URLs can be found in the next sections.

Response:

{
	success: "true",
  tags: {}, // as specified in the request
  correlationId: "", // as specified in the request
  statusTrackingId: "<UUID>"
}

redirectOnFailureURL

When the redirectOnFailureURL is being called, the specific error code & the associated message would be provided via the querystring section.

  • code - the error code
  • message - text that describes the error

The different error codes are described at the Error section at https://docs.chargeafter.com/docs/the-apply-completion-callback.

Link session status

Retrieving the updated status of a specific omnichannel link session can be done using the status API endpoint which is described at status request