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.
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.
- 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
- 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
- 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()
- Require:
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
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:
- callback: IPaymentCallback (return VTCPaymentData when the transaction is successful)
d. Logout:
- VTCPaySDK.logout(Context context)
keep class com.vtc.sdkpay2.**{*;}
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 |
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