Commit 3440a4ee5938c2daa878e0fbeb7d9b7e61088254
1 parent
3d046e0c
update
Showing
1 changed file
with
33 additions
and
2 deletions
06.支付云/4.1web.md
| 1 | -交互图 | ||
| 2 | -<img src="http://console.open.cnlive.com/open/css/docimg/web.png"> | ||
| 3 | \ No newline at end of file | 1 | \ No newline at end of file |
| 2 | +### 交互图 | ||
| 3 | + | ||
| 4 | +<img src="http://console.open.cnlive.com/open/css/docimg/web.png"> | ||
| 5 | + | ||
| 6 | +### demo | ||
| 7 | +生成支付云的URL,在网页中使用a标签或js打开URL,进入支付页面。 | ||
| 8 | + | ||
| 9 | +```java | ||
| 10 | + | ||
| 11 | +package com.cnlive.open.sdk; | ||
| 12 | + | ||
| 13 | +import java.util.HashMap; | ||
| 14 | +import java.util.Map; | ||
| 15 | + | ||
| 16 | +public class Example { | ||
| 17 | + | ||
| 18 | + public static void main(String[] args) { | ||
| 19 | + String appId = "appId";//到http://open.cnlive.com 后台获取。 | ||
| 20 | + String key = "key";//到http://open.cnlive.com 后台获取。 | ||
| 21 | + Map<String,String> map = new HashMap<>(); | ||
| 22 | + map.put("appId",appId); | ||
| 23 | + map.put("out_trade_no","test1"); | ||
| 24 | + map.put("body","测试订单1"); | ||
| 25 | + map.put("total_fee","1"); | ||
| 26 | + map.put("notify_url","http://mydomain.com/test/notify_url"); | ||
| 27 | + map.put("page_url","http://mydomain.com/test/page_url"); | ||
| 28 | + String url = OpenUtil.buildURL("https://api.cnlive.com/open/api2/unifypay/alipay/pay", map, key); | ||
| 29 | + System.out.println(url); | ||
| 30 | + //使用javascript 打开url或直接跳转。 | ||
| 31 | + } | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +``` | ||
| 4 | \ No newline at end of file | 35 | \ No newline at end of file |