iOS微信APP支付V3版本原始碼

2021-07-10 09:37:39 字數 2267 閱讀 4335

一. 呼叫統一下單api

1. 拿到簽名sign

這裡我是把其餘的九個引數放在字典裡,準備簽名

nsmutabledictionary *packageparams = [nsmutabledictionary dictionary];

[packageparams setobject: wxpartnerid forkey:@"mch_id"]; //商戶號

[packageparams setobject: noncestr forkey:@"nonce_str"]; //隨機串

[packageparams setobject: ordername forkey:@"body"]; //訂單描述,展示給使用者

[packageparams setobject: orderno forkey:@"out_trade_no"];//商戶訂單號

[packageparams setobject: orderprice forkey:@"total_fee"]; //訂單金額,單位為分

[packageparams setobject: [commonutil getipaddress:yes] forkey:@"spbill_create_ip"];//髮器支付的機器ip

[packageparams setobject: @"" forkey:@"notify_url"]; //支付結果非同步通知

- (nsstring *)gensign:(nsdictionary *)signparams

];

nsmutablestring *sign = [nsmutablestring string];

for (nsstring *key in sortedkeys)

nsstring *signstring = [[sign copy] substringwithrange:nsmakerange(0, sign.length - 1)];

// 拼接api金鑰

nsstring *result = [nsstring stringwithformat:@"%@&key=%@", signstring, wxapikey];

// 列印檢查

nslog(@"result = %@", result);

// md5加密

nsstring *signmd5 = [commonutil md5:result];

signmd5 = signmd5.uppercasestring;

// 列印檢查

// 獲取prepayid

api金鑰:同時在郵件裡面給我們的還有  商戶平台登入賬號  和  商戶平台登入密碼  商戶平台是另乙個平台 這是** 

ios微信支付 v3

v2版本和v3版本存在很大的差異。在v3中你獲得不到v2所謂的 paysignkey 這個把我害殘了。當然在v3你真的不需要這個引數了。annotation id annotation 這個方法,等下要用到。不得不承認這個文件有點渣。但大體步驟還是ok的。6.用統一下單的api生成預支付單,獲取pr...

微信支付 退款 v3版微信支付

證書 apiclient cert.p12。jar包 commons codec 1.6.jar commons logging 1.1.3.jar fluent hc 4.3.4.jar httpclient 4.3.4.jar httpclient cache 4.3.4.jar httpcor...

jsapi微信支付v3版

v2還是 v3。在這裡整理的是 v3的,v2的同學請忽略!前期準備須要用的是商戶證書,用的是 p12的。設定 api金鑰 jsapi 授權資料夾 1.openid 授權完 你的 url response type code scope snsapi userinfo state 1 wechat r...