Example #1
0
        void DidSelectShippingContact(PKPaymentAuthorizationViewController controller, PKContact contact, PKPaymentShippingAddressSelected completion)
        {
            // Create a shipping method. Shipping methods use PKShippingMethod,
            // which inherits from PKPaymentSummaryItem. It adds a detail property
            // you can use to specify information like estimated delivery time.
            var shipping = new PKShippingMethod {
                Label  = "Standard Shipping",
                Amount = NSDecimalNumber.Zero,
                Detail = "Delivers within two working days"
            };

            // Note that this is a contrived example. Because addresses can come from
            // many sources on iOS they may not always have the fields you want.
            // Your application should be sure to verify the address is correct,
            // and return the appropriate status. If the address failed to pass validation
            // you should return `InvalidShippingPostalAddress` instead of `Success`.

            var address = contact.PostalAddress;
            var requiresInternationalSurcharge = address.Country != "United States";

            PKPaymentSummaryItem[] summaryItems = MakeSummaryItems(requiresInternationalSurcharge);

            completion(PKPaymentAuthorizationStatus.Success, new [] { shipping }, summaryItems);
        }
		void DidSelectShippingContact (PKPaymentAuthorizationViewController controller, PKContact contact, PKPaymentShippingAddressSelected completion)
		{
			// Create a shipping method. Shipping methods use PKShippingMethod,
			// which inherits from PKPaymentSummaryItem. It adds a detail property
			// you can use to specify information like estimated delivery time.
			var shipping = new PKShippingMethod {
				Label = "Standard Shipping",
				Amount = NSDecimalNumber.Zero,
				Detail = "Delivers within two working days"
			};

			// Note that this is a contrived example. Because addresses can come from
			// many sources on iOS they may not always have the fields you want.
			// Your application should be sure to verify the address is correct,
			// and return the appropriate status. If the address failed to pass validation
			// you should return `InvalidShippingPostalAddress` instead of `Success`.

			var address = contact.PostalAddress;
			var requiresInternationalSurcharge = address.Country != "United States";

			PKPaymentSummaryItem[] summaryItems = MakeSummaryItems (requiresInternationalSurcharge);

			completion (PKPaymentAuthorizationStatus.Success, new [] { shipping }, summaryItems);
		}