HƯỚNG DẪN TÍCH HỢP SDK VTC POS

CÀI ĐẶT CHO IOS

1. Development Environment: Minimum iOS target 8.0

Ghi chú: hỗ trợ cấu trúc armv7, armv7s, arm64 và các cấu trúc (+i368 và x86_64 cho máy ảo).

2. Tương thích thư viện

VTCPosSDK hỗ trợ các phiên bản từ iOS 8.0 trở lên. Hỗ trợ tất cả các cấu trúc gồm armv7, armv7s, arm64 và các cấu trúc +i368, x86_64 cho máy ảo

3.Công cụ Xcode

Chúng tôi sử dụng Xcode 9.0 tạo thư viện và project demo.Bạn có thể gặp lỗi khi sử dụng các phiên bản xcode thấp hơn. Chúng tôi khuyên bạn nên sử dụng những phiên bản xcode mới nhất.

4.Project Demo

Chúng tôi cung cấp một project demo giúp bạn dễ dàng sử dụng SDK này.

Cài đặt SDK cho project của bạn

1. Import thư viện vào project:

• Kéo thả VTCPosSDK.framework vào project của bạn. • Chọn “Create groups” và “Copy items if needed” để copy SDK vào project của bạn

Đăng Ký

2. Embedded Binaries framework:

Thực hiện như sau

Đăng Ký
Đăng Ký

3. Làm việc với SDK

• Với Swift
- Để hiển thị SDK VTC POS:
VTCPosSDKManager. sharedInstance().showSDK(from: viewController)
Trong đó:
o viewController: view controller để hiển thị SDK.
- SDK Delegate
Bạn cần kế thừa lại VTCPosSDKManagerDelegate để
nhận được kết quả sau khi thực hiện thanh toán.
Cài đặt lại phương thức của
VTCPosSDKManagerDelegate:
func vtcPosSDKManagerDidCompleted(withTransactionId transactionId: String?, error: String?) {
}
Trong đó:
o transactionId: ID của transaction sau khi thanh toán thành công.
o error: Lỗi trả về nếu có lỗi xảy ra khi thanh toán.
• Với Objective-C
- Để hiển thị SDK VTC POS:
[[VTCPosSDKManager sharedInstance] showSDKFrom:viewController];
Trong đó:
o viewController: view controller để hiển thị SDK.
- SDK Delegate
Bạn cần kế thừa lại VTCPosSDKManagerDelegate để
nhận được kết quả sau khi thực hiện thanh toán.
Cài đặt lại phương thức của
VTCPosSDKManagerDelegate:
-(void)VTCPosSDKManagerDidCompletedWithTransa ctionId:(NSString *)transactionId error:(NSString
*)error {
}
Trong đó:
o transactionId: ID của transaction sau khi thanh toán thành công.
o error: Lỗi trả về nếu có lỗi xảy ra khi thanh toán.

CÀI ĐẶT CHO ANDROID

1. Gradle Setup

1.1. Thêm thư viện: compile(name: 'sdkpos', ext: 'aar')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.squareup.retrofit2:retrofit:2.2.0'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.google.zxing:core:3.2.0'
compile 'com.mikhaellopez:circularimageview:3.0.2'
1.2. Mở file build.gradle (Module: Project) và thêm vào dòng sau: allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
flatDir {
dirs 'libs'
}
}
}

2. Add required code

SdkPos.getInstance().initSdk(MainActivity.this, new CallbackPayment() {
@Override public void onPaymentSuccess(PaymentModel paymentModel) {
Toast.makeText(MainActivity.this, "onPaymentSuccess " + paymentModel.getTransactionID(), Toast.LENGTH_LONG).show();
}
@Override public void onPaymentError(String error)
{
Toast.makeText(MainActivity.this, "onPaymentError " + error, Toast.LENGTH_LONG).show();
}
});
Trong đó:  MainActivity: context truyền vào  CallbackPayment: callback trả về khi thanh toán thành công  PaymentModel: model khi thanh toán thành công Gồm: - TransactionID (long): mã giao dịch khi thanh toán thành công

3. Proguard

Nếu dùng Proguard, thêm dòng code sau vào file proguard của bạn: -keepattributes Signature -keepattributes *Annotation*
-keep class com.vtc.sdkpaypos.** { *; }
-dontwarn com.vtc.sdkpaypos.**
-keep class android.content.** { *; }
-dontwarn android.content.**
-keep class android.support.** { *; }
-dontwarn android.support.**
-dontwarn okio.**
-dontwarn com.squareup.okhttp.**
-dontwarn com.squareup.picasso.** #retrofit2
-dontnote retrofit2.Platform
-dontnote retrofit2.Platform$IOS$MainThreadExecutor
-dontwarn retrofit2.Platform$Java8 -dontwarn rx.internal.**

Liên hệ

Hà Nội (Trụ sở chính): Tầng 14, Tòa nhà VTC 23 Lạc Trung, Quận Hai Bà Trưng, Hà Nội
TP. Hồ Chí Minh (chi nhánh): 259 Đồng Đen, Phường 10, Quận Tân Bình, TP. Hồ Chí Minh
Đầu mối kinh doanh: Mr.Cao Ngọc Tân – Email: tancn@vtc.vn
Thông tin liên hệ : 1900 1530 - 08 9999 1530 - https://vtcpay.vn