PayPal之前的Rest Api是不支持自定义物流地址的,最新升级版本的提供了这个服务(Payment Experience),大概步骤如下:

1.申请一个自定义的配置ID

  自定义配置包括Logo,Url,Shipping物流地址方案,允许填写备注等等

2.生成订单付款的时候,将该ID传送

示例代码在最新的SDK中都有Demo;如下:

一、Payment Experience Create

            var apiContext = Configuration.GetAPIContext();

            // Setup the profile we want to create
var profile = new WebProfile()
{
name = Guid.NewGuid().ToString(),
presentation = new Presentation()
{
brand_name = "Sample brand",
locale_code = "US",
logo_image = "https://www.paypal.com/"
},
input_fields = new InputFields()
{
address_override = ,
allow_note = true,
no_shipping =
}
,
flow_config = new FlowConfig()
{
bank_txn_pending_url = "https://www.paypal.com/",
landing_page_type = "billing"
}
}; // Create the profile
var response = profile.Create(apiContext); #region Cleanup
// Cleanup by deleting the newly-created profile
var retrievedProfile = WebProfile.Get(apiContext, response.id);
retrievedProfile.Delete(apiContext);
#endregion

InputFields.no_shipping:

// 摘要:
// Determines whether or not PayPal displays shipping address fields on the
// experience pages. Allowed values: `0`, `1`, or `2`. When set to `0`, PayPal
// displays the shipping address on the PayPal pages. When set to `1`, PayPal
// does not display shipping address fields whatsoever. When set to `2`, if
// you do not pass the shipping address, PayPal obtains it from the buyer's
// account profile. For digital goods, this field is required, and you must
// set it to `1`.

如何传递用户的ShippingAddress?

            ItemList itemList = new ItemList();
itemList.items = itms;
//设置运送地址
ShippingAddress payaddress = new ShippingAddress();
payaddress.city = temp.City + "," + temp.Province; payaddress.line1 = temp.Address1;
payaddress.line2 = temp.Address2;
payaddress.phone = temp.TelPhone;
payaddress.postal_code = temp.PostalCode;
payaddress.country_code = temp.Country;
payaddress.recipient_name = temp.FirstName + " " + temp.LastName; itemList.shipping_address = payaddress;

Paypal Rest Api自定义物流地址(跳过填写物流地址)的更多相关文章

  1. 配置IPv6地址跳变——网络测试仪实操

    第一部分:什么是IPv6地址跳变? IPv6地址跳变是指IPv6地址进行一系列有规则的变化,Renix支持对IPv6地址进行递增.递减.列表和随机变化. 如当用户想要仿真大量的源IPv6地址变化的数据 ...

  2. Android 用 camera2 API 自定义相机

    前言 笔者因为项目需要自定义相机,所以了解了一下 Android 关于 camera 这块的 API.Android SDK 21(LOLLIPOP) 开始已经弃用了之前的 Camera 类,提供了 ...

  3. 如何在网中使用百度地图API自定义个性化地图

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  4. 《ASP.NET Core跨平台开发从入门到实战》Web API自定义格式化protobuf

    <ASP.NET Core跨平台开发从入门到实战>样章节 Web API自定义格式化protobuf. 样章 Protocol Buffers 是一种轻便高效的结构化数据存储格式,可以用于 ...

  5. Java 使用正则表达式取出图片地址以及跳转的链接地址,来判断死链(一)

    任务:通过driver的getPageSource()获取网页的源码内容,在把网页中图片链接地址和跳转的url地址进行过滤,在get每个请求,来判断是否是死链 如图: 获取网页源码中所有的href,以 ...

  6. 百度地图API自定义地图

    http://api.map.baidu.com/lbsapi/creatmap/index.html http://developer.baidu.com/map/index.php?title=w ...

  7. 网页嵌入百度地图和使用百度地图api自定义地图的详细步骤

    在网页中插入百度地图 如果想在自己的网页上面加入百度地图的话,可以用百度地图的api.具体使用方法如下: 第一步:进入百度创建地图的网站http://api.map.baidu.com/lbsapi/ ...

  8. API之IP地址查询---权威的IP地址查询接口集合

    原文地址:http://yushine.iteye.com/blog/1717586 推荐实用IP138 http://www.baidu.com/s?wd=IP&rsv_spt=1& ...

  9. 程序启动的目录不一样.ajax请求的地址跳转会出现的问题

    程序启动的目录不一样.ajax请求的地址跳转会出现的问题启动 frontend/web/启动 frontend/ $.ajax({ url:"<?php echo Yii::$app- ...

随机推荐

  1. 漫谈可视化Prefuse(六)

    可视化一路走来,体会很多:博客一路写来,收获颇丰:代码一路码来,思路越来越清晰.终究还是明白了一句古话:纸上得来终觉浅,绝知此事要躬行. 跌跌撞撞整合了个可视化小tool,零零碎碎结交了众多的志同道合 ...

  2. Linux输入设备详解

    <什么是Linux输入设备> ➤简介      Linux输入设备总类繁杂,常见的包括有按键.键盘.触摸屏.鼠标.摇杆等等,他们本身就是字符设备,而linux内核将这些设备的共同性抽象出来 ...

  3. Python中应用SQL及SQLAlchemy(一)

    以SQLit3为例: import sqlite3 conn = sqlite3.connect('db.sqlite3') #获取游标对象 cur = conn.cursor() #执行一系列SQL ...

  4. SPOJTLE - Time Limit Exceeded(高维前缀和)

    题意 题目链接 题目的意思是给一个数组C,长度为n,每个数字的范围是2^m,然后要求构造一个数组a,满足 1.a[i] % C[i] !=0 ; 2.a[i] < 2^m ; 3.a[i] &a ...

  5. 洛谷.1501.[国家集训队]Tree II(LCT)

    题目链接 日常zz被define里没取模坑 //标记下放同线段树 注意51061^2 > 2147483647,要开unsigned int //*sz[]别忘了.. #include < ...

  6. 潭州课堂25班:Ph201805201 WEB 之 页面编写 第一课 (课堂笔记)

    index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset=&quo ...

  7. BZOJ4374 : Little Elephant and Boxes

    设$f[i][j][k]$表示前$i$个物品买了$j$个,消耗$k$个钻石,最少花多少钱,可以通过简单的DP求出. 枚举拥有的钻石数以及最多能购买的物品数的下界,那么钱数的下界是定值. 将$n$个箱子 ...

  8. Phone漂亮的动画

    //此处标明非原创 实现iPhone漂亮的动画效果主要有两种方法, 一种是UIView层面的, 一种是使用CATransition进行更低层次的控制, 第一种是UIView,UIView方式可能在低层 ...

  9. Scala:HelloWorld

    代码 object HelloWorld { def main(args: Array[String]): Unit = { println("Hello world") } } ...

  10. python测试开发django-47.xadmin上传图片和文件

    前言 xadmin上传图片和上传文件功能 依赖环境 如果没安装Pillow的话,会有报错:practise.Upload.upload_image: (fields.E210) Cannot use ...