Secure Remote Commerce
Client-Side Implementation
Availability
Masterpass, Amex Express Checkout, and Visa Checkout have been replaced with the latest unified
checkout experience offered through Visa known as Secure Remote Commerce. If you were previously
using Masterpass or Amex Express Checkout, you will need to integrate with SRC. If you were using
Visa Checkout, you do not have to change your integration as SRC is an updated version of Visa
Checkout. As such, you may see Visa Checkout referenced elsewhere in our documentation. SRC is
currently in a limited release to
eligible merchants, and the API is subject to change. It is available in iOS v4+ and JavaScript v3+.Contact us to request access to the release.
Installation
Braintree
Important
The SSL certificates for all Braintree SDKs are set to expire by June 30, 2025. This will impact
existing versions of the SDK in published versions of your app. To reduce the impact, upgrade the
iOS SDK to version 6.17.0+
for the new SSL certifications.. If you do not decommission your app versions that include the
older SDK versions or force upgrade your app with the updated certificates by the expiration date,
100% of your customer traffic will fail.
- Ruby
pod 'BraintreeVisaCheckout'
SRC
The Braintree Visa Checkout SDK depends on and includes
VisaCheckoutSDK
v7.2.0. It requires Xcode 12.0.
.Important
You are not required to sign up with SRC. If you already have, do not initialize the SRC component
with your own SRC credentials. These details will be handled internally by the Braintree SDK.
Initialization
-
Configure the
VisaCheckoutSDK
when your app launches:.- Swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { VisaCheckoutSDK.configure() return true }
-
Instantiate a
BTAPIClient
using the appropriate authorization- If using 3D Secure with Visa Checkout, you must use a client token from your server
- Otherwise, you can choose between a tokenization key or a client token
-
Instantiate a
BTVisaCheckoutClient
:.- Swift
let client = BTAPIClient(authorization: "<#CLIENT_AUTHORIZATION#>")! self.visaCheckoutClient = BTVisaCheckoutClient(apiClient: client)
-
Create a
Profile
using theBTVisaCheckoutClient
:.- Swift
self.visaCheckoutClient.createProfile() { (profile, error) in guard let profile = profile as? Profile else { print("Failed to create Visa profile: (error!)") return; } // Customize the Visa Checkout experience profile.displayName = "My Merchant Name" }
Generating a client token
If you choose to use a client token, you must generate it on the server and make it accessible to
your client.. To use a merchant account ID other than your default, specify the
MerchantAccountId
when generating the client token. This merchant account ID must match
the merchant account ID used to create the transaction.
Specifying payment details
Note
- Create a
PurchaseInfo
object, passing in an amount and currency - Specify additional payment details on this object, e.g. description, subtotal, shipping
- Swift
let total = CurrencyAmount(string: "1.00")
let purchaseInfo = PurchaseInfo(total: total, currency: .usd)
// Customize the purchase info
purchaseInfo.customDescription = "My Description"
Tokenizing
- Create a
VisaCheckoutButton
and set it up -
Call
visaCheckoutClient.tokenize(CheckoutResult)
with aCheckoutResult
-
We tokenize the result and return a
VisaCheckoutNonce
in thecompletion
block
- Swift
let checkoutButton = VisaCheckoutButton.init(frame: CGRect.init(x: 0, y: 0, width: 213, height: 47))
self.view.addSubview(checkoutButton)
checkoutButton.onCheckout(profile: profile, purchaseInfo: purchaseInfo, presenting: self, onReady: { (launchHandler) in
self.launchHandler = launchHandler
}, onButtonTapped: {
self.launchHandler()
}, completion: { (result) in
self.client.tokenize(result, completion: { (tokenizedVisaCheckoutCard, error) in
if error != nil {
print("Error tokenizing Visa Checkout card: %@", error.localizedDescription)
} else if tokenizedVisaCheckoutCard != nil {
// Send this nonce to your server, and create a transaction there.
let nonce = tokenizedVisaCheckoutCard.nonce
// Access Visa Checkout properties from this `VisaCheckoutCardNonce`, e.g.
let shippingAddress = tokenizedVisaCheckoutCard.shippingAddress
} else {
// User canceled.
}
})
})