All notable changes to the SDK are documented in this file.
- Added categories field to item in checkout request
- Bug-fixes
- Bug-fixes
- Support international integration
- Support description on Accessible mode
- Bug-fixes
- Bug-fixes
- Added logging
- Bug-fixes
- Added support for changing public key and merchant name
- Updated the Affirm Branding
- Bug-fixes
- Start checkout in a Fragment
- Add Client Middleware
- Bug-fixes
- Chromium bug fix
- Improved critical error handling
- Added support for VCN authorization window
- Enhancements and updates to Promotional Messaging
- Bug-fixes
- Added support for CaaS identifier in standard and VCN checkout
- Improved excpetion handling
- Support for SKU based financing programs
- Bug-fix
- Added HTML support to build custom webviews
- Promotional message is called outside of lifecycle
- Metadata is an optional custom object
- Bug-fix
- Add backend support for VCN
- Change promos call to hit base url
- Add metatdata examples
- Remove promo ID from example code
- Fix unnecessary connection exception
- Update logos
- Fix Affirm color type white not working
- Fix drawable colors
- Add support for webhook session IDs
- Add support for Canadian checkouts
- Support for Blue and Black logo in text
- Page type for independent modals
- Add landscape mode
- Use BigDecimal with currency
- Bug Fix for null data exception on back - button
- Convert requests to not use Async Task
- Support type face, text size, and text color for promo messaging
- Support local fonts
- Handle empty ALA messages
- Shipping/Billing consistent with direct API requirements
- Add reason codes for VCN checkout cancellation
- Updated modal configuration
- Custom CSS support in ALA messaging
- ALA messaging webviews
- ALA messaging logo and color support
- Add the Order Id to the checkout
- Support
htmlStyling
with AffirmPromotionButton - request code can be set in the builder in order to prevent conflicts
- Add initialized constructor, only contains publicKey
- Added page type
- Added session cookie
- Added method to remove cookies
- Added
AffirmHttpClient
to handle all http requests and responses. Unified error handling.AffirmHttpResponse execute(final AffirmHttpRequest request, boolean sendTrackEvent) throws APIException, PermissionException, InvalidRequestException, ConnectionException { Request okHttpRequest = getRequest(request); Call call = mOkHttpClient.newCall(okHttpRequest); try { Response response = call.execute(); boolean responseSuccess = response.isSuccessful(); if (!responseSuccess && sendTrackEvent) { AffirmTracker.track(NETWORK_ERROR, ERROR, createTrackingNetworkJsonObj(okHttpRequest, response)); } final Headers headers = response.headers(); String requestId = headers.get(X_AFFIRM_REQUEST_ID); if (response.code() < 200 || response.code() >= 300) { ResponseBody responseBody = response.body(); final AffirmError affirmError = AffirmPlugins.get().gson() .fromJson(responseBody != null ? responseBody.string() : "", AffirmError.class); handleAPIError(affirmError, response.code(), requestId); } return getResponse(response); } catch (IOException e) { if (sendTrackEvent) { AffirmTracker.track(NETWORK_ERROR, ERROR, createTrackingNetworkJsonObj(okHttpRequest, null)); } throw new ConnectionException("i/o failure", e); } }
- All Affirm API requests are in
AffirmApiHandler
now
public static final int LOG_LEVEL_VERBOSE = Log.VERBOSE;
public static final int LOG_LEVEL_DEBUG = Log.DEBUG;
public static final int LOG_LEVEL_INFO = Log.INFO;
public static final int LOG_LEVEL_WARNING = Log.WARN;
public static final int LOG_LEVEL_ERROR = Log.ERROR;
public static final int LOG_LEVEL_NONE = Integer.MAX_VALUE;
You can set an appropriate LogLevel for the SDK. Reminder: set this to LOG_LEVEL_NONE
for the final production build.
- Refactor tracker related logic
publicKey
andenvironment
are required when initializing Affirm.setMerchantName
is an optional step when initializing Affirm.- Added optional
LogLevel
to set log level - Example for configuration and init
Affirm.initialize(new Affirm.Configuration.Builder("Y8CQXFF044903JC0", Affirm.Environment.SANDBOX)
.setMerchantName(null)
.setLogLevel(Affirm.LOG_LEVEL_DEBUG)
.build()
);
- Added
AffirmPromotionButton
class, you can declare it in anxml
file or create it directly vianew
. You can then set thepromoId
(optional),pageType
(optional) andamount
values with theconfigureWithAmount
method.
<com.affirm.android.AffirmPromotionButton
android:id="@+id/promo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/price"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:textSize="16sp"
app:affirmColor="AffirmColorTypeBlue"
app:affirmLogoType="AffirmDisplayTypeLogo"/>
or
AffirmPromotionButton affirmPromotionButton = new AffirmPromotionButton(this);
AffirmPromotionButton.setAffirmColor(AffirmColor.AFFIRM_COLOR_TYPE_BLUE);
AffirmPromotionButton.setAffirmLogoType(AffirmLogoType.AFFIRM_DISPLAY_TYPE_LOGO);
Affirm.configureWithAmount(affirmPromotionButton, null, PromoPageType.PRODUCT, 1100, true);
- Added optional
PrequalCallbacks
, you can catch prequalfailure
through this callback.
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
if (Affirm.handlePrequalData(this, requestCode, resultCode, data)) {
return;
}
super.onActivityResult(requestCode, resultCode, data);
}
@Override
public void onAffirmPrequalError(String message) {
Toast.makeText(this, "Prequal Error: " + message, Toast.LENGTH_LONG).show();
}
- Checkout Flow (direct + VCN)
- Both checkout and VCN checkout now use the unified method
startCheckout
, differentiated by the boolean parameteruseVCN
.
- Both checkout and VCN checkout now use the unified method
Affirm.startCheckout(this, checkout, false);
final AffirmTrack affirmTrack = AffirmTrack.builder()
.setAffirmTrackOrder(affirmTrackOrder)
.setAffirmTrackProducts(affirmTrackProducts)
.build();
Affirm.trackOrderConfirmed(MainActivity.this, trackModel());
- Added custom exceptions,
APIException
,ConnectionException
,InvalidRequestException
,PermissionException
to distinguish between different error types.
- Activity indicator that is automatically added/dismissed to denote loading state when presenting checkout or prequal