Voucherify iOS SDK | Use cases: online coupons, prepaid vouchers, in-app promo codes
Clone or download
Latest commit 8777346 Mar 20, 2017

README.md

Official Voucherify SDK for Swift

Setup | Contributing | Changelog | License |

API: Validations | Redemptions

Setup

The Voucherify Swift SDK requires Swift 3.

Using CocoaPods:
pod "VoucherifySwiftSdk"

Configuration

The VoucherifyClient manages your interaction with the Voucherify API.

VoucherifyClient(clientId: YOUR-PUBLIC-CLIENT-APPLICATION-ID, clientToken: YOUR-PUBLIC-CLIENT-APPLICATION-TOKEN)

We are tracking users which are validating vouchers with those who consume them, by a tracking_id. By that we are setting up an identity for the user. If you want to provide your custom value for tracking_id, you have to do it when creating VoucherifyClient:

VoucherifyClient(clientId: YOUR-PUBLIC-CLIENT-APPLICATION-ID, clientToken: YOUR-PUBLIC-CLIENT-APPLICATION-TOKEN, origin: YOUR_ORIGIN, trackingId: YOUR_TRACKING_ID, configuration: Configuration)

API

Validations API

Validate Voucher

    client.vouchers().validations().validateVoucher(code: String, amount: Int? = nil, completion: (_ response: Result<VoucherResponse>) -> Void)
    client.vouchers().validations().validateVoucher(code: String, amount: Int? = nil, orderItems: [OrderItem], completion: (_ response: Result<VoucherResponse>) -> Void)

Redemptions API

Redeem Voucher

    client.vouchers().redeemptions().redeem(code: String, redeemContext: VoucherRedemptionContext? = nil, completion: (_ response: Result<VoucherRedemptionResult>) -> Void)

Contributing

Bug reports and pull requests are welcome through GitHub Issues.

Changelog

  • 2017-03-17 - 1.3.0 - Improve error handling
  • 2017-03-17 - 1.2.0 - Fix OrderItem mappings
  • 2017-03-16 - 1.1.0 - Update Order and OrderItem model
  • 2017-01-12 - 1.0.0 - Unify API with other voucherify SDKs
  • 2016-09-15 - 0.4.0 - redeem a voucher
  • 2016-08-08 - 0.3.0 - validate voucher with validation rules concerning products or variants (SKUs)
  • 2016-07-22 - 0.2.0 - validate gift voucher
  • 2016-07-08 - 0.1.0 - validate voucher by its code

License

MIT. See the LICENSE file for details.