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. 破解百度云盘MAC下载限速问题

    由于电脑更新问题,所以把电脑上的所有东西清除了.突然发现自己以前的东西还都在百度云盘上,但由于MAC 下载百度云盘上的东西只有几K或者几十K,这个网速对于小文件还能忍受,但如果是大文件就无法容忍了. ...

  2. vue+webpack 遇到的问题总结

    1.错误1:TypeError:this.init is not a function 解决:安装相关的加载器,npm install vue-loader vue-html-loader vue-s ...

  3. 极客无极限 一行HTML5代码引发的创意大爆炸

    摘要:一行HTML5代码能做什么?国外开发者Jose Jesus Perez Aguinaga写了一行HTML5代码的文本编辑器.这件事在分享到Code Wall.Hacker News之后,引起了众 ...

  4. flask 模板block super()的讲解

    Flask强大的地方就可以引用模板,而且非常方便. 这里不得不介绍block这个概念. 模板的文件一般放在templates文件夹下,我们这里新建一个HTML文件,存放模板,'base.html' 在 ...

  5. Springzz中使用监听器,用于容器一启动就加载准备数据(application范围内的数据,用于减轻服务器压力,不用每次都去查数据)

    java代码: public class InitListener implements ServletContextListener { public void contextInitialized ...

  6. 不让Editplus保存时java文件时生成.bak文件

    EditPlus是一个强大的编辑工具,不单单是编辑文字强大,很多的刚开始学习编程语言的初学者会选择它,例如 html,js,php,java.但是却遇到一个问题,就是每次编辑完后点保存就会出 现bak ...

  7. Go语言之高级篇beego框架之Controller

    一.Controller 控制器 Controller等同于Django里的view,处理逻辑都是在Controller里面完成的,下面就写一个最简单的Controller.写controller的时 ...

  8. 全景分割pipeline搭建

    全景分割pipeline搭建 整体方法使用语义分割和实例分割结果,融合标签得到全景分割结果: 数据集使用:panoptic_annotations_trainval2017和cityscapes; p ...

  9. 【Spark】为什么没有任务调度到新增的Worker之上???

    参考资料: https://stackoverflow.com/questions/34818880/spark-why-tasks-assigned-only-to-one-worker?utm_m ...

  10. 从n个元素中选择k个的所有组合(包含重复元素)

    LeetCode:Combinations这篇博客中给出了不包含重复元素求组合的5种解法.我们在这些解法的基础上修改以支持包含重复元素的情况.对于这种情况,首先肯定要对数组排序,以下不再强调 修改算法 ...