Usage
Create a client to make requests
var apiClient = new VoucherApi("{URL}", "{USER_NAME}", "{PASSWORD}");
Replace
{URL} with a valid Phorest Voucher API endpoint. See Endpoints for more information.
Replace
{USER_NAME} with your username
Replace
{PASSWORD} with your password
Create a Voucher Request
var request = new VoucherRequest
{
IssueDate = DateTime.Now,
ExpiryDate = DateTime.Now.AddHours(1),
OriginalBalance = 1,
Branch = new Branch
{
BusinessId = "{BUSINESS_ID}",
BranchId = "{BRANCH_ID}"
}
};
Replace
{BUSINESS_ID} with your Business Id
Replace
{BRANCH_ID} with your Branch Id
Execute your request
var result = apiClient.CreateVoucher(request);
The Response object will contain the Unique Voucher Serial Number the has been used.
result.SerialNumber
Endpoints
Testing
Live
Test Credentials
- User Name: "test@phorest.com"
- Password: "Testtest1"
- Business Id: "3Evn8Qqw6pVY4iScdZXWBA"
- Branch Id: "nPpLa0UY4UO5dn68TpPsiA"
References
https://phorest.jira.com/wiki/display/PC/How+to+add+online+gift+voucher+sales+to+my+website