7

Updating Braintree to the Latest Version in Xamarin Forms

 3 years ago
source link: https://www.xamboy.com/2021/04/01/updating-braintree-to-the-latest-version-in-xamarin-forms/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Updating Braintree to the Latest Version in Xamarin Forms

Screen-Shot-2021-03-30-at-4.21.15-PM.png?fit=1680%2C1100&ssl=1

A time ago I wrote a series of articles on how to integrate Braintree Payment in Xamarin Forms, since then a few things have changed. In this article, I’m going to guide you step by step on what you need to do if you were using the Naxam.BrainTree.Droid <= v3.14.0 and/or Naxam.BraintreeCore.iOS <= 4.11.0 and you want to update it to the latest versions. 

IMPORTANT: If you are using an old version of this package is important you update it due to the Braintree SDK Deprecation policy,

Android

1. Update the Packages

Before doing anything if you haven’t updated the project to Android X is important you do that first. If you don’t know how to, I recommend you to read this article.

After that, update all the Braintree packages you are using to the latest version:

2. Small code changes

1.Instead of doing:

PayPal.AuthorizeAccount(mBraintreeFragment);

PayPal.RequestOneTimePayment(mBraintreeFragment, new PayPalRequest($"{amount}"));

2.Instead of doing:

mBraintreeFragment = BraintreeFragment.NewInstance(CrossCurrentActivity.Current.Activity, clientToken);

mBraintreeFragment = BraintreeFragment.NewInstance((AppCompatActivity)CrossCurrentActivity.Current.Activity, clientToken);

iOS

In iOS, you just must update all the Braintree related packages to the latest version and all the code should work the same.

You can check the full source code used here.

Happy Update!

Be First to Comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Comment

Name*

Email*

Website

Notify me of follow-up comments by email.

Notify me of new posts by email.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK