Introduction

VTCPay SDK is the framework to make payments between VTCPay Online Payment gateway, the payment intermediaries and App Merchant which is in the role of sales unit and uses the online payment via VTCPay e-wallet, banks and international cards.

1.Create AppIDcode:

Create AppID code (application code) for application integrated SDKVTCPay. This AppID play the role identifier for your app on the VTCPay system. •Visit our website: https://vtcpay.vn/ •Registration VTCPay account, and log in to the site. •Then go to the section " Integration Payment" and select the "Integration Mobile". •Enter the necessary informations and Confirm.

Finally, select the "Integrated Management" to see the application code of the application just created.

FOR IOS

1. Import VTC SDK Pay into your Xcode Project

- Add or drag the file “VTCPaySDKWap.framework” into your Xcode Project. Leave the “Copy items if needed” is checked.

- Add VTCPaySDKWap.framework binary into General > Embedded Binaries

2. The Application delegate

- In the AppDelegate class (or UnityAppController, or AppController), find the method application:didFinishLaunchingWithOptions:. Then add this line of code if you want change environment to sandbox:

VTCPaySDKWapManager.shared.isSandbox = true

- Required data

VTCPaySDKWapManager.shared.settingMerchain(appId: appId, accountName: accountName secrectKey: secrectKey)

Note:

appId:App id when create the app in website VTC Pay
accountName:The VTC Pay account
secrectKey:The secrect key when you create app in website VTC Pay

3. Functions

- Show home SDK

VTCPaySDKWapManager.shared.showHome(from: viewController)

- Login

VTCPaySDKWapManager.shared.login(from: viewController) 

- Get getAssociationResponse: after login (require) accesstoken can get via method below:

Swift:

VTCPaySDKWapManager.shared. getAssociationResponse()

Objc:

[VTCPaySDKWapManager.shared getAssociationResponse]

- Topup:

VTCPaySDKWapManager.shared.topup(from: viewController)

- Payment

+ VTCPaySDKWapManagerPaymentDelegate:

func paymentDidFinished(success: Bool, errorMessage: String?, amount: Int?, transactionId: Int?, status: Int?, orderId: Int?, paymentType: String?)

Note:

Payment success: success = true
Payment failure: success = false and errorMessage is not nil

+ Call payment:

                    VTCPaySDKWapManager.shared.paymentDelegate = <object was implemented the delegate> VTCPaySDKWapManager.shared.payment(from: viewController, amount: amount, receiverAccount: receiverAccount, orderCode: orderCode, paymentType: .vtcWallet)
                    

Trong đó:

viewController:the controller to present VTC Pay SDK
amount:payment amount
receiverAccount:receiver account (will be VTC account)
orderCode:the unique order code
paymentType:The payment type
PaymentType.vtcWallet:VTC Pay wallet
PaymentType.domesticCard:The ATM card
PaymentType.visaMasterCard:Visa, Master, Jcb card
PaymentType.attachedCard:Attached card in user’s wallet

- Logout:

VTCPaySDKWapManager.shared.logout()

FOR ANDROID

1. Config

- Require:

  1. API >= 19
  2. Add file “sdkpay2.aar” to the libs directory
  3. Add into file build.gradle
    1. dependencies{
    2. .......
    3. implementation files('libs/sdkpay2.aar')
    4. implementation 'com.google.code.gson:gson:2.2.4'
    5. .......
    6. }

2. How to use

Code General:

VTCPaySDK.getInstance().nextFunctionVTCPay(Context context, @FUNCTION_NAME String nameFunction, @NonNull VTCAppInfoModel appInfoModel, ICallback iCallback)

- context

- nameFunction

- appInfoModel: contains the integrated parameters (MerchantAppID, MerchantAccountName, AppSecretKey)

- iCallback: (responseCode, Description)

a. Login:

- nameFunction: VTCPaySDK.LOGIN

- iCallback : Icallback

  1. Override method onActivityResult
  2. Add code:
                    
                            if (requestCode == VTCPaySDK.ACTIVITY_REQUEST_CODE_LOGIN) {
if (resultCode == RESULT_OK) {
String associationResponse =
data.getStringExtra(VTCPaySDK.ASSOCIATION_RESPONSE);
}
}

- associationResponse: AccessToken.

b. Topup:

- nameFunction: VTCPaySDK.TOPUP

- iCallback : Icallback

c. Payment:

- nameFunction: VTCPaySDK.PAYMENT

- appInfoModel: add more parametes:

  1. Amount: payment amount
  2. OrderCode
  3. Currency
  4. ReceiverAccount: (will be vtc account)
  5. PaymentType:
    1. VTCPaySDK.VTC_PAY: VTCPay wallet
    2. VTCPaySDK.BANK_NOIDIA: Atm card
    3. VTCPaySDK.BANK_QUOCTE: Visa, master, jcb
    4. VTCPaySDK.BANK_GANKET: Attached card in user’s wallet

- callback: IPaymentCallback (return VTCPaymentData when the transaction is successful)

d. Logout:

- VTCPaySDK.logout(Context context)

3. Proguard

keep class com.vtc.sdkpay2.**{*;}

Appendix

Appendix of order payment

Status Mean Note
0 Transaction status of initializing
1 SUCCESS Successful transaction
7 REVIEW Payment account of customer is deducted but Merchant’s account is not credited.Payment admin department of VTC will approve to decide transaction is successful or failed.
-1 FAIL Failed transaction
-9 FAIL Customer cancel transaction
-3 FAIL VTC admin cancel transaction
-4 FAIL Account not eligible for transaction(Locked, not registered for online payment ...)
-5 FAIL Customer account balance(VTC Pay ewallet, bank account) is not sufficient to make payment
-6 FAIL Transaction error at VTC
-7 FAIL Customer enter wrong payment information(account information or OTP)
-8 FAIL Exceed day transaction limit
-22 FAIL Order payment value is too small
-24 FAIL Order payment currency is not valid
-25 FAIL Merchant’s VTC Pay receiving account does not exist
-28 FAIL Lack of compulsory parameters in one online payment order
-29 FAIL Request parameter is not valid
-21 CHECK Duplicating transaction reference.May be because of duplicating solving is not good, poor internet connection, customer enter F5, or poor transaction code generating, partner must check to get the final result of this transaction
-23 CHECK WebsiteID does not exist
-99 CHECK Undefined errors and transaction status.Must check to know if transaction is successful or not

CONTACTS

Hanoi (Headquarter): Floor 14 - VTC Building, 23 Lac Trung Street, Hai Ba Trung District, Hanoi
HCMC(Branch) : 259 Dong Den Street, Ward 10, Tan Binh District, HCMC
Sale manager: Mr.Cao Ngoc Tan – Email: tancn@vtc.vn
Contact : 1900 1530 - 08 9999 1530 - https://vtcpay.vn

Download iOS Download android