android - 交易费用或货币在 Telr 中无效
问题描述
我在我的应用程序中集成 Telr 支付网关。没有适当的文档。
在运行其演示项目时,我向我显示“交易金额或货币无效”。请帮忙。
代码:
private MobileRequest getMobileRequest() {
MobileRequest mobile = new MobileRequest();
mobile.setStore(STORE_ID); // Store ID
mobile.setKey(KEY); // Authentication Key : The Authentication Key will be supplied by Telr as part of the Mobile API setup process after you request that this integration type is enabled for your account. This should not be stored permanently within the App.
App app = new App();
app.setId("123456789"); // Application installation ID
app.setName("Telr SDK DEMO"); // Application name
app.setUser("123456"); // Application user ID : Your reference for the customer/user that is running the App. This should relate to their account within your systems.
app.setVersion("0.0.1"); // Application version
app.setSdk("123");
mobile.setApp(app);
Tran tran = new Tran();
tran.setTest("1"); // Test mode : Test mode of zero indicates a live transaction. If this is set to any other value the transaction will be treated as a test.
tran.setType("auth"); /* Transaction type
'auth' : Seek authorisation from the card issuer for the amount specified. If authorised, the funds will be reserved but will not be debited until such time as a corresponding capture command is made. This is sometimes known as pre-authorisation.
'sale' : Immediate purchase request. This has the same effect as would be had by performing an auth transaction followed by a capture transaction for the full amount. No additional capture stage is required.
'verify' : Confirm that the card details given are valid. No funds are reserved or taken from the card.
*/
tran.setClazz("paypage"); // Transaction class only 'paypage' is allowed on mobile, which means 'use the hosted payment page to capture and process the card details'
tran.setCartid(String.valueOf(new BigInteger(128, new Random()))); //// Transaction cart ID : An example use of the cart ID field would be your own transaction or order reference.
tran.setDescription("Test Mobile API"); // Transaction description
tran.setCurrency("AED"); // Transaction currency : Currency must be sent as a 3 character ISO code. A list of currency codes can be found at the end of this document. For voids or refunds, this must match the currency of the original transaction.
tran.setAmount("1"); // Transaction amount : The transaction amount must be sent in major units, for example 9 dollars 50 cents must be sent as 9.50 not 950. There must be no currency symbol, and no thousands separators. Thedecimal part must be separated using a dot.
//tran.setRef(???); // (Optinal) Previous transaction reference : The previous transaction reference is required for any continuous authority transaction. It must contain the reference that was supplied in the response for the original transaction.
tran.setLangauge("en"); // (Optinal) default is en -> English
mobile.setTran(tran);
Billing billing = new Billing();
Address address = new Address();
address.setCity("Dubai"); // City : the minimum required details for a transaction to be processed
address.setCountry("AE"); // Country : Country must be sent as a 2 character ISO code. A list of country codes can be found at the end of this document. the minimum required details for a transaction to be processed
address.setRegion("Dubai"); // Region
address.setLine1("SIT G=Towe"); // Street address – line 1: the minimum required details for a transaction to be processed
//address.setLine2("SIT G=Towe"); // (Optinal)
//address.setLine3("SIT G=Towe"); // (Optinal)
//address.setZip("SIT G=Towe"); // (Optinal)
billing.setAddress(address);
Name name = new Name();
name.setFirst("Hany"); // Forename : the minimum required details for a transaction to be processed
name.setLast("Sakr"); // Surname : the minimum required details for a transaction to be processed
name.setTitle("Mr"); // Title
billing.setName(name);
billing.setEmail(EMAIL); // TODO: Insert your email here : the minimum required details for a transaction to be processed.
billing.setPhone("588519952"); // Phone number, required if enabled in your merchant dashboard.
mobile.setBilling(billing);
return mobile;
}
解决方案
尝试更改货币,因为 AED 不支持 tran.setCurrency("SAR");
推荐阅读
- python - 使用子进程调用从 python 调用 fortran 可执行文件
- r - 替换矩阵元素时 foreach 不起作用
- python - 对没有内置或导入函数的数字进行排序以对列表进行排序或计算平均值
- python - 权证的 Pip 安装失败
- netlogo - Netlogo & Levelspace:如何在两个子模型之间传递字符串?
- pyqt5 - PyQt5 主窗口不会在 Raspberry 3B+ 上呈现(Raspian Stretch,Python 3.5)
- sql - 列出可能每月更改的数据的最佳方法
- php - 从博客类别存档 url 中删除 /category/ slug
- sql - 修剪表列长度超过 x 个字符
- c++ - cpack 创建 zip 而不在 zip 中创建自命名目录