Integrating with the API
Custom integrations are possible using ChargeAfter's omnichannel/send-link
API.
Sample flows are as follows:
Flow On The Customer's Device
Flow On The Merchant's Device (in-store only)
omnichannel/send-link Overview
A private API key (provided by ChargeAfter) must be included as a bearer token in the Authorization header for API calls to work. See Authentication.
ChargeAfter's omnichannel/send-link
API is invoked on the server side (communicating server to server).
Request Sample
Parameters are explained in the code sample below with additional parameter descriptions here .
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", "in_home", "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, it 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 the URL)
// 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 this should not be added to the cartDetails.
],
taxAmount: 199.0,
shippingAmount: 19.0,
totalAmount: 4296.0
},
currency: "USD", // Optional. The merchant may provide the checkout amount currency code (ISO 4217). Default currency is "USD".
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
}
Request Parameters
Required Request Parameters
consumerDetailsObject
- Required for both the Apply and Checkout flow. See consumerDetails Object.cartDetailsObject
- Required only for the Checkout flow. See cartDetails Object.finalPostbackURL
- Required for the Checkout flow, optional for Apply flow. See finalPostbackURL.
Error Codes for redirectOnFailureURL
When the redirectOnFailureURL
is called, the specific error code and the associated message is provided via the querystring section.
code
- the error codemessage
- text that describes the error
code | message | Type of action causing the error |
---|---|---|
BILLING_SHIPPING_MISMATCH | Billing and shipping address must be the same | Merchant-driven |
MISSING_CHECKOUT_DATA | Some of the required data is missing | Merchant-driven |
CREATE_CHECKOUT_FAILED | Checkout creation or merchant settings fetch failed | Merchant-driven |
PENDING | Application is pending | Lender-driven |
BACK_TO_STORE | Consumer clicked the Back to Store button | Customer-driven |
CONSUMER_CANCELLED | Consumer intentionally closed the Checkout UI | Customer-driven |
Postbacks
Postbacks are described in finalPostbackURLand dataUpdatePostbackURL.
Response Sample
{
success: "true",
tags: {}, // as specified in the request
correlationId: "", // as specified in the request
statusTrackingId: "<UUID>"
}
omnichannel/send-link Status
To retrieve the updated status of a specific omnichannel/send-link
session, use the status Request.
Updated 4 months ago