Creates a new payment session which can be used to allow payment with FanPoints.
The flow is as follows:
This flow is preferred over the payPurchaseWithFanPoints
method as it allows to properly authenticate
the user on the checkout page hosted by the loyalty program.
the price of the purchase
the URL to redirect to if the user completes the payment successfully
the URL to redirect to if the user cancels the payment
Optional
customPurchaseId: stringan optional custom purchase id which can be used to link the payment to a specific purchase in your system
Optional
loyaltyProgramId: stringthe ID of the loyalty program, where the user belongs to (only needed if the client config does not contain a loyalty program ID)
Optional
webhookUrl: stringthe URL to send a request to after the payment is completed
Optional
partnerId: stringthe id of the partner where the purchase happened (only needed if the client config does not contain a partner ID)
Optional
partnerLabel: PartnerLabelthe label of the partner where the purchase happened (optional)
Optional
currency: Currencythe currency of the price (only needed )
the created session with the session URL
RequestError if the given price is not valid (invalidRewardAmountError
) or if
the given custom purchase id is not valid (invalidTransactionIdError
).
Creates a new payment session which can be used to allow payment with FanPoints.
Use this method when your loyalty program is connected to Tixevo. In contrast to the
createFanPointsPaymentSession
method, this method only works if your client is
configured with the loyalty program connected to Tixevo.
The flow is as follows:
This flow is preferred over the payPurchaseWithFanPoints
method as it allows to properly authenticate
the user on the checkout page hosted by the loyalty program.
the type of the Tixevo partner where the purchase happened
the price of the purchase
the URL to redirect to if the user completes the payment successfully
the URL to redirect to if the user cancels the payment
Optional
webhookUrl: stringthe URL to send a request to after the payment is completed
Optional
customPurchaseId: stringan optional custom purchase id which can be used to link the payment to a specific purchase in your system
Optional
currency: Currencythe currency of the price (only needed )
the created session with the session URL
RequestError if the given price is not valid (invalidRewardAmountError
), if
the given custom purchase id is not valid (invalidTransactionIdError
), or if the configured loyalty
program is not connected to Tixevo (notConfiguredError
).
Estimates how many Fan Points a user would receive for the given purchase.
This allows you to check how many Fan Points a user would receive for a given purchase. It does not actually distribute the Fan Points. Use giveFanPointsOnPurchase to distribute Fan Points.
the items that were purchased
the amount of Fan Points the user would receive.
Returns the total number of Fan Points the user has collected.
the id of the user.
an object containing the total amount of Fan Points the user has collected as well as the amount that can be purchased with these points.
RequestError if the user does not exist (unknownUserError
).
Returns the number of Fan Points that correspond to the given price.
If multiple partners are configured, you can use the partnerId
or the partnerLabel
parameter to specify the partner where the purchase happens.
the price in the default currency of the partner or the currency given in the currency
parameter
Optional
partnerId: stringthe id of the partner where the purchase happens
Optional
partnerLabel: PartnerLabelthe label of the partner where the purchase happens
Optional
currency: Currencythe currency of the price
the number of Fan Points that correspond to the given price
RequestError if the given price is not valid (InvalidRewardAmountError
).
Returns the Fan Points transactions of the given user, purchaseId and partner.
This method can return both transactions where the user received FanPoints on a purchase and transactions where the user purchased using FanPoints.
the id of the user
the id of the purchase to return
Optional
partnerId: stringthe id of the partner where the purchase happened
Optional
partnerLabel: PartnerLabelthe label of the partner where the purchase happened
the transaction
Returns all Fan Points transactions of the given user at partners.
The returned transactions contains both transactions where the user received FanPoints on a purchase and transactions where the user purchased using FanPoints.
If limit
is given, at most limit
transactions
will be returned. If earlierThan
is given, only transactions
that happened before this transaction will be returned. Combine
both parameters to paginate the results.
the id of the user
Optional
limit: numberthe maximum number of transactions to return
Optional
earlierThan: Dateif given, transactions before this date will be returned
a list of the transactions.
RequestError if the user does not exist (unknownUserError
).
Gives Fan Points to the user for the given purchase and purchase items.
The titles and descriptions can be used to add human readable information on the transaction that could be used to display to the user.
Each purchase item can correspond at a different partner. If no partner is given, the
default partner will be used. You can set the partner using the partnerId
or the
partnerLabel
parameter. If both are given, the partnerId
will be used.
Each purchase item can have a different rate label in order to specify the conversion rate from the price to the number of Fan Points. If no rate label is given, the default rate of the partner will be used.
A custom purchase id can be given in order to link the transaction to a specific event on your side. This operation is idempotent w.r.t. the purchase group id. This means that if you call this method twice with the same custom group id, the second call will not have any effect and an error will be raised.
the id of the user to give FanPoints to
the items that were purchased
Optional
customPurchaseId: stringan optional custom purchase id
a list of the resulting purchase transactions
RequestError if the user does not exist (unknownUserError
),
if the given price is not valid (invalidRewardAmountError
), if the custom
purchase id is not valid (invalidTransactionIdError
), if a transaction
with the given custom purchase id already exists (alreadyExecutedError
),
if the given custom purchase item ids are not unique (nonUniquePurchaseItemIdsError
),
or if one of the rate categories does not exist (invalidRateCategoryError
).
the id of the user to give FanPoints to
the items that were purchased
Optional
customPurchaseId: stringan optional custom purchase id
a list of the resulting purchase transactions
Allows a user to pay a purchase using FanPoints.
This method directly performs the payment. It is recommended to use the createFanPointsPaymentSession
method for a simpler payment flow, where a payment session is created, where you can redirect the user
to a dedicated FanPoints checkout page hosted by the loyalty program. This allows to authenticate the
user on the checkout page hosted by the loyalty program.
The titles and descriptions can be used to add human readable information on the transaction that could be used to display to the user.
Each purchase item can correspond at a different partner. If no partner is given, the
default partner will be used. You can set the partner using the partnerId
or the
partnerLabel
parameter. If both are given, the partnerId
will be used.
A custom purchase id can be given in order to link the transaction to a specific event on your side. This operation is idempotent w.r.t. the purchase group id. This means that if you call this method twice with the same custom group id, the second call will not have any effect and an error will be raised.
RequestError if the user does not exist (unknownUserError
),
if the user does not have enough FanPoints (tooFewAvailableError
),
if the given price is not valid (invalidRewardAmountError
), if the custom
purchase id is not valid (invalidTransactionIdError
), if a transaction
with the given custom purchase id already exists (alreadyExecutedError
),
if the given custom purchase item ids are not unique (nonUniquePurchaseItemIdsError
),
or if one of the rate categories does not exist (invalidRateCategoryError
).
Registers a Tixevo checkout.
This method allows you to register a new or modified raw Tixevo checkout.
The JSON payload of the Tixevo checkout as a string.
RequestError if the payload is not in the expected
format (invalidDataFormatError
) or if the Tixevo configuration is not
set (tixevoConfigurationNotSetError
) in the dashboard.
Undoes a purchase.
This will reverse the effect of giving out FanPoints or paying with FanPoints.
The purchaseItems
parameter specifies what items of the given purchase (purchaseId
)
should be undone. You don't have to undo all items of a purchase.
Note that undoing a purchase might not be possible, e.g. if the FanPoints have already been spent by the user.
Undoing a purchase corresponds to creating a new purchase with a negative price. This operation is idempotent w.r.t. the purchase id and purchase item id. This means that if you call this method twice with the same arguments, the second call will not have any effect.
If you configured multiple partners, you can use the specificPartnerId
parameter
ot the partnerLabel
parameter to specify the partner where the purchase happened.
If you configured multiple partners and don't provide a specificPartnerId
, the
default partner will be used.
the id of the user that performed the purchase to undo
the id of the purchase to undo
the purchase items to undo
an list of the performed undo purchases
RequestError if the purchase does not exist (transactionNotFoundError
),
if the user does not have enough FanPoints (tooFewAvailableError
), or if the purchase
has already been undone (alreadyExecutedError
).
This class allows you to interact with the FanPoints module. The FanPoints module allows to distribute FanPoints to users and collect FanPoints from a user as a method of payment.