The Bidco user profile stores all the personal, address and payment details of the user.

There are two types of user profiles:

  • Temporary: Which lets you build a frictionless Bidco experience by allowing guest users to make payments without requiring a Bidco account.
  • Permanent: A profile that exists on the Bidco server which allows a user to log into the same profile at a later time or on another device.

The ProfileManager is used used to retrieve and modify profiles in the following ways:



Retrieving the Current User's Profile Information

  1. The profile of the currently authenticated user's, which reflects any successful modifications, can be retrieved using the ProfileManager:
Profile currentProfile = ManagerFactory.GetInstance().ProfileManager.GetCurrentProfile();
  1. Get the list of addresses currently added to the profile with:
IReadonlyCollection<Address> addresses = profile.Addresses;
  1. Get the default address with:
Address defaultAddress = profile.DefaultAddress;
  1. Get the list of payment instruments currently added to the profile with:
IReadonlyCollection<PaymentInstrument> paymentInstruments = profile.PaymentInstruments;
  1. Get the default payment instrument with:
PaymentInstrument defaultPaymentInstrument = profile.DefaultPaymentInstrument;
  1. Get the device ID associated with the profile:
string deviceId = profile.DeviceId;
  1. Get the profile ID with:
string profileId = profile.ProfileId;
  1. Check if the user profile is active and can be used:
boolean activeProfile = profile.IsActive;
  1. Get a list of any custom data keys attached to the profile:
List<CustomDataValue> customDataValues = profile.CustomDataValues;

Adding an Address

For more information on displaying addresses see Addresses.

  1. Create a new AddressDetails object and set the address information:
AddressDetails addressDetails = new AddressDetails(Country.UnitedKingdom);
addressDetails.Alias = "Address";
addressDetails.FirstName = "Joe";
addressDetails.LastName = "Bloggs";
addressDetails.Line1 = "10 Bloombury Way";
addressDetails.City = "London";
addressDetails.PostCode = "WC1A 2SL";
addressDetails.County = "London";

  1. Validate the address details

Use AddressDetailsValidator to verify that all address details have been entered correctly.

AddressDetailsValidator addressDetailsValidator = new AddressDetailsValidator();
List<ValidationFailure> errors = addressDetailsValidator.Validate(addressDetails);
if (errors != null)
{
	foreach (ValidationFailure validationFailure in errors)
	{
		String property = validationFailure.PropertyName;
		ValidationError errorCode = validationFailure.ErrorCode;
		// Display validation to user and obtain updated value
	}
}
else
{
// No issues found while validating the address details
}

For more information on validators please see the Validators page.


  1. Add the address to the user profile using the ProfileManager:
ProfileManager pm = ManagerFactory.GetInstance().ProfileManager;
Address addedAddress = await pm.AddAddressAsync(address);
// Address was successfully added

Updating an Address

  1. Create an AddressDetails object from an existing Address and modify the address information:
Address originalAddress = profile.DefaultAddress;
AddressDetails modifiedAddress = originalAddress.EditableCopy();
modifiedAddress.Alias = "Work Address";

  1. Validate the address details

Use the AddressDetailsValidator to validate the address details as described in step 2 of Adding an Address


  1. Use the ProfileManager to update the address information:
ProfileManager pm = ManagerFactory.GetInstance().ProfileManager;
Address updatedAddress = pm.UpdateAddressAsync(originalAddress, modifiedAddress);
// Address was successfully updated

Deleting an Address

  1. Use the ProfileManager to delete an existing address:
ProfileManager pm = ManagerFactory.GetInstance().ProfileManager;
Profile updatedProfile = await pm.DeleteAddressAsync(address);
// Address was successfully deleted from profile

Adding a Payment Instrument

  1. Create a new PaymentMethodDetails object to store the card information:
PaymentMethodDetails paymentMethod = new PaymentMethodDetails();
paymentMethod.CardHolderFirstName = "Joe";
paymentMethod.CardHolderLastName = "Bloggs";
paymentMethod.CardNumber = "4111111111111111";
paymentMethod.ValidFromDate = new YearMonth(2010, 1);
paymentMethod.ExpiryDate = new YearMonth(2020, 1);

  1. Validate the payment method details

Use PaymentMethodDetailsValidator to verify that all payment method details have been entered correctly.

PaymentMethodDetailsValidator paymentMethodDetailsValidator = new PaymentMethodDetailsValidator();
List<ValidationFailure> errors = paymentMethodDetailsValidator.Validate(paymentMethod);
if (errors != null)
{
	foreach (ValidationFailure validationFailure in errors)
	{
		String property = validationFailure.PropertyName;
		ValidationError errorCode = validationFailure.ErrorCode;
		// Display validation to user and obtain updated value
	}
}
else
{
// No issues found while validating the payment method details
}

For more information on validators please see the Validators page.


  1. Create a new PaymentInstrumentDetails object and set the payment method, billing address and other information:
PaymentInstrumentDetails paymentInstrumentDetails = new PaymentInstrumentDetails();
paymentInstrumentDetails.Issuer = CreditCardIssuer.Visa;
paymentInstrumentDetails.PaymentMethodDetails = paymentMethodDetails;
paymentInstrumentDetails.PaymentType = PaymentMethodType.PaymentCard;
paymentInstrumentDetails.BillingAddress = address;
paymentInstrumentDetails.Email = "customer@email.com";
paymentInstrumentDetails.Phone = "01234567890";

  1. Add the payment instrument to the user profile using the ProfileManager:
PaymentInstrument paymentInstrument = await ManagerFactory.GetInstance().ProfileManager.AddPaymentInstrumentAsync(paymentInstrumentDetails);
// Payment instrument was successfully added

The new payment instrument is now available in the current profile.


Updating a Payment Instrument

Only the billing address of a payment instrument may be modifed.

  1. Use the ProfileManager to update the billing address of a payment instrument:
ProfileManager pm = ManagerFactory.GetInstance().ProfileManager;
await pm.UpdatePaymentInstrumentAsync(paymentInstrument, newBillingAddress);
// Payment instrument was successfully updated

Deleting a Payment Instrument

  1. Use the ProfileManager to delete an existing payment instrument:
ProfileManager pm = ManagerFactory.GetInstance().ProfileManager;
Profile updatedProfile = await pm.DeletePaymentInstrumentAsync(paymentInstrument);
// Payment instrument was successfully deleted from profile

Getting the Payment Instruments Accepted by a Merchant

  1. To obtain the list of payment instruments from the user profile that are accepted by a specified Merchant:
List<PaymentInstrument> acceptedPaymentInstruments = await ManagerFactory.GetInstance().ProfileManager.GetAcceptedPaymentMethods(merchant);

In the case where the profile does not contain any accepted payment instruments an empty IReadOnlyList is returned.


Checking the Profile Against a Merchant's Requirements

  1. Before transacting with a merchant you should check if the profile contains all the information required for the merchant.
bool canTransact = profile.HasRequiredInfo(merchant);

Updating the Profile

  1. Create a new ProfileDetails object and set the profile information:
ProfileDetails profileDetails = new ProfileDetails();
profileDetails.Title = "Mr";
profileDetails.FirstName = "Joe";
profileDetails.LastName = "Bloggs";
profileDetails.Email = "jbloggs@email.com";
profileDetails.MobileNumber = "01233355555";
profileDetails.Gender = profile.Gender;
profileDetails.DateOfBirth = profile.DateOfBirth;
profileDetails.PhoneAreaCode = profile.PhoneAreaCode;
profileDetails.DefaultAddress = profile.DefaultAddress;
profileDetails.DefaultPaymentInstrument = profile.DefaultPaymentInstrument;
profileDetails.CustomDataValues = profile.CustomDataValues;

  1. Validate the profile details

Use ProfileDetailsValidator to verify that all profile details have been entered correctly.

ProfileDetailsValidator profileDetailsValidator = new ProfileDetailsValidator();
List<ValidationFailure> errors = profileDetailsValidator.Validate(profileDetails);
if (errors != null)
{
	foreach (ValidationFailure validationFailure in errors)
	{
		String property = validationFailure.PropertyName;
		ValidationError errorCode = validationFailure.ErrorCode;
		// Display validation to user and obtain updated value
	}
}
else
{
// No issues found while validating the profile details
}

  1. Use the ProfileManager to update the current profile:
ProfileManager pm = ManagerFactory.GetInstance().ProfileManager;
Profile updatedProfile = await pm.UpdateProfileAsync(profileDetails);
// Profile information is updated

  1. The updated profile information will be reflected in the users current profile:
Profile profile = profileManager.getCurrentProfile();

Saving the Profile

Saving a guest profile to the Bidco server allows the user to log into the profile at a later time or on another device.
The saveProfile method returns a set of coupons that the user can redeem on future purchases. The coupons are automatically saved to the user's profile but returned here so they can be displayed to the user.


  1. Populate the SignUpDetails with the user credentials

You can use the user ID from your App as the identifier for the Bidco profile:

SignUpDetails signUpDetails = new SignUpDetails(hostAppUserId ,currentUserPassword);

If you would rather use the Bidco profileId as the identifier:

SignUpDetails signUpDetails = new SignUpDetails(currentUserPassword);

  1. Save the temporary profile
ProfileManager pm = ManagerFactory.GetInstance().ProfileManager;
Profile savedProfile = await pm.SaveProfileAsync(signUpDetails);
// Profile is now permanent.