PayTm All-in-one Sdk - 成功付款后出现网页不可用等错误 - 回调 url 错误
PayTm All-in-one Sdk - after successful payment getting error like Webpage not available - callback url error
完整的错误信息是:
无法加载位于 https://merchant.com/callback 的网页,因为:net::ERR_CONNECTION_TIME_OUT
我的代码用于启动 paytm 并在应用程序调用中遇到相同的错误:
private void startPayTMCall(InitiateAPIResponse apiResponse, PaytmInitRequestBody paytmInitRequestBody) {
String orderIdString = paytmInitRequestBody.getOrderId();
String MID = getString(R.string.MID);
String amount = String.valueOf(paytmInitRequestBody.getAmount());
/*
On completion of transaction, Paytm payment gateway will send the response on this URL. This can be a static response URL as mentioned below:
Staging Environment: "https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=<order_id>"
Production Environment: "https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=<order_id>"*/
// for test mode use it
// String host = "https://securegw-stage.paytm.in/";
// for production mode use it
String host = "https://securegw.paytm.in/";
String callBackUrl = host + "theia/paytmCallback?ORDER_ID=" + orderIdString;
PaytmOrder order = new PaytmOrder(orderIdString, MID, apiResponse.getBody().getTxnToken(), amount, callBackUrl);
TransactionManager transactionManager = new TransactionManager(order, new PaytmPaymentTransactionCallback() {
@Override
public void onTransactionResponse(Bundle bundle) {
Toast.makeText(getApplicationContext(), "Payment Transaction response " + bundle.toString(), Toast.LENGTH_LONG).show();
}
@Override
public void networkNotAvailable() {
Toast.makeText(MainActivity.this, "networkNotAvailable", Toast.LENGTH_SHORT).show();
}
@Override
public void onErrorProceed(String s) {
Toast.makeText(MainActivity.this, "onErrorProceed "+s, Toast.LENGTH_SHORT).show();
}
@Override
public void clientAuthenticationFailed(String s) {
Toast.makeText(MainActivity.this, "clientAuthenticationFailed : "+s, Toast.LENGTH_SHORT).show();
}
@Override
public void someUIErrorOccurred(String s) {
Toast.makeText(MainActivity.this, "someUIErrorOccurred : "+s, Toast.LENGTH_SHORT).show();
}
@Override
public void onErrorLoadingWebPage(int i, String s, String s1) {
Toast.makeText(MainActivity.this, "onErrorLoadingWebPage : "+s+" : "+s1, Toast.LENGTH_SHORT).show();
}
@Override
public void onBackPressedCancelTransaction() {
Toast.makeText(MainActivity.this, "onBackPressedCancelTransaction : ", Toast.LENGTH_SHORT).show();
}
@Override
public void onTransactionCancel(String s, Bundle bundle) {
Toast.makeText(MainActivity.this, "onTransactionCancel : "+s, Toast.LENGTH_SHORT).show();
}
});
transactionManager.setAppInvokeEnabled(false);
transactionManager.setEnableAssist(true);
transactionManager.startTransaction(this, REQ_CODE_ORDER);
}
我认为回调有问题 url 这可能是 worng,但我遵循 paytm 官方 All in one SDK 文档。 https://developer.paytm.com/docs/all-in-one-sdk/
请在 'Initiate Transaction API' 的 'callbackUrl' 请求参数中使用 Paytm 静态回调 URL。 URL 提到的 (merchant.com/callback) 只是一个示例,您可以使用自定义回调 url 或使用下面提到的回调 URL.
Paytm 静态回调 URL ->
分期:https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=
完整的错误信息是: 无法加载位于 https://merchant.com/callback 的网页,因为:net::ERR_CONNECTION_TIME_OUT
我的代码用于启动 paytm 并在应用程序调用中遇到相同的错误:
private void startPayTMCall(InitiateAPIResponse apiResponse, PaytmInitRequestBody paytmInitRequestBody) {
String orderIdString = paytmInitRequestBody.getOrderId();
String MID = getString(R.string.MID);
String amount = String.valueOf(paytmInitRequestBody.getAmount());
/*
On completion of transaction, Paytm payment gateway will send the response on this URL. This can be a static response URL as mentioned below:
Staging Environment: "https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=<order_id>"
Production Environment: "https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=<order_id>"*/
// for test mode use it
// String host = "https://securegw-stage.paytm.in/";
// for production mode use it
String host = "https://securegw.paytm.in/";
String callBackUrl = host + "theia/paytmCallback?ORDER_ID=" + orderIdString;
PaytmOrder order = new PaytmOrder(orderIdString, MID, apiResponse.getBody().getTxnToken(), amount, callBackUrl);
TransactionManager transactionManager = new TransactionManager(order, new PaytmPaymentTransactionCallback() {
@Override
public void onTransactionResponse(Bundle bundle) {
Toast.makeText(getApplicationContext(), "Payment Transaction response " + bundle.toString(), Toast.LENGTH_LONG).show();
}
@Override
public void networkNotAvailable() {
Toast.makeText(MainActivity.this, "networkNotAvailable", Toast.LENGTH_SHORT).show();
}
@Override
public void onErrorProceed(String s) {
Toast.makeText(MainActivity.this, "onErrorProceed "+s, Toast.LENGTH_SHORT).show();
}
@Override
public void clientAuthenticationFailed(String s) {
Toast.makeText(MainActivity.this, "clientAuthenticationFailed : "+s, Toast.LENGTH_SHORT).show();
}
@Override
public void someUIErrorOccurred(String s) {
Toast.makeText(MainActivity.this, "someUIErrorOccurred : "+s, Toast.LENGTH_SHORT).show();
}
@Override
public void onErrorLoadingWebPage(int i, String s, String s1) {
Toast.makeText(MainActivity.this, "onErrorLoadingWebPage : "+s+" : "+s1, Toast.LENGTH_SHORT).show();
}
@Override
public void onBackPressedCancelTransaction() {
Toast.makeText(MainActivity.this, "onBackPressedCancelTransaction : ", Toast.LENGTH_SHORT).show();
}
@Override
public void onTransactionCancel(String s, Bundle bundle) {
Toast.makeText(MainActivity.this, "onTransactionCancel : "+s, Toast.LENGTH_SHORT).show();
}
});
transactionManager.setAppInvokeEnabled(false);
transactionManager.setEnableAssist(true);
transactionManager.startTransaction(this, REQ_CODE_ORDER);
}
我认为回调有问题 url 这可能是 worng,但我遵循 paytm 官方 All in one SDK 文档。 https://developer.paytm.com/docs/all-in-one-sdk/
请在 'Initiate Transaction API' 的 'callbackUrl' 请求参数中使用 Paytm 静态回调 URL。 URL 提到的 (merchant.com/callback) 只是一个示例,您可以使用自定义回调 url 或使用下面提到的回调 URL.
Paytm 静态回调 URL ->
分期:https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=