A demonstration of Payment SDK in JAVA
The 'PaymentSDK.jar' file provides you with the ability to make payment through the available payment modes in SDK.
Include PaymentSDK.jar in your project lib/ folder & ensure that the lib/ folder's JAR is included in settings.json configuration file.
- Add the PaymentSDK.jar file in your project lib/ folder
project/src/lib/PaymentSDK.jar
- Navigate to the settings.json file located in .vscode/ folder
project/.vscode/settings.json
- Include the .jar files within in your project lib/ folder in settings.json
{
"java.project.sourcePaths": ["src"],
"java.project.outputPath": "bin",
"java.project.referencedLibraries": [
"lib/**/*.jar"
]
}
import sdk.PaymentSDK;
import sdk.client.model.PaymentMode;
import sdk.client.model.CardRequirement;
import sdk.client.model.NetBankingRequirement;
import sdk.client.base.TransactionResult;
import sdk.client.base.PaymentRequirement;
import sdk.core.delegate.PaymentDelegate;
PaymentMode paymentMode;
PaymentDelgate paymentDelegate;
PaymentRequirement paymentRequirement;
- Debit Card:
paymentMode = PaymentMode.DEBIT_CARD
paymentRequirement = new CardRequirement(cardNumber, expDate, cvv);
- Credit Card:
paymentMode = PaymentMode.CREDIT_CARD
paymentRequirement = new CardRequirement(cardNumber, expDate, cvv);
- Net Banking:
paymentMode = PaymentMode.NET_BANKING
paymentRequirement = new NetBankingRequirement(accountHolder, bankAccountNo, ifscCode);
paymentDelegate = PaymentSDK.getInstance().init();
Step 5 - Finally, Inject the Payment Mode & Payment Requirement with payable amount and Handle the callback of the SDK Transaction result accordingly!
paymentDelegate.initialise(paymentMode, paymentRequirement).pay(amount).onResult(new TransactionResult() {
@Override
onSuccess(String message) {
// Hanlde success case scenario
System.out.println(message);
}
@Override
onFailure(String message) {
// Hanlde failure case scenario
System.out.println(message);
}
});
Access the SdkConfiguration class which demonstrate a sample code for PaymentSDK Integration and usage
import sdk.client.example.SdkConfiguration;
SdkConfiguration.getInstance().init();
- Aditya Ambre
This project is licensed under the Apache-2.0 License - see the LICENSE.md file for details.
Copyrights © - 2024 Aditya Ambre. │ All Rights Reserved.