https://developer.paypal.com

cocoapods 管理 引入

pod 'PayPal-iOS-SDK'

1.在appdelegate

#import <PayPalMobile.h>

//#define PAYPAL_SANDBOX  @"AcQxuBDdBh3jNaYTnB79coxVr3wihIQVkJzI1stUX4V2yJByccNTgKNu1zeO"

#define PAYPAL_PRODUCTION @"AZF********"

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    [PayPalMobile initializeWithClientIdsForEnvironments:@{PayPalEnvironmentSandbox:PAYPAL_SANDBOX}];

//    [PayPalMobile initializeWithClientIdsForEnvironments:@{PayPalEnvironmentProduction : PAYPAL_PRODUCTION}];

}

2.支付页面

#import <PayPalMobile.h>

遵循 <PayPalPaymentDelegate>//Paypal支付

@property(nonatomic, strong, readwrite) PayPalConfiguration *payPalConfig;

- (void)viewWillAppear:(BOOL)animated {

    [super viewWillAppear:animated];
[PayPalMobile preconnectWithEnvironment:PayPalEnvironmentProduction];
}
#pragma mark - PaypalSDK支付
- (void)onClickPayPalButtonAction:(UIButton *)sender
{
_payPalConfig = [[PayPalConfiguration alloc] init];
_payPalConfig.acceptCreditCards = NO;
_payPalConfig.languageOrLocale = [NSLocale preferredLanguages][]; NSString *priceString = [NSString stringWithFormat:@"%f",_totalPrice];
NSDecimalNumber *total = [NSDecimalNumber decimalNumberWithString:priceString]; PayPalPayment *payment = [[PayPalPayment alloc] init];
payment.amount = total;
payment.currencyCode = @"HKD";
payment.shortDescription = @"#####订单描述";
payment.custom = @"";//self.order.order_no; PayPalPaymentViewController *paymentViewController = [[PayPalPaymentViewController alloc]initWithPayment:payment configuration:self.payPalConfig delegate:self];
[self presentViewController:paymentViewController animated:YES completion:nil];
} #pragma mark PayPalPaymentDelegate methods - (void)payPalPaymentViewController:(PayPalPaymentViewController *)paymentViewController didCompletePayment:(PayPalPayment *)completedPayment {
NSLog(@"PayPal Payment Success!"); // [[NSNotificationCenter defaultCenter]postNotificationName:kNoticePaidSuccess object:@"paypal"userInfo:nil]; [self dismissViewControllerAnimated:YES completion:nil];
} - (void)payPalPaymentDidCancel:(PayPalPaymentViewController *)paymentViewController {
NSLog(@"PayPal Payment Canceled"); [self dismissViewControllerAnimated:YES completion:nil]; UIAlertView *alert = [[UIAlertView alloc]initWithTitle:NSLocalizedString(@"支付结果", nil) message:NSLocalizedString(@"支付失败!请重新支付", nil) delegate:nil cancelButtonTitle:NSLocalizedString(@"确定", nil) otherButtonTitles:nil];
[alert show]; }

附录 网站步奏 https://developer.paypal.com/docs/api/quickstart/credentials/?mark=client%20id

Create an app to get credentials

Create an app to get credentials and use these credentials to authenticate when you make REST API requests.

  1. Go to My Apps & Credentials. Click Log In.

  2. In the REST API apps section, click Create App.

  3. On the Create New App page, enter an app name, select your sandbox developer account, and click Create App.

  4. The Sandbox tab shows your client ID. Click Show to show your secret. Note your client ID and secret. You'll need these values later.

Stay logged in for the next step.

Next

Create a test account

集成paypal支付的更多相关文章

  1. 网页集成paypal支付

    在网站中集成paypal支付有两种方式: 1.通过paypal账户的按钮创建工具 进入paypal 商户账号,选择创建按钮工具,有包括添加到购物车.购买.租用三类按钮. 之后会生成一段代码,直接将代码 ...

  2. Android下集成Paypal支付

    近期项目需要研究paypal支付,官网上的指导写的过于复杂,可能是老外的思维和中国人不一样吧.难得是发现下面这篇文章: http://www.androidhive.info/2015/02/andr ...

  3. 最详细的 paypal 支付接口开发--Java版

    做全球性的支付,选用paypal!为什么选择paypal? 因为paypal是目前全球最大的在线支付工具,就像国内的支付宝一样,是一个基于买卖双方的第三方平台.买家只需知道你的paypal账号,即可在 ...

  4. Python3+Django2集成PayPal(贝宝)跨境支付三方接口以及订单查询和退款业务

    原文转载自「刘悦的技术博客」https://v3u.cn/a_id_157 如果您所在的公司涉及外贸或者跨境支付业务,那一定听说过大名鼎鼎的PayPal,总的来说,PayPal在跨国贸易里的优势还是比 ...

  5. 【网站国际化必备】Asp.Net MVC 集成Paypal(贝宝)快速结账 支付接口 ,附源码demo

    开篇先给大家讲段历史故事,博主是湖北襄阳人.襄阳物华天宝,人杰地灵,曾用名襄樊.在2800多年的历史文化中出现了一代名相诸葛亮(卧龙),三国名士庞统(凤雏),魏晋隐士司马徽(水镜先生),唐代大诗人孟浩 ...

  6. .Net集成PayPal的Demo

    .Net集成PayPal的Demo 近来项目中需要使用Paypal(贝宝)支付,研究了一下接口,真是吐血,花了一个下午+一个晚上,屡败屡战,海淘了若干文档,终于尝试成功了,分享一下,希望对将要使用pa ...

  7. PayPal支付-Reaact框架

    前情提要 之前用React框架做过一个网站的开发,客户是国外的公司,所以为迎合受众,支付模块添加了我国不常用但国外常用的Paypal.最近在整理文档,就把当时写的这篇经验总结再整合以下发布. payp ...

  8. Paypal支付小记

    Paypal支付小记 *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: 0 !impo ...

  9. ecstore使用paypal支付显示不支持此支付

    问题描述: ecstore使用paypal支付,下单结算时显示不支持此支付. 问题和代码分析: 1.首先必须要保证默认货币是paypal支持的货币,paypal目前支付 ["supportC ...

随机推荐

  1. dictEntry **table;

    typedef struct dictht { dictEntry **table; PORT_ULONG size; PORT_ULONG sizemask; PORT_ULONG used;} d ...

  2. easyUI之layout

    此组件与easyUI中的其它组件加载的方式相同,载为class方式和js方式,但此组件更多的是用class方式,其它的用js方式更为灵活.它继承panel组件及resize组件. 包括多个<di ...

  3. linq实现左连接

    1.左连接: var LeftJoin = from emp in ListOfEmployees join dept in ListOfDepartment on emp.DeptID equals ...

  4. oracle监控脚本

    简单命令 1.显示服务器上的可用实例:ps -ef | grep smon2.显示服务器上的可用监听器:ps -ef | grep -i listener | grep -v grep3.查看Orac ...

  5. openjudge-回文串判断【递归】

    回文串判断 总时间限制: 1000ms 内存限制: 65536kB 描述 任意给定一个非空的字符串,判断其是否是回文串.回文串是指正向看和反向看均相等的串,如AbcDcbA和cDDc.如果是回文串,则 ...

  6. 【转】ASP.NET服务器控件使用之MultiView和View

    MultiView 和 View 控件和制作出选项卡的效果,MultiView 控件是一组 View 控件的容器.使用它可定义一组 View 控件,其中每个 View 控件都包含子控件. 如果要切换视 ...

  7. 生成n个数的全排列【递归、回溯】

    下面讨论的是n个互不相同的数形成的不同排列的个数.毕竟,假如n个数当中有相同的数,那n!种排列当中肯定会有一些排列是重复的,这样就是一个不一样的问题了. /*===================== ...

  8. html中间块居中宽度自适应

    说来,这个其实不是个多难的事情,但是,若没有经验或者没有了解过html原数在浏览器中显示的顺序,可能还真是个问题,不知如何调整. 先说明下,在确定了左右两边显示的块的宽度后,再让中间块的宽度自适应,这 ...

  9. [摘]Hibernate查询事务必要性

    背景: 添加事务与否都不影响Hibernate的查询操作. 问题: 查询操作是否有必要添加事务? 答案1: Hibernate官方手册上建议任何操作(增删改查)都需要添加事务. 答案2: robbin ...

  10. Mongodb集群搭建及spring和java连接配置记录

    一.基本环境: mongdb3.0.5数据库 spring-data-mongodb-1.7.2.jar mongo-java-driver-3.0.2.jar linux-redhat6.3 tom ...