Commerce Connect - API Document
Steps to integrate the 'FDPaymentSDK.framework'
Step - 1 Import SDK into your Project
- Make sure Copy items if needed check box and Add to targets is also checked.
- Download the framework file from the above url.
- Open your project in xcode drag and drop the downloaded FDPaymentSDK.framework file into the Project folder.
- Make sure Copy items if needed check box and Add to targets is also checked.
- Click Finish.
- Click on Project name -> in general Tab make sure you added FDPaymentSDK.framework in Embedded Binaries and Linked Frameworks and Libraries.
Step - 2 Add Run script phase
- Click on Build Phases and add new Run script phase. Expand it and add the below
script. This will be used to debug the build in device.
pushd ${TARGET_BUILD_DIR}/${PRODUCT_NAME}.app/Frameworks/FDPaymentSDK.framework/Frameworks for EACH in *.framework; do echo "-- signing ${EACH}" /usr/bin/codesign --force --deep --sign "${EXPANDED_CODE_SIGN_IDENTITY}" --entitlements "${TARGET_TEMP_DIR}/${PRODUCT_NAME}.app.xcent" --timestamp=none $EACH done
- Add the following Run script phase only when archive or distribute the build.
(Note: If you don't want to add this script repetitively when releasing build, add
the script and click the check box 'Run script only when installing' below the
script area in xcode.)
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}" find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK do FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable) FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME" echo "Executable is $FRAMEWORK_EXECUTABLE_PATH" EXTRACTED_ARCHS=() for ARCH in $ARCHS do echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME" lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH" EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH") done echo "Merging extracted architectures: ${ARCHS}" lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}" rm "${EXTRACTED_ARCHS[@]}" echo "Replacing original executable with thinned version" rm "$FRAMEWORK_EXECUTABLE_PATH" mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH" done
Step - 3 Merchant app Implementation to
integrate SDK
- In the View controller which requires payment integration, add 'import FDPaymentSDK'
at the top.
import FDPaymentSDK
- Add 'FDPaymentDelegate' protocol to your view controller class and add below 3
required methods. You will receive the transaction status from the SDK through any
of these methods.
// payment success func onPaymentSuccess(code: String?, andData data: FDPaymentResult?) { } // payment failed func onPaymentError(code: String?, andData data: FDPaymentResult?) { } // payment cancelled func onPaymentCancelByUser(code: String?, andData data: FDPaymentResult?) { }
Step - 4 Initiate Payment
- Create instance of FDPaymentSDK class and initialize with sessionId, configId and
delegate (set delegate as self). Please refer attached sample project code to
generate session token.
let fdPaymentSDK = FDPaymentSDK(sessionId: sessionTokenId, andConfigId: txtPageId.text , delegate: self)
- Create instance of FDPaymentSDK class and initialize with sessionId, configId and
delegate (set delegate as self)
let theme = FDColorTheme(navigationBarColor: Color.shared.navigationBarColor.color, primaryColor: Color.shared.primaryColor.color, secondaryColor: Color.shared.secondaryColor.color, accentColor: Color.shared.accentColor.color, accentInActiveColor: Color.shared.accentInactiveColor.color, descriptionColor: Color.shared.descriptionColor.color, separatorColor: Color.shared.separatorColor.color, linkColor: Color.shared.linkColor.color, errorColor: Color.shared.errorColor.color)
- Call initSDK method with instance of FDPaymentSDK and pass sender and theme. This
will navigate to the SDK payment page.
do {
try fdPaymentSDK.initSDKWithColorTheme(sender: self, colorTheme: colorTheme)
} catch let error {
print(error.localizedDescription)
}
Step - 5 Add exception domains (given
below) in the info.plist
NSAppTransportSecurity
NSAllowsArbitraryLoads
NSExceptionDomains
merchanthubtest.fssnet.co.in
NSExceptionRequiresForwardSecrecy
NSIncludesSubdomains
test.fdmerchantservices.com
NSExceptionRequiresForwardSecrecy
NSIncludesSubdomains
Download
Commerce Connect Integration Pack | |
---|---|
FD Connect IOS Swift | Integration Pack Please Sign In to download |
Integration Pack
Please Sign In to download