iOS:逐步集成 PayPal braintree

问题描述 投票:0回答:1

在我的申请中我需要提供,客户应该使用信用卡支付。 Paypal 手机SDK 不支持

所以我需要整合 Brain tree,但我找不到合适的步骤来整合它。

任何人都可以帮助我将 paypal braintree 集成到我的应用程序中。

ios objective-c paypal braintree
1个回答
1
投票

在下面搜索文档以获取更多详细信息!

https://developers.braintreepayments.com/guides/paypal/client-side/ios/v4

#import "BraintreePayPal.h"

- (void)viewDidLoad {
[super viewDidLoad];

self.braintreeClient = [[BTAPIClient alloc] initWithAuthorization:@"<#CLIENT_AUTHORIZATION#>"];

UIButton *customPayPalButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 60, 120)];
[customPayPalButton addTarget:self
                       action:@selector(customPayPalButtonTapped:)
             forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:customPayPalButton];
}


- (IBAction)customPayPalButtonTapped:(id)sender {
BTPayPalDriver *payPalDriver = [[BTPayPalDriver alloc] initWithAPIClient:self.braintreeClient];
payPalDriver.viewControllerPresentingDelegate = self;
payPalDriver.appSwitchDelegate = self; // Optional

// Start the Vault flow, or...
[payPalDriver authorizeAccountWithCompletion:^(BTPayPalAccountNonce *tokenizedPayPalAccount, NSError *error) {
    ...
}];

// ...start the Checkout flow
BTPayPalRequest *request = [[BTPayPalRequest alloc] initWithAmount:@"1.00"];  //Here you need to enter the amount 
[payPalDriver requestOneTimePayment:request
                        completion:^(BTPayPalAccountNonce *tokenizedPayPalAccount, NSError *error) {
    ...
}];
}
© www.soinside.com 2019 - 2024. All rights reserved.