Gift Cards
Encoding and decoding URLs for gift cards
Last updated
Encoding and decoding URLs for gift cards
Last updated
: When distributing a gift-card several parameters are provided to the user including the spending key, birth index, balance, pool address and so on. The easiest way to achieve this is to encode these parameters into the URL. The following methods are intended for creating and parsing a gift card.
Use gift card codes with care. Anyone who knows the code has full access to the gift card funds.
To create gift-card URL code invoke the following method:
giftCard
- a GiftCardProperties object which contains all needed parameters to encode
Promise
returns Base58-encoded string which can be injected into the redeeming URL
Use the following method to retrieve a gift-card from the code or URL containing the code:
code
- a gift-card code or URL contained code within the gift-code
query parameter.
Promise
returns the GiftCardProperties of a decoded card. Errors may return InternalError
.