當前位置:首頁 » 安卓系統 » android銀聯支付sdk

android銀聯支付sdk

發布時間: 2023-04-24 07:07:52

A. unity的Android開發中怎麼接入銀聯支付的,具體流程怎麼實現

可以去銀聯官網上去下載官方文檔
實際上其實沒什麼技術流程,只需要在判察unity中調讓沖拍用銀聯的支付方法即可,需要的僅僅是引入銀聯的sdk包和實現android與unity通信的jar包即可。
更多的是業務流程,比如坦羨申請銀聯的appkey,密鑰等等,然後通過後台生成按照銀聯SDK的支付方法所需的參數進行調用就行了。

B. 移動支付sdk是什麼

移動支付SDK就是對接收款的代碼,就是解決支付的源碼,形成像雲收單一樣的聚合支付系統

C. 一些Android開發中常用的第三方sdk

1、Share SDK官網 www.mob.com。免費集成注冊簡訊驗證碼,友好的分享功能。

2、環信sdk。主要是集成,聊天相關sdk。

3、Ping++聚合支付告告。解決集成支付sdk。

4、友盟分享、統計。

5、網路統計

6、極光推送、個推推送

7、360加固服務

8、網路加固、統計服務弊友仔

9、融雲通訊---即時通訊

10、容聯 雲通訊

11、極速數據、阿凡達數據、聚租汪合數據

D. AndroidSDK如何設置支付界面橫屏顯示

全屏

在Activity的onCreate方法中的setContentView(myview)調用之前添加下面代碼

requestWindowFeature(Window.FEATURE_NO_TITLE);//隱藏標題getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);//設置全屏

橫屏

按照下面代碼示例修改Activity的onResume方法

@Overrideprotected void onResume() {/*** 設置為橫屏*/if(getRequestedOrientation()!=ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE){setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);}super.onResume();}

或者在配置文件中對Activity節點添加android:screenOrientation屬性(landscape是橫向,portrait是縱向)

android:launchMode="singleTask" android:screenOrientation="portrait">

要設置成豎屏設置成 SCREEN_ORIENTATION_PORTRAIT

// ----------------

常亮

view.setKeepScreenOn(true)

不加任何旋轉屏幕的處理代碼的時候,旋轉屏幕將會導致系統把當前activity關閉,重新打開。如果只是簡單的界面調整,我們可以阻止此問題的發生,屏幕旋轉而自己調整屏幕的元素重構。首先我們需要修改AndroidManifest.xml文件:<activity android:name=".Magazine"></activity>//修改為:<activity android:name=".Magazine"android:configChanges="orientation|keyboard"></activity>這樣是讓程序能夠響應旋轉屏幕的事件。然後重寫onConfigurationChanged方法:@Overridepublic void onConfigurationChanged(Configuration newConfig) {// TODO Auto-generated method stubsuper.onConfigurationChanged(newConfig);Log.v(" == onConfigurationChanged");processLayout();}

//----------------------------

在我們用Android開發過程中,會碰到Activity在切換到後台或布局從橫屏LANDSCAPE切換到PORTRAIT,會重新切換Activity會觸發一次onCreate方法。

在Android開發中這種情況視可以避免的,我們可以在androidmanifest.xml中的activit元素加入這個屬性 android:configChanges="orientation|keyboardHidden" 就能有效避免oncreat方法的重復載入,

androidmanifest.xml內容如下:紅色字體為添加部分

<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.demo" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".DemoGPS" android:configChanges="orientation|keyboardHidden" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity><uses-library android:name="com.google.android.maps" />

</application> <uses-sdk android:minSdkVersion="7" />

<uses-permission android:name="android.permission.INTERNET"></uses-permission> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission></manifest>

同時在Activity的Java文件中重載onConfigurationChanged(Configuration newConfig)這個方法,這樣就不會在布局切換或窗口切換時重載等方法。代碼如下:

@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {//land } else if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {//port } }

//------------------------------------------------------

關於Android中Activity的橫豎屏切換問題可以通過AndroidManifest.xml文件中的Activity來配置:

android:screenOrientation=["unspecified" | "user" | "behind" | "landscape" | "portrait" | "sensor" | "nonsensor"]

screenOrientation 用來指定Activity的在設備上顯示的方向,每個值代表如下含義:

"unspecified" 默認值 由系統來判斷顯示方向.判定的策略是和設備相關的,所以不同的設備會有不同的顯示方向.

"landscape" 橫屏顯示(寬比高要長)

"portrait" 豎屏顯示(高比寬要長)

"user" 用戶當前首選的方向

"behind" 和該Activity下面的那個Activity的方向一致(在Activity堆棧中的)

"sensor" 有物理的感應器來決定。如果用戶旋轉設備這屏幕會橫豎屏切換。

"nosensor" 忽略物理感應器,這樣就不會隨著用戶旋轉設備而更改了 ( "unspecified"設置除外 )。

更多安卓例子請去360手機助手下載安卓學習手冊,裡面有橫豎排例子,源碼,例子隨便看。

E. 銀聯在線和支付寶,android應用怎麼調用

一、 支付寶平台的集成

在技術集成之前,商戶需要在https://ms.alipay.com進行注冊,並簽約安全支付服務。簽約成功後可獲取支付寶分配的合作商戶ID(PartnerID),賬戶ID(SellerID),調用介面時使用。

支付細節的實現,主要通過支付寶提供的一個支付安全服務安裝包alipay_plugin_20120428msp.apk,首次使用,首先檢查是否安裝此插件,沒有會提示安裝。具體的支付細節,在這個插件內完成。大部分的支付平台也都是採用的這種方式。

調用支付寶的介面進行支付,主要有以下幾個步驟

1. 將商戶ID,收款帳號,外部訂單號,商品名稱,商品介紹,價格,通知地址封裝成訂單信息

2. 對訂單信息進行簽名

3. 將訂單信息,簽名,簽名方式封裝成請求參數

4. 調用pay方法。

主要流程圖如下:

支付介面pay方法的調用如下:

。。。

// start pay for this order.

// 根據訂單信息開始進行支付

try {

// prepare the order info.

// 准備訂單信息

String orderInfo = getOrderInfo(position);

// 這里根據簽名方式對訂單信息進行簽名

String signType = getSignType();

String strsign = sign(signType, orderInfo);

Log.v("sign:", strsign);

// 對簽名進行編碼

strsign = URLEncoder.encode(strsign);

// 組裝好參數

String info = orderInfo + "&sign=" + "\"" + strsign + "\"" + "&"

+ getSignType();

Log.v("orderInfo:", info);

// start the pay.

// 調用pay方法進行支付

MobileSecurePayer msp = new MobileSecurePayer();

boolean bRet = msp.pay(info, mHandler, AlixId.RQF_PAY,this);if (bRet) {

// show the progress bar to indicate that we have started

// paying.

// 顯示「正在支付」進度條

closeProgress();

mProgress = BaseHelper.showProgress(this,null, "正在支付",false,

true);

} else

;

} catch (Exception ex) {

Toast.makeText(AlixDemo.this, R.string.remote_call_failed,

Toast.LENGTH_SHORT).show();

}

。。。

/**

* 向支付寶發送支付請求

*

* @param strOrderInfo

* 訂單信息

* @param callback

* 回調handler

* @param myWhat

* 回調信息

* @param activity

* 目標activity

* @return

*/

public boolean pay(final String strOrderInfo,final Handler callback,

final int myWhat, final Activity activity) {

if (mbPaying)

return false;

mbPaying = true;//

mActivity = activity;// bind the service.

// 綁定服務

if (mAlixPay ==null) {

// 綁定安全支付服務需要獲取上下文環境,

// 如果綁定不成功使用mActivity.getApplicationContext().bindService

// 解綁時同理

mActivity.getApplicationContext().bindService(

new Intent(IAlixPay.class.getName()),mAlixPayConnection,

Context.BIND_AUTO_CREATE);

}

// else ok.// 實例一個線程來進行支付

new Thread(new Runnable() {

public void run() {

try {

// wait for the service bind operation to completely

// finished.

// Note: this is important,otherwise the next mAlixPay.Pay()

// will fail.

// 等待安全支付服務綁定操作結束

// 注意:這里很重要,否則mAlixPay.Pay()方法會失敗

synchronized (lock) {

if (mAlixPay ==null)

lock.wait();

}// register a Callback for the service.

// 為安全支付服務注冊一個回調

mAlixPay.registerCallback(mCallback);// call the MobileSecurePay service.

// 調用安全支付服務的pay方法

String strRet =mAlixPay.Pay(strOrderInfo);

BaseHelper.log(TAG,"After Pay: " + strRet);// set the flag to indicate that we have finished.

// unregister the Callback, and unbind the service.

// 將mbPaying置為false,表示支付結束

// 移除回調的注冊,解綁安全支付服務

mbPaying = false;

mAlixPay.unregisterCallback(mCallback);

mActivity.getApplicationContext().unbindService(

mAlixPayConnection);// send the result back to caller.

// 發送交易結果

Message msg = new Message();

msg.what = myWhat;

msg.obj = strRet;

callback.sendMessage(msg);

} catch (Exception e) {

e.printStackTrace();// send the result back to caller.

// 發送交易結果

Message msg = new Message();

msg.what = myWhat;

msg.obj = e.toString();

callback.sendMessage(msg);

}

}

}).start();return true;

}調用了支付服務之後,有兩種方式返回交易結果:

1. 支付結果作為介面返回的字元串返回。返回的參數包含在result字元串中,具體再進行解析。

2. 支付寶伺服器通知。商戶需要提供一個http協議的介面,包含在參數里傳遞給安全支付,即notify_url。支付寶伺服器在支付完成後,會用POST方法調用notufy_url,以xml為數據格式傳輸支付結果。需要注意的是,商戶伺服器收到支付寶發的通知之後,需要返回一個純字元串「success」,不然支付寶的伺服器會持續調用七次回調url提供的介面。

集成需要的交易費用方面0-1萬元內是2.5%的費率,1-10萬是2.4%,10-100萬是2.2%,100萬以上2.0%。
PS :親測

AliPayInfo aliPayInfo=new AliPayInfo();
AliPay aliPay=new AliPay((Activity)OtherPayDlg.this.mContext, mHandler);
aliPay.pay(aliPayInfo.toString());
OtherPayDlg.this.dismiss();

出現問題一:按照說明文檔導入alipay.jar 出現AliPay 找不到,然後項目根目錄下新建一個 libs文件夾,把要加的包放到這個目錄下,右鍵 Build Path -> Use as source folder

成功可以引用,但是沒有彈出界面二、 財付通平台的集成

財付通的集成和支付寶的非常相似(騰訊的傳統?→_→)。財付通也是提供了一個財付通安全支付服務應用TenpayService.apk用於處理交易的細節。對於此支付應用,財付通和支付寶的使用方式是一樣的。一種是捆綁預置,即打包在assets目錄下,另一種是放到自己的伺服器中,通過檢查更新的方式動態載入。實際集成中可採用二者結合方式,初次使用使用預置apk,之後檢查更新動態下載。

但是調用支付介面之前,增加了一個獲取tokenid的過程,tokenid用於同財付通service進行交互。過程如下:

1. 用戶在商戶APP 選擇商品,使用財付通支付

2. 商戶APP向商戶server 請求使用財付通支付

3. 商戶server按照「支付初始化介面」的要求組織數據請求財付通「支付初始化介面」,接收初始化成功後返回的tokenid

4. 商戶server將生成的tokenid 返回給商戶APP

5. 商戶APP使用tokenid 調用財付通支付service

6. 財付通支付service 在驗證tokenid 後向用戶展示支付中心,顯示訂單信息及相關用戶信息

7. 用戶在支付中心輸入支付密碼執行支付

8. 財付通支付service 向財付通後台server 請求執行支付,並實時接收支付結果

9. 支付成功後財付通支付service 向用戶展示支付成功UI,在用戶點擊「返回商戶網站」後回調商戶App

10. 財付通後台server 在支付成功後會通過「支付成功通知介面」在後台通知商戶server 支付狀態。

接收支付介面返回結果方面,財付通對於方法返回值,不是直接返回的,而是通過handler回調,handler和msgId作為一個參數傳入介面,支付介面pay()方法的返回值只是個true false,用於區分調用成功或者失敗。其實跟淘寶的方式大同小異。對於notify_url,是財付通是通過get方式調用回調url,只返回支付成功的訂單。同樣的,商戶伺服器在接收到財付通的調用之後,需要返回純字元串「success」「fail」表示處理成功或失敗。

調用支付介面的代碼如下:

//構造支付參數

HashMap<String, String> payInfo = new HashMap<String, String>();

payInfo.put("token_id",mTokenId); //財付通訂單號token_id

payInfo.put("bargainor_id","1234567890"); //財付通合作商戶ID,此為演示示例

// payInfo.put("order_type", "1");

payInfo.put("caller","com.tenpay.android.appDemo");//去支付

tenpayHelper.pay(payInfo,mHandler, MSG_PAY_RESULT);

財付通的服務費率是1%,另外有相關的套餐可以優惠。

三、 易寶支付平台集成

與支付寶和財付通不同的是,易寶集成時,並沒有提供一個支付應用apk,只有一個jar包。是一個library project。因為在集成時,需要在manifest文件裡面聲明支付頁面的activity。同時在調用支付頁面時,需要用startActivityForResult方式進入,支付結果會通過onActivityResult方法返回。易寶同樣支持服務端回調,但比較糾結的是,易寶的服務端回調url,不能在代碼中傳入,需要在易寶的網站進行配置。只有支付成功時才會觸發此回調,以get方式調用。

調用支付介面的代碼如下:其中customerNumber參數是簽約之後才能獲取到的。requestId為調用方自定義的訂單流水號。

private void startPay(String customerNumber, String chennal) {

String amount = etAmount.getText().toString();

String proctName = etProctName.getText().toString();

String proctDesc = etProctDesc.getText().toString();if(TextUtils.isEmpty(proctName) || TextUtils.isEmpty(amount)) {

Toast.makeText(YeepayExampleActivity.this,"", Toast.LENGTH_SHORT);

}Intent intent = new Intent(getBaseContext(), YeepayPlugin.class);

intent.putExtra("customerNumber", customerNumber);Random random = new Random();

String time = "" + System.currentTimeMillis();

String requestId = time + random.nextInt() % 10000;intent.putExtra("requestId", requestId);

intent.putExtra("amount", amount);

intent.putExtra("proctName", proctName);

intent.putExtra("time", time);

intent.putExtra("proctDesc", (proctDesc ==null) ? "" : proctDesc);

intent.putExtra("support", chennal);

intent.putExtra("environment","ENV_TEST" );

StringBuilder builder = new StringBuilder();

builder.append(CUSTOMER_NUMBER).append("$");

builder.append(requestId).append("$");

builder.append(amount).append("$");

builder.append(proctName).append("$");

builder.append(time);String hmac = YeepayUtils.hmacSign(builder.toString(),KEY);Log.e("YeepayExampleActivity","hmac" + hmac);intent.putExtra("hmac", hmac);

startActivityForResult(intent, 200);

}

易寶集成後的費率需要和易寶的客戶經理面談決定

四、 銀聯在線支付集成

銀聯的支付應用同支付寶和財付通相同,採用的是獨立apk的方式提供服務。調用支付介面採用的startActivity的方式,相關參數通過bundle傳遞,調用示例如下:

bundle.putBoolean(USE_TEST_MODE,true);bundle.putString(SP_ID,"0009");

bundle.putString(SECURITY_CHIP_TYPE,null);

bundle.putString(SYS_PROVIDE,"00000001");

bundle.putString(PAY_DATA, payData);



Intent startIntent = new Intent();

// startIntent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);

startIntent.putExtras(bundle);

startIntent.setClassName(UPPayUtils.PACKAGE_NAME,

UPPayUtils.ACTIVITY_NAME);

// activity.startActivityForResult(startIntent, UPPayUtils.STARTE_UPPAY);

activity.startActivity(startIntent);

與以上三種支付平台不同的是,銀聯支付介面的返回值是通過廣播的形式發送的。不支持商戶服務端的回調url。

熱點內容
oracle測試sql 發布:2025-07-08 03:16:54 瀏覽:974
php壁紙源碼 發布:2025-07-08 03:04:26 瀏覽:321
android應用層 發布:2025-07-08 02:42:32 瀏覽:301
大唐存儲銷量 發布:2025-07-08 02:41:11 瀏覽:582
腳本怎麼打開 發布:2025-07-08 02:41:06 瀏覽:822
貴州電信iPtv升級伺服器地址 發布:2025-07-08 02:38:48 瀏覽:412
電腦怎麼鏈接本地伺服器 發布:2025-07-08 02:34:22 瀏覽:147
android調試webview 發布:2025-07-08 02:26:28 瀏覽:358
壓縮袋鞋子 發布:2025-07-08 02:21:30 瀏覽:752
為什麼安卓打吃雞感覺有延遲 發布:2025-07-08 02:09:32 瀏覽:168