Paypal Rest Api自定义物流地址(跳过填写物流地址)
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自定义物流地址(跳过填写物流地址)的更多相关文章
- 配置IPv6地址跳变——网络测试仪实操
第一部分:什么是IPv6地址跳变? IPv6地址跳变是指IPv6地址进行一系列有规则的变化,Renix支持对IPv6地址进行递增.递减.列表和随机变化. 如当用户想要仿真大量的源IPv6地址变化的数据 ...
- Android 用 camera2 API 自定义相机
前言 笔者因为项目需要自定义相机,所以了解了一下 Android 关于 camera 这块的 API.Android SDK 21(LOLLIPOP) 开始已经弃用了之前的 Camera 类,提供了 ...
- 如何在网中使用百度地图API自定义个性化地图
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- 《ASP.NET Core跨平台开发从入门到实战》Web API自定义格式化protobuf
<ASP.NET Core跨平台开发从入门到实战>样章节 Web API自定义格式化protobuf. 样章 Protocol Buffers 是一种轻便高效的结构化数据存储格式,可以用于 ...
- Java 使用正则表达式取出图片地址以及跳转的链接地址,来判断死链(一)
任务:通过driver的getPageSource()获取网页的源码内容,在把网页中图片链接地址和跳转的url地址进行过滤,在get每个请求,来判断是否是死链 如图: 获取网页源码中所有的href,以 ...
- 百度地图API自定义地图
http://api.map.baidu.com/lbsapi/creatmap/index.html http://developer.baidu.com/map/index.php?title=w ...
- 网页嵌入百度地图和使用百度地图api自定义地图的详细步骤
在网页中插入百度地图 如果想在自己的网页上面加入百度地图的话,可以用百度地图的api.具体使用方法如下: 第一步:进入百度创建地图的网站http://api.map.baidu.com/lbsapi/ ...
- API之IP地址查询---权威的IP地址查询接口集合
原文地址:http://yushine.iteye.com/blog/1717586 推荐实用IP138 http://www.baidu.com/s?wd=IP&rsv_spt=1& ...
- 程序启动的目录不一样.ajax请求的地址跳转会出现的问题
程序启动的目录不一样.ajax请求的地址跳转会出现的问题启动 frontend/web/启动 frontend/ $.ajax({ url:"<?php echo Yii::$app- ...
随机推荐
- NMAP为什么扫描不到端口
NMAP为什么扫描不到端口 NMAP是知名的网络端口扫描工具.但很多新人发现,使用NMAP经常扫描不出来任何端口,尤其是手机之类.这实际存在一个理解上的误区.扫描端口是为了发现主机/设备上存在的对 ...
- python 分类
python分类.机器学习连接 http://blog.csdn.net/eastmount/article/details/50473675 python机器学习列表 http://blog.csd ...
- 码云 使用 汉化 GitHub
enhancement 增强feature 功能duplicate 重复的invalid 无效的wontfix 无法修改 不处理 ===== Wiki 主要是您项目的文档(说明, 状态)等等. 该项目 ...
- BZOJ.3598.[SCOI2014]方伯伯的商场之旅(贪心 数位DP)
题目链接 先考虑,对于确定的一个数,怎样移动代价最少(或者移到哪个位置最优)? 假设我们都移到下标\(1\)位置(设集合点为\(1\)),那么移动到下标\(2\)与\(1\)相比代价差为:\(下标&l ...
- BZOJ.3262.陌上花开([模板]CDQ分治 三维偏序)
题目链接 BZOJ3262 洛谷P3810 /* 5904kb 872ms 对于相邻x,y,z相同的元素要进行去重,并记录次数算入贡献(它们之间产生的答案是一样的,但不去重会..) */ #inclu ...
- js正则表达式中的
$(function(){ //match方法---返回的是数组 var str = "1215rere565656"; alert(str.match(/\d+/g));cons ...
- Tcp端口以及端口相关协议详解
http://www.codeweblog.com/tcp%e5%b8%b8%e7%94%a8%e7%ab%af%e5%8f%a3/
- Tcp的三次握手,以及原理详解
http://blog.sina.com.cn/s/blog_6002b97001018fxh.html
- 【转】两道面试题,带你解析Java类加载机制(类初始化方法 和 对象初始化方法)
本文转自 https://www.cnblogs.com/chanshuyi/p/the_java_class_load_mechamism.html 关键语句 我们只知道有一个构造方法,但实际上Ja ...
- AngularJS中获取数据源的几种方式
在AngularJS中,可以从$rootScope中获取数据源,也可以把获取数据的逻辑封装在service中,然后注入到app.run函数中,或者注入到controller中.本篇就来整理获取数据的几 ...