public async Task <DropUIResult> ShowDropUI(double totalPrice, string merchantId, int requestCode = 1234) { if (isReady) { CurrentInstance = this; _requestCode = requestCode; dropUiPayTcs = new TaskCompletionSource <DropUIResult>(); GooglePaymentRequest googlePaymentRequest = new GooglePaymentRequest(); googlePaymentRequest.InvokeTransactionInfo(TransactionInfo.NewBuilder() .SetTotalPrice($"{totalPrice}") .SetTotalPriceStatus(WalletConstants.TotalPriceStatusFinal) .SetCurrencyCode("USD") .Build()); DropInRequest dropInRequest = new DropInRequest().ClientToken(_clientToken) .InvokeGooglePaymentRequest(googlePaymentRequest); Xamarin.Essentials.Platform.CurrentActivity.StartActivityForResult(dropInRequest.GetIntent(Xamarin.Essentials.Platform.CurrentActivity), requestCode); } else { OnDropUIError?.Invoke(this, "Platform is not ready to accept payments"); dropUiPayTcs.TrySetException(new System.Exception("Platform is not ready to accept payments")); } return(await dropUiPayTcs.Task); }
public void ShowInit(string clientToken) { var activity = (MainActivity)Forms.Context; var listener = new ActivityResultListener(activity, null); var request = new DropInRequest().ClientToken(clientToken); activity.StartActivityForResult(request.GetIntent(Forms.Context), 1); }
public void AddPaymentMethod() { DropInRequest dropInRequest = new DropInRequest(); dropInRequest.ClientToken(mAuthorization); dropInRequest.Amount("1.00"); StartActivityForResult(dropInRequest.GetIntent(this), DROP_IN_REQUEST); }
public Task <bool> ShowPay(string clientToken, int bookingId) { var activity = (MainActivity)Forms.Context; var listener = new ActivityResultListener(activity, bookingId); var request = new DropInRequest().ClientToken(clientToken); activity.StartActivityForResult(request.GetIntent(Forms.Context), 1); return(listener.Task); }
protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); LoadApplication(new App()); DropInRequest dropInRequest = new DropInRequest(); dropInRequest.ClientToken("eyJ2ZXJzaW9uIjoyLCJlbnZpcm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yIsImJpbGxpbmdBZ3JlZW1lbnRzRW5hYmxlZCI6dHJ1ZSwibWVyY2hhbnRBY2NvdW50SWQiOiJjb2xjaGVzdGVyY2hyaXN0aWFuYWNhZGVteSIsImN1cnJlbmN5SXNvQ29kZSI6IkNBRCJ9LCJtZXJjaGFudElkIjoiYjU3bngzcWdzMnE1ZDNraiIsInZlbm1vIjoib2ZmIn0="); StartActivityForResult(dropInRequest.GetIntent(this), REQUEST_CODE); }
void MAddPaymentMethodButton_Click(object sender, System.EventArgs e) { DropInRequest dropInRequest = new DropInRequest() .ClientToken(mAuthorization) .Amount("1.00") .RequestThreeDSecureVerification(Settings.isThreeDSecureEnabled(this)) .CollectDeviceData(Settings.ShouldCollectDeviceData(this)) .AndroidPayCart(getAndroidPayCart()) .AndroidPayShippingAddressRequired(Settings.IsAndroidPayShippingAddressRequired(this)) .AndroidPayPhoneNumberRequired(Settings.IsAndroidPayPhoneNumberRequired(this)) .AndroidPayAllowedCountriesForShipping(Settings.GetAndroidPayAllowedCountriesForShipping(this)); if (Settings.isPayPalAddressScopeRequested(this)) { dropInRequest.PaypalAdditionalScopes(new List <string> { PayPal.ScopeAddress }); } StartActivityForResult(dropInRequest.GetIntent(this), DROP_IN_REQUEST); }