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 = 1,
                    allow_note = true,
                    no_shipping = 2
                }
                ,
                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;

时间: 2024-08-10 15:12:05

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

php根据IP地址跳转对应的城市,淘宝REST api调用地址直接使用

<?php // 定义一个函数getIP() function getIP(){ global $ip; if (getenv("HTTP_CLIENT_IP")) { $ip = getenv("HTTP_CLIENT_IP"); }else if(getenv("HTTP_X_FORWARDED_FOR")) { $ip = getenv("HTTP_X_FORWARDED_FOR"); }else if(geten

nginx 设置错误的自定义404页面跳转到500

5年前写的站, 当时是在apache下写的error page, 换了nginx后, 404页面直接跳到了500 服务器内部错误. 只需要在配置 try_files 的时候指定一下就可以了 我的是debian, 在/etc/nginx/site-available/default 里面location / server{ </pre><pre name="code" class="plain"> location / { <span s

自定义Activity的跳转动画

本来感觉是一个很小的需求, 后来发现老是 出问题, 使用Theme在 4.0上 操作不是很好用. 后来查阅资料, 需要在finish 后面 和 startActivity 后面添加 overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out); 这句话 但是每个地方都添加这个代码也很坑爹, 于是看了一下ECShop的实现,发现是在BaseActivity加入的.. @Override public void star

百度地图API自定义地图

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Typ

跳转某指定地址、给某绝对地址赋值

1.程序跳转至某地址执行 (1)把那个要跳的地址转换成一个函数指针,然后调用这个函数指针. 如想跳转至0x30700000地址上运行程序: (*(void (*)(void))(0x30700000))();或者typedef void(*)() p; //先将p设置为返回值为void,形参为void的函数指针*((p)0x100000)(); //将地址0x30700000强制转换成函数指针,并在前面加上*,调用这个函数 首先(void( * )(void) )是一个强制类型转换符,他将后面的

web Api自定义部分Action的JSON格式输出

昨天项目中要部分Api的JSON格式需要特殊处理.最开始直接重写controller的JSON方法.经测试,当action直接返回数据的时候,不会调用Json方法. 然后找了各种方法,都不行.在群里问了.直到看到群友发的一个直接移除所有API的JSON格式方法的时候.图片如下: 然后就想到了Api的ActionFilterAttribute.就解决了自己的需求. 上代码.懒得写说明. 1 public class AppFilterAttribte : ActionFilterAttribute

根据Email地址跳转到相应的邮箱登录页面 (转)

//跳转到指定的邮箱登录页面 $(".btn_actemail").click(function () { var uurl = $(".hide_email").val(); uurl = gotoEmail(uurl); if (uurl != "") { $(".toopen").attr("href", "http://"+uurl); $(".toopen"

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

在网页中插入百度地图 如果想在自己的网页上面加入百度地图的话,可以用百度地图的api.具体使用方法如下: 第一步:进入百度创建地图的网站http://api.map.baidu.com/lbsapi/creatmap/,搜索出自己要展示的位置,如下图所示. 第二步:设置地图,大家可以对网站显示地图的宽高进行设置,其余选项不动. 第三步:添加标注.点击第一个图标后,在右侧找到自己的位置,单击鼠标左键可定位.标记图标处可更换图标形状,名称和备注填入位置相关信息. 第四步:获取代码.将代码贴到你的网页

每次打开新标签页,都会提示“无法访问此网站”。并自动跳转到一个地址

使用该版本的chrome后,每次打开新标签页,都会提示"无法访问此网站".并自动跳转到一个地址"http://www.google.com.hk/url?sa=p&hl=zh-CN&pref=hkredirect&pval=yes&q=http://www.google.com.hk/_/chrome/newtab-"说明问题是因为此处访问google使用的地址是http协议.解决方式如下:输入:chrome://net-intern