iOS支付宝跳转集成示例

iOS 项目的支付宝跳转功能,ios 支付宝 demo这个例子做得还挺全的,适合刚接触支付集成的你快速上手。

里面不仅有完整的代码,还有挺多注释,思路清晰。最核心的点就是用URL Scheme搞定支付宝 App 的跳转,比如alipay://,一触发就能拉起支付界面,逻辑简单直接。

Info.plist配置挺重要,记得加URL Types,Scheme 写对了才能跳过去,不然白敲代码。调用支付宝 SDK 那一段写得也清楚,主要是订单信息怎么封装、怎么调起支付接口。

支付完的回调也考虑到了,在AppDelegate.m里监听结果,用状态码判断支付成功还是失败,逻辑也不绕,跟着 demo 改基本就能跑起来。

还有一点不错,它支持自定义支付界面,也就是说你可以自己设计支付前的确认页,让体验更贴合你 App 的风格,挺灵活的。

建议你先在开发环境下试几轮,测试通过了再走上线流程,别忘了到支付宝开放平台注册 App、拿 AppID。

如果你是第一次搞支付功能,或者想看清楚整个跳转流程,这个 demo 还挺值得一看的,顺手还可以看看这些文章:

folder
ios 支付宝demo,可供下载和跳转支付宝界面 预估大小:129个文件
file
libcrypto.a 12.99MB
file
contents.xcworkspacedata 155B
file
UserInterfaceState.xcuserstate 34KB
file
WorkspaceSettings.xcsettings 332B
file
UserInterfaceState.xcuserstate 254KB
file
UserInterfaceState.xcuserstate 38KB
file
AliSDKDemo.xccheckout 2KB
file
project.pbxproj 41KB
file
xcschememanagement.plist 482B
file
AliSDKDemo.xcscheme 3KB
file
Breakpoints_v2.xcbkptlist 4KB
file
xcschememanagement.plist 573B
file
AliSDKDemo.xcscheme 4KB
file
Breakpoints_v2.xcbkptlist 3KB
file
xcschememanagement.plist 482B
file
AliSDKDemo.xcscheme 3KB
file
Breakpoints_v2.xcbkptlist 802B
file
Icon.png 4KB
file
.DS_Store 6KB
file
libssl.a 2.32MB
file
Icon@2x.png 9KB
file
APAppDelegate.m 3KB
file
main.m 341B
file
APAppDelegate.h 281B
file
APViewController.m 7KB
file
APViewController.h 837B
file
Main.storyboard 4KB
file
Order.m 2KB
file
.DS_Store 6KB
file
Order.h 911B
file
AliSDKDemo-Prefix.pch 344B
file
AliSDKDemo-Info.plist 1KB
file
Contents.json 585B
file
Contents.json 442B
file
InfoPlist.strings 45B
file
Main.storyboard 4KB
file
config.h 5KB
file
DataVerifier.m 318B
file
RSADataVerifier.m 2KB
file
MD5DataSigner.h 258B
file
RSADataVerifier.h 337B
file
base64.h 2KB
file
NSDataEx.m 6KB
file
RSADataSigner.m 3KB
file
DataVerifier.h 363B
file
openssl_wrapper.h 979B
file
.DS_Store 6KB
file
DataSigner.m 334B
file
DataSigner.h 429B
file
base64.m 5KB
file
openssl_wrapper.m 6KB
file
NSDataEx.h 465B
file
RSADataSigner.h 333B
file
MD5DataSigner.m 316B
file
md5.h 5KB
file
srtp.h 6KB
file
krb5_asn.h 7KB
file
rand.h 5KB
file
ec.h 45KB
file
des.h 11KB
file
pem.h 21KB
file
idea.h 4KB
file
whrlpool.h 1019B
file
asn1.h 51KB
file
seed.h 6KB
file
aes.h 5KB
file
rc4.h 4KB
file
bn.h 36KB
file
comp.h 2KB
file
ossl_typ.h 7KB
file
lhash.h 9KB
file
cms.h 19KB
file
des_old.h 18KB
file
ssl2.h 11KB
file
ocsp.h 23KB
file
rc2.h 4KB
file
ecdh.h 5KB
file
blowfish.h 5KB
file
ts.h 30KB
file
conf_api.h 4KB
file
buffer.h 5KB
file
dsa.h 12KB
file
cmac.h 3KB
file
obj_mac.h 133KB
file
md4.h 5KB
file
hmac.h 4KB
file
tls1.h 34KB
file
dh.h 10KB
file
srp.h 5KB
file
pkcs7.h 18KB
file
e_os2.h 10KB
file
symhacks.h 24KB
file
pkcs12.h 12KB
file
dtls1.h 8KB
file
ecdsa.h 10KB
file
crypto.h 24KB
file
opensslv.h 4KB
file
bio.h 32KB
file
objects.h 36KB
file
ui.h 16KB
file
ripemd.h 4KB
file
err.h 15KB
file
x509.h 44KB
file
x509v3.h 32KB
file
pem2.h 3KB
file
txt_db.h 4KB
file
ssl3.h 26KB
file
ui_compat.h 3KB
file
modes.h 5KB
file
mdc2.h 4KB
file
sha.h 7KB
file
dso.h 18KB
file
pqueue.h 3KB
file
kssl.h 6KB
file
ssl23.h 4KB
file
conf.h 10KB
file
safestack.h 180KB
file
x509_vfy.h 22KB
file
cast.h 4KB
file
evp.h 52KB
file
ssl.h 101KB
file
opensslconf.h 6KB
file
rsa.h 22KB
file
engine.h 40KB
file
asn1_mac.h 19KB
file
asn1t.h 29KB
file
stack.h 4KB
file
camellia.h 5KB
file
ebcdic.h 540B
...
zip 文件大小:6.3MB