Braintree iOS v4 SDK
Posted
技术标签:
【中文标题】Braintree iOS v4 SDK【英文标题】: 【发布时间】:2016-12-15 09:32:24 【问题描述】:我在我的应用程序中集成了 Braintree SDK。我的应用程序使用 Swift 语言构建。我的问题是,如果我在其中使用 ios SDK,它还需要在服务器端进行一些设置用于 paymentMethodNonce?
【问题讨论】:
【参考方案1】:使用Braintree
为PayPal
生成Nonce
BTPayPalRequest *request= [[BTPayPalRequest alloc] initWithAmount:amount];
request.currencyCode = @"USD"; // Optional; see BTPayPalRequest.h for other options
[payPalDriver requestOneTimePayment:request completion:^(BTPayPalAccountNonce * _Nullable tokenizedPayPalAccount, NSError * _Nullable error)
if (tokenizedPayPalAccount)
NSLog(@"Got a nonce: %@", tokenizedPayPalAccount.nonce);
else
// Buyer canceled payment approval
// Tokenization failed. Check `error` for the cause of the failure.
];
使用Braintree
为Apple Pay
生成Nonce
// Example: Tokenize the Apple Pay payment
BTApplePayClient *applePayClient = [[BTApplePayClient alloc]
initWithAPIClient:self.braintreeClient];
[applePayClient tokenizeApplePayPayment:payment
completion:^(BTApplePayCardNonce *tokenizedApplePayPayment,
NSError *error)
if (tokenizedApplePayPayment)
NSLog(@"nonce = %@", tokenizedApplePayPayment.nonce);
else
// Tokenization failed. Check `error` for the cause of the failure.
// Indicate failure via the completion callback:
completion(PKPaymentAuthorizationStatusFailure);
];
【讨论】:
以上是关于Braintree iOS v4 SDK的主要内容,如果未能解决你的问题,请参考以下文章