Click or drag to resize

AdministrationClientCreateVoucher Method

Create a new Voucher, from the submitted values.

Syntax
C#
public ResultOfVoucher CreateVoucher(
	ManagementGroupRequestOfCreateVoucher voucher
)

Parameters

voucher
Type: AdministrationServiceManagementGroupRequestOfCreateVoucher

Return Value

Type: ResultOfVoucher
Examples
C#
using (var svc = new AdministrationService.AdministrationClient())
{
  var request = new AdministrationService.ManagementGroupRequestOfCreateVoucher();
  request.Token = "Token";//Required - Token returned from AccountService.ManagementGroupLogin
  request.ManagementGroup = "Management group";//Required - ManagementGroup supplied when calling AccountService.ManagementGroupLogin

  var createVoucher = new AdministrationService.CreateVoucher();
  createVoucher.CardNumber = "21000005"; //Required
  createVoucher.Expires = DateTime.Now.AddDays(180); //Required
  createVoucher.MemberRSN = new Guid("5603872a-80fd-4629-bab0-4091956cad31");; //Required
  createVoucher.PointsValue = 10; //Required
  createVoucher.ProgramMembershipRSN = new Guid("f28c7b9e-e103-4b78-b20a-6e003bc95f8f");; //Required
  createVoucher.ProgramRSN = new Guid("c56e706a-9636-462e-9722-2604fb39e224");; //Required
  createVoucher.ValidFrom = DateTime.Now; //Required
  createVoucher.VoucherValue = 20.0M; //Required

  // add createVoucher to request
  request.Value = createVoucher;//Required

  AdministrationService.ResultOfVoucher result = svc.CreateVoucher(request);

  if (result.FaultCode == 0)
  {
    //Request succeeded
  }
  else
  {
    //Request failed
    throw new Exception(result.FaultDescription);
  }
}
See Also