我在我的应用程序中集成了Braintree SDK。我的应用程序使用Swift语言构建。我的问题是,如果我在我的服务器上使用iOS SDK,还需要在服务器端为paymentMethodNonce设置一些设置吗?
答案 0 :(得分:0)
使用Nonce
为PayPal
生成Braintree
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.
}
}];
使用Nonce
为Apple Pay
生成Braintree
// 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);
}
}];