public async Task <string> TokenizePayPal() { payTcs = new TaskCompletionSource <string>(); if (isReady) { mBraintreeFragment.AddListener(this); PayPal.AuthorizeAccount(mBraintreeFragment); } else { OnTokenizationError?.Invoke(this, "Platform is not ready to accept payments"); payTcs.TrySetException(new System.Exception("Platform is not ready to accept payments")); } return(await payTcs.Task); }
public async Task <PaymentMethodNonce> AuthorizePaypalPaymentAsync(bool requestBillingAgreement, string[] additionalParameters = null, PayPalRequest request = null) { var actionListener = new PaymentMethodNonceListener(); try { AddListener(actionListener); PayPal.AuthorizeAccount(this, additionalParameters); if (requestBillingAgreement) { PayPal.RequestBillingAgreement(this, request ?? new PayPalRequest()); } return(await actionListener.Task()); } finally { RemoveListener(actionListener); } }