Configuring the Client
The main and only entry point to using the Account Linking SDK is the AccountLinkingClient
class. You can instantiate one by passing an android
context to its constructor:
val client = AccountLinkingClient(context)
AccountLinkingClient client = new AccountLinkingClient(context);
There are also some more options for configuring the client.
Cutoff Day¶
-
Setting the
dayCutoff
property on theAccountLinkingClient
instance, i.e.:val client = AccountLinkingClient(context) client.dayCutoff = 14
AccountLinkingClient client = new AccountLinkingClient(context); client.dayCutoff(14);
This means that the orders from the last 14 days will be retrieved from the linked account. By default, the
dayCutoff
is set to 15 days. -
Setting the
dateCutoff
property on theAccountLinkingClient
instance, i.e.:val client = AccountLinkingClient(context) client.dateCutoff = Date.from(Instant.now().minus(14, ChronoUnit.DAYS))
AccountLinkingClient client = new AccountLinkingClient(context); client.dateCutoff(Date.from(Instant.now().minus(14, ChronoUnit.DAYS)));
This will also mean that orders from the last 14 days are retrieved, but you could also set a fixed date. By default, the
dateCutoff
value is set tonull
, then thedayCutoff
value will be used instead.
The first scrape will attempt to retrieve orders back to the dayCutoff
OR dateCutoff
. All subsequent scrapes will only go as far back as the last scrape date regardless of whether the first scrape completed.
- If the
dayCutoff
was set to 365 days (ORdateCutoff
equivalent to Date instance that is 365 days ago) BUT the first scrape only went as far back as day 100, then any subsequent scrapes will only return the latest orders within that 100 days.
Subsequent scrapes will continue to fetch historical orders until dayCutoff
OR dateCutoff
is reached, and after that, scrapes will only go back to the last scrape date.
- If the
dayCutoff
was set to 365 days (ORdateCutoff
equivalent to Date instance that is 365 days ago) BUT the first scrape only went as far back as 100 days, then subsequent scrapes would still attempt to get all of the orders within that 365 day window before starting to grab latest orders.
Latest Orders Only¶
The latestOrdersOnly
property specifies at what point the SDK stops searching for orders.
Example: dayCutoff
is set to 14 days, and you retrieve orders. After that, you set the dayCutoff
to 28 days. If latestOrdersOnly
is set to true,
you will only get orders which are newer than the latest order you received the first time.
If it is set to false
, you will also get orders which are older than those you got when retrieving orders with a 14 days cutoff, and at the same time
inside the 28-day window.
You can specify this with the latestOrdersOnly
property on the AccountLinkingClient
instance, i.e.:
val client = AccountLinkingClient(context)
client.latestOrdersOnly = false
AccountLinkingClient client = new AccountLinkingClient(context);
client.latestOrdersOnly(false);
The property latestOrdersOnly
is set to true
by default, which means you will only get orders newer than the most recent order you’ve received. If
it’s the first time you’re retrieving orders, you will get all orders inside the cutoff window.
Country Code¶
The countryCode
property specifies the code of the country in which the Account Linking SDK is used.
Setting it correctly improves lookup results for the returned products.
You can specify this with the countryCode
property on the AccountLinkingClient
instance, i.e.:
val client = AccountLinkingClient(context)
client.countryCode = "US"
AccountLinkingClient client = new AccountLinkingClient(context);
client.countryCode("US");
By default, it is set to "US"
.