How to implement a payment app with Braintree in iOS
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.
You can access the payment method nonce via the result
object within showDropIn()
. This is also where you may call postNonceToServer()
.
func showDropIn(clientTokenOrTokenizationKey: String) {
let request = BTDropInRequest()
request.amount = "\(total)"
request.currencyCode = "MXN"
let dropIn = BTDropInController(authorization: clientTokenOrTokenizationKey, request: request)
{ (controller, result, error) in
if (error != nil) {
print("ERROR")
} else if (result?.isCancelled == true) {
print("CANCELLED")
} else if let result = result {
let selectedPaymentMethod = result.paymentMethod! // retrieve the payment method.
self.postNonceToServer(paymentMethodNonce: selectedPaymentMethod.nonce) // call postNonceToServer() with the nonce from the selected payment method.
}
controller.dismiss(animated: true, completion: nil)
}
self.present(dropIn!, animated: true, completion: nil)
}
After you successfully call postNonceToServer()
you can receive the payment method nonce and create a transaction on your server.
Braintree for iOS apps with paypal integration
I work at Braintree. If you have more questions, please reach out to our support team.
Yes, the Braintree iOS SDK includes PayPal support:
PayPal
Braintree offers a few options when accepting PayPal payments. First,
you'll need to choose whether you would like to use our Drop-In UI or
a custom integration.Vault vs. Checkout
Next, you can choose between our Vault and Checkout flows. Below is a
comparison of the two options:
- Vault Compatibility: iOS, Android, and web
- Checkout Compatibility: Web only
How to integrate braintree to iOS or Android app using flutter?
The pub you posted is discontinued. Please move to this. Anyway, it's possible :)
Using Braintree for iOS subscriptions
In reading the App Store Review Guidelines, specifically section 11 (about purchasing), I'm pretty sure it would be rejected under rule 11.2:
11.2 Apps utilizing a system other than the In-App Purchase API (IAP) to purchase content, functionality, or services in an App will be rejected
I think Apple would categorize a subscription as a 'service', and PayPal isn't IAP, so your app would be rejected. Use IAP.
Braintree iOS Drop-in Payment UI customization
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact [support][support].
There is no way to change text or access fields in the Drop-In UI. To have more control over the interface, the developer docs for client-side payment processing have instructions on how to tokenize payment information without the Drop-In UI.
Related Topics
Differrence Between Closure and Function as Argument in Swift
Uidocumentinteractioncontroller() Swift
Please Specify a Platform for This Target in Your Podfile
Xcode6/Swift: Unrecognized Selector Sent to Instance
Core Data Transient Values with Swift
How to Insert Items at 0 Index to the Realm Container
How to Automatically Create an Initializer for a Swift Class
Unusernotificationcenter.Current().Getdeliverednotifications Only Ever Returns an Empty Array
Different Cell in Tableview Swift 3
Why am I Getting an Error Regarding Bolts Framework and Facebooksdk When I'm Not Even Using Bolts
Swiftui Transition from Modal Sheet to Regular View with Navigation Link
Replaykit Startrecording Sometimes Never Enters Completion Handler
Uitextfield Keyboard with Only Alphabet, No Numbers, No Caps, No Spacebar
Changing the Shape of a Uiview Border
Swift Uinavigation Bottom Line and Shadow Remove Without Navbar Color Change
Issue with Observing Wkwebview Url Changes via JavaScript Events
Setting a Stateobject Value from Child View Causes Navigationview to Pop All Views