-
Notifications
You must be signed in to change notification settings - Fork 5
/
openapi.yaml
6702 lines (6459 loc) · 244 KB
/
openapi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.0
info:
title: Currency Alliance API Documentation
description: >
# Introduction
The Currency Alliance API facilitates various use cases for Loyalty
Commerce. Our API allows our Partners to:
- Manage Loyalty Currencies in the Cloud
- Access Popular Loyalty Currencies from other Brands
- Sell and Distribute your Loyalty Currency to Partners
- Issue, Transfer, Redeem, or Exchange any loyalty currency via API
- Pull Transaction History Details into 3rd Party Platforms
- Enable the Exchange of Loyalty Currencies into Gift Cards and other Redemption Products in many fiat currencies
To benefit from the Currency Alliance platform, you do not need to use all
of these features. While there are many Endpoints for specific use cases,
most Partners end up using only a few Endpoints.
# Architecture
The Currency Alliance API is organized around REST. Our API has predictable
resource-oriented URLs, accepts JSON-encoded request bodies, returns
JSON-encoded responses, and uses standard HTTP response codes,
authentication, and verbs.
Calls to the API have to be properly authenticated using your public and
secret API keys. The keys are available in the 'CREDENTIALS' section of the
"Loyalty API" module in the Management Dashboard. These keys MUST never be
exposed to the public or any unauthorized person.
The API is designed for a server to server communication. If you want to
communicate with the API from a client it must be through a server
environment, to protect the integrity of the requests and the API keys, and
not expose them on front-end platforms.
# Authentication
The API authenticates every request based on two elements - Credential and
Signature. Every request must include an `Authorization` header with the
following two elements.
`Credential=<public-key>, Signature=<calculated-signature>`
## Credential
In this parameter, the API requires you to provide the `<public-key>` that
is unique to your account. Your keys are available in the 'CREDENTIALS'
section of the "Loyalty API" module in the Management Dashboard.
## Signature
### How is the Signature calculated?
The signature is a [HMAC-SHA256](https://en.wikipedia.org/wiki/HMAC) hash in hexadecimal of the request content, using the `private_key` as the key.
Keep in mind that the string you use to generate the signature and the string you send to the API has to be exactly the same. This includes newlines and spaces. If you compress the JSON body of your request, after generating the signature, the request will be rejected.
### POST/PUT/PATCH HTTP methods
These types of requests use the string representation of the body to calculate the signature.
For example, for the request with body: `{"foo": "bar"}` the signature calculated using `sec_12345` as the private key would be `4d84ba663b9c6179dd98023087da5baa8a4e3eb59ba45284935261350ba70742`
### GET HTTP method
This type of request uses the query string to calculate the signature. Take into account that the "?" character must not be included while calculating the signature.
For example, for the request with query string: `?foo=bar` the signature calculated using `sec_12345` as the private key would be `88d64dfcb542c35dc22bae059bd5f5a5d038572a7b391dfc4cd5f3a5530c1760` which is the hash for the string "foo=bar"
To generate the signature of a GET request without any parameters, simply encode an empty string.
# Security
The API uses asymmetric cryptography to authenticate requests using the API
keys we provide. This provides the following assurances:
- **Requester identification:** Every request requires your public key to be sent, in conjunction with a signature generated with your secret key.
- **Protection against man-in-the-middle (MITM) attacks:** The request signature is calculated using the body of the request, which means that any request that has been tampered with during the transport will be rejected by the Currency Alliance platform, since the signature received will not match the request contents.
The API only supports requests over HTTPS.
# Idempotency
The API supports [idempotent](https://en.wikipedia.org/wiki/Idempotence)
requests to safely retry requests without having to worry about doing the
same operation more than once.
For example, if there's a connection error generating a gift card, you can
retry the request with the same idempotency key without having to worry
about creating multiple gift cards.
To send an idempotent request, include an additional `Idempotency-Key:
<key>` header in the request. An Idempotency Key `<key>` is a unique
identifier generated by the client with a length between 1 and 255
characters. While this can be any type of unique key, we recommend a UUID to
avoid collisions. An Idempotency key expires 8 hours after the initial
request.
In a repeated request the response will always have the response body of the
original request, along with the same status and `400` errors, if any. The
response will also include the header `Idempotency-Repeated: true`. In the
rare instances where a request is repeated while the first one has not been
completed yet, the API will respond with a `409 - Conflict` status.
The API supports idempotency on POST and PATCH requests. Since GET, PUT and
DELETE are idempotent by default, the `Idempotency-Key` header will be
ignored.
# Key fields
Currency Alliance acts as a connectivity bridge between various partners
using its standardized APIs and interface, hence, shielding each partner
from the complexity, nuances, and customizations of hundreds of loyalty
systems and merchant partners. However, the interacting partners need to
have a common reference for a transaction in their own system for easy
reconciliation as well as for customer support purposes.
In this section, you will find information on some key fields and attributes
that are used through our API and on different objects. This information
will help you understand how to use these key fields.
## External Reference
The field `external_reference` is used for each transaction request to
provide a unique identifier from your system that can be used as a reference
during the reconciliation process. This could be a GUID, internal
transaction identifier, invoice number, booking number, itinerary number, or
any other unique number in your system that can be used to uniquely identify
the action. Even though this is not a required field, it is strongly
recommended that you provide value in this field.
## Loyalty System Id
The field `loyalty_system_id` is returned by our system on each transaction
and it provides the unique identifier in the partner loyalty system. This ID
is not generated by Currency Alliance but is provided by the partner loyalty
program and hence could be used as a common field for reconciliation between
your system and the partner's system.
## Loyalty System Data
Sometimes, a loyalty program requires you to send some additional data to
connect. For example, user_id, application_id, partner_code, etc. You will
be able to provide the data in this field for all the transactions with the
partner loyalty program. To check if and what additional data is required by
the partner loyalty program, refer to the Partners Endpoint.
# Common Use cases
Our API can be used for numerous Loyalty Commerce use cases. Some of the
most common use cases are mentioned below along with the information on
which Endpoints to use for each use case. There are auxiliary Endpoints that
could be used to enhance your integration and customer experience. For
example, you could pull all transaction history out via the API into your
Business Intelligence or data staging environments or you could validate the
member details before issuing Loyalty Currency Units.
## Accrual/Issue/Top-up
The underlying objective of this use case is to “give Loyalty Currency Units
to a member” for one reason or another. The reason could be a purchase of a
product, their birthday, completion of a survey, referral, customer service
issue, etc. Furthermore, you may want to give the member units of your own
Loyalty Currency or one of your Partners’ Loyalty Currency.
You should use Accruals Endpoints for this use case. There are three
Endpoints that can be used for issuing your or a Partner’s currency. You can
use any one of the Endpoints or a combination of them to issue Loyalty
Currency Units to the member.
### Direct Accruals
This Endpoint is to be used when you know the exact number of Loyalty
Currency Units to give to a member. In this scenario, you are calculating
the number of Loyalty Currency Units in your environment and providing the
exact number of units in the endpoint.
### Purchase Rules
This Endpoint is to be used when you would like to give the number of
Loyalty Currency Units based on Purchase Rule(s) defined in the Currency
Alliance system. For example, giving points worth 1% of the fiat transaction
amount. In this case, your application does not need to know how to
calculate the number of Loyalty Currency Units or even the cost of the
Loyalty Currency Units in any of your Partners' programs.
### Activity Rules
This Endpoint is to be used when you would like to issue the number of
Loyalty Currency Units based on pre-defined Activity Rule(s) in the system.
For example, you might offer 200 points for posting a product review or
referring a friend.
## Currency Exchange
Our API provides tools for quick collaboration among brands to enable their
respective members to exchange loyalty units between programs. The exchange
could be one-way only, or both directions – in and out – of the programs.
Use the Loyalty Currency Exchange Endpoints to implement this use case.
There are 2 Endpoints that can be used to enable exchange between partners.
### Simulate an exchange
This Endpoint allows you to simulate how many Loyalty Currency units the
member would receive of a Partner’s Loyalty Currency in exchange. This can
be used to show the member how many points in one or more programs they
could get if completing the exchange.
### Execute an exchange
This Endpoint allows you to comlete the exchange Loyalty Currency units to
the Partner’s Loyalty Currency.
**Tip:** You could use the Partners Endpoints to get the list of Exchange
Partners and automatically display the fields required for each program to
complete the exchange. This will be necessary for loyalty programs that
require more member validation fields than just the membership number.
## Redemption/Pay with Points
Our Redemption Endpoints have standardized the redemption process across
various types of loyalty programs and underlying loyalty systems. This
shields you from needing to understand the underlying complexity to
integrate into a new loyalty system or modifying the existing integration
for a different set of parameters for a new partner.
You should use Standard Redemption Endpoints for this use case. There are
four Endpoints that can be used for allowing a Partner’s Loyalty Currency as
a form of payment. You can use any one of the Endpoints or a combination of
them depending on your customer journey. Although not necessary, we highly
recommend you use the “Lookup a Member” Endpoint to validate if the member
exists and if they have enough balance to complete the payment before
submitting the payment transaction.
Strictly speaking, Loyalty Exchange and Exchange for Gift Cards are also
redemptions, but we provide explicit Endpoints for those actions due to the
very high occurrence of those use cases in the industry. Standard
Redemptions refers to any other redemptions where the Partners have allowed
the member to redeem (exchange) their Loyalty Currency Units for your
Products and Services. The products and services may range from flower
delivery to booking a trip, buying an insurance plan, topping up their
mobile plan, paying at a restaurant, buying concert tickets, or even
applying points toward the purchase of a car.
### Simulate a Redemption
To simulate the redemption action and provide information to the member such
as the number of points required to complete the action, cancellation
allowed, etc. without actually deducting the points from their balance or
completing the transaction.
### Execute a Redemption
Deduct points from the member’s account in exchange for the product or
service offered.
### Adjust a Redemption
If allowed by the Partner, you may use this Endpoint to notify of any
modification in an already completed Redemption. The system will
automatically identify if more points are to be redeemed or points are to be
refunded to the member.
### Cancel a Redemption
If allowed by the Partner, you may use this Endpoint to cancel an already
completed Redemption to refund the points.
version: '3.0'
x-konfig-ignore:
object-with-no-properties: true
potential-incorrect-type: true
servers:
- description: Real environment
url: https://api.currencyalliance.com/public/v3.0
- description: Sandbox environment
url: https://sandbox.api.currencyalliance.com/public/v3.0
tags:
- description: >
These Endpoints are used for redemption via Gift cards. These Endpoints
could be used to retrieve a particular Gift Card, to retrieve a list of
enabled Gift cards, to simulate an exchange of currency units for a Gift
card, to exchange currency units for a Gift card, or to redeem a custom
Gift card. The gift card exchange feature for the loyalty currency must be
enabled in the following section of the Management Dashboard:
*Redemptions > Gift Card Management*
There are two objects in the system that represent a Gift card - GiftCard
Object and GiftCardCode Object. GiftCard Object represents the general
characteristics of the Gift card whereas GiftCardCode Object represents
the characteristics that are specific to the Gift card issued to a member.
For example, if a currency owner enables Starbucks gift card through the
Management Dashboard there will be a GiftCard Object in our system that
would represent general details of Starbucks cards including the possible
denominations of let's say $5, $10, $15, $25. When a member exchanges
their points for a Starbucks gift card, the system will create a
GiftCardCode object specific for that member with specific information
such as the value of the Gift card ($5).
## The Gift Card object
GiftCard Object represents a Gift card that could be used for redemption
of Loyalty Currency units via Gift cards. It contains the details of the
general characteristics of the Gift card. Note that it doesn't represent
an issues/redeemed Gift card but only the general characteristics. Once a
Gift card is issued GiftCardCode Object provides the details specific to
the Gift card for the member. It has the following attributes:
<SchemaDefinition schemaRef="#/components/schemas/GiftCard"
showReadOnly={true} showWriteOnly={true} />
## The Gift Card Code object
GiftCardCode Object represents the code details for the issued Gift card.
It contains information specific to the Gift card issued to the member.
For example, in general, Starbucks Gift cards could be of any one of
denominations of $5, $10, $25, $50. This Object will provide the exact
amount of the Gift card that was issued to the user. It has the following
attributes:
<SchemaDefinition schemaRef="#/components/schemas/GiftCardCode"
showReadOnly={true} showWriteOnly={true} />
name: Gift cards
- description: >
Partners Endpoints are used to retrieve information about Partners and
specific Partnerships with those Partners. These Endpoints provide
information such as Company Name, Logos, Loyalty Currency Information, the
terms of the partnership(s), actions available, and the required fields
for the actions available. This information can be used to drive different
UX paths and to automate API calls.
name: Partners
- description: >
All actions in the system that result in the movement of any Loyalty
Currency are represented by a unique Transaction object. E.g. some of the
actions are:
- Creation of Loyalty Currency units
- Purchase of partner's Loyalty Currency units
- Issuance or transfer of Loyalty Currency to a member, partner, or other
accounts
- Exchange of Loyalty Currency units to another Loyalty Currency
- Redemption of Loyalty Currency units to gift cards or other products
Transaction Endpoints can be used to create a transaction, retrieve
information of a transaction, all transactions of a member, or all
transactions related to your account. These Endpoints can also be used to
cancel or update a transaction.
NOTE: Create a Transaction CANNOT be used to do accruals and redemptions,
including Gift Cards and Currency Exchange. Use Accruals and Redemptions
Endpoints for such actions; the system will automatically create the
underlying required transaction.
## The Transaction object
<SchemaDefinition schemaRef="#/components/schemas/Transaction"
showReadOnly={true} showWriteOnly={true} />
name: Transactions
- description: >
The Purchase Endpoints allows you to simulate or execute a purchase rule
to issue loyalty currency units to your members. The purchase loyalty
rules can be defined in the following section in the Management Dashboard:
Loyalty Rules > Purchase Rules
name: Purchase rules
- description: >
Redemptions are referred to as any action that allows the members to
redeem the value of their Loyalty Currency Units in exchange for any
product, services, or any other redemption options. Standard Redemption
Endpoints provides a standardized way for you to allow members to redeem
their Loyalty Currency Units for any type of product or service that is
not a Gift Card or an Exchange into another loyalty program’s Loyalty
Currency.
Standard Redemptions are any redemptions where the Partners have allowed
the member to redeem (exchange) their Loyalty Currency Units for your
Products and Services. The products and services may range from flower
delivery to booking a trip, buying an insurance plan, topping up their
mobile plan, paying at a restaurant, buying concert tickets, or even
applying points toward the purchase of a car.
The Partners define in the Partnership Settings that the members can
redeem their points in various product and service categories. Thus, it is
very important that you provide information about the product and services
in the request message. If you don’t have defined product categories and
details, simply send “General” in the 'category' field.
Some Partners may allow an option to cancel or modify the redemption. This
information is provided in the response messages of the Endpoints for you
to inform the member before completing the redemption.
name: Standard redemptions
x-displayName: Standard
- description: >
The Exchange Endpoints enables you to allow your members to exchange their
Loyalty Currency Units with your partners' Loyalty Currency Units. You can
have a different Exchange Partnership with each Exchange Partner, where
you could allow exchange IN or OUT of your currency. The exchange price
and other settings are established during the Exchange Partnership set up
in the Management Dashboard.
Note that the currencies to be exchanged could be present in different
regions and fiat currencies. Currency Alliance will do the currency
conversion for the fiat currencies based on the mid-day exchange rate
between the fiat currencies.
name: Exchanges
- name: Cohorts
- name: Cohort Purchases
- name: Cohort Activities
- description: >
Member Endpoints can be used to create a new member, look up information
on a member, retrieve a member's details to your system, or update any
member's details. Only the Currency Owner i.e. the loyalty program to
which the member belongs has access to create a member or update a member.
The Partners could look up a member to confirm if the member exists, check
the member account balance, or other details of the member record based on
permissions granted by the Currency Owner.
Currency Alliance has standardized these Endpoints and orchestrates the
calls to various Loyalty programs to validate a member, get member
details, etc. if the Currency Alliance platform is not the primary data
store for the relevant loyalty program.
## The Member object
The Member Object represents a member record. For the loyalty programs
where Currency Alliance is not the primary data store for their members,
the system will connect with the loyalty program system to fetch the
member information and present it in the following format.
<SchemaDefinition schemaRef="#/components/schemas/Member"
showReadOnly={true} showWriteOnly={true} />
name: Members
- name: Custom gift cards
- description: >
The Activities Endpoints allows you to simulate or execute an activity
rule to issue loyalty currency units to your members. The activity loyalty
rules can be defined in the following section in the Management Dashboard:
Loyalty Rules > Activity Rules
name: Activity rules
- description: >
Direct Accruals Endpoint is to be used in the scenarios where you know in
advance the exact number of loyalty currency units that are to be issued
to a member and from which account if multiple accounts are available.
name: Direct accruals
- name: Exchange Reports
x-displayName: Exchanges
- name: Conversions
- name: Cohort Accounts
- name: Reports
paths:
/accruals/standard:
post:
tags:
- Direct accruals
summary: Execute an accrual
operationId: DirectAccruals_executeStandardAccrual
description: >
This Endpoint allows you to create a standard direct accrual in the
member’s account. This Endpoint will automatically create a transaction
with type “Accrual” in the system.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AccrualStandardCreateRequest'
responses:
'201':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Transaction'
'400':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
/accruals/purchase-rules/simulate:
post:
tags:
- Purchase rules
summary: Simulate a purchase
operationId: PurchaseRules_simulatePurchaseRules
description: >
Simulates the rules to identify the number of Loyalty Currency Units to
be given to the members based on the purchase of a product. This
Endpoint is used in scenarios where one might want to show the user how
many units of the Loyalty Currency will be given for a corresponding
action. For example, if user buys a particular item then how many
Currency units will be issued. This does not result in issuance of
Currency units or execution of a transaction in the system, it is only a
simulation.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PurchaseRuleSimulationRequest'
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/PurchaseRuleSimulationResponse'
'400':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
/accruals/purchase-rules/trigger:
post:
tags:
- Purchase rules
summary: Trigger a purchase
operationId: PurchaseRules_triggerLoyaltyRules
description: >
Trigger the loyalty rules matching the purchase from the specified
member.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PurchaseRuleTriggerRequest'
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/PurchaseRuleTriggerResponse'
'400':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
/accruals/purchase-rules/executions/{id}:
get:
tags:
- Purchase rules
summary: Retrieve a purchase rule execution
operationId: PurchaseRules_getExecution
description: >
This Endpoint allows you to retrieve information about a specific
purchase rule execution.
parameters:
- $ref: '#/components/parameters/purchase_rule_execution_id'
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/PurchaseRuleExecution'
'404':
description: ''
/accruals/purchase-rules/executions/{id}/retrigger:
post:
tags:
- Purchase rules
summary: Retrigger a purchase rule execution
operationId: PurchaseRules_retriggerExecution
description: >
This Endpoint allows you to retrigger purchase rule(s) if the purchase
order in your system has been updated. This is only available if the
original transaction is in `pending` status.
An example where this Endpoint is used is when points are issued to a
member for a hotel booking but it is pending for a future date. Before
the future date is reached, if the member changes the underlying hotel
booking, this endpoint would retrigger the purchase rules based on the
new booking information.
parameters:
- $ref: '#/components/parameters/purchase_rule_execution_id'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PurchaseRuleExecutionRetriggerRequest'
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/PurchaseRuleExecution'
'400':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
'404':
description: ''
/accruals/purchase-rules/executions/{id}/cancel:
post:
tags:
- Purchase rules
summary: Cancel a purchase rule execution
operationId: PurchaseRules_cancelExecution
description: >
This Endpoint allows you to cancel the transaction(s) made previously
during the execution of purchase rule(s). This is only available if the
original transaction is in `pending` status.
An example where this Endpoint is used is when points are issued to a
member for a hotel booking but it is pending for a future date. Before
the future date is reached, if the member cancels the underlying hotel
booking, this endpoint would cancel the pending transaction(s).
parameters:
- $ref: '#/components/parameters/purchase_rule_execution_id'
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/PurchaseRuleExecution'
'400':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
'404':
description: ''
/accruals/activity-rules/simulate:
post:
tags:
- Activity rules
summary: Simulate an activity rule
operationId: ActivityRules_simulateRuleExecution
description: >
Simulates an execution of an activity rule for the specified Loyalty
Currency. This Endpoint is used in scenarios where one might want to
show the user how many units of the Loyalty Currency will be given based
on certain activity. For example, if user buys a particular item and
shares it on social media then how many Currency units will be provided
for that activity. This does not result in issuance of Currency units or
execution of a transaction in the system, it is only a simulation.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ActivityRuleSimulationRequest'
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: >-
#/components/schemas/ActivityRulesSimulateRuleExecutionResponse
'400':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
/accruals/activity-rules/trigger:
post:
tags:
- Activity rules
summary: Trigger an activity rule
operationId: ActivityRules_triggerRule
description: |
Trigger activity rules for the specified Loyalty Currency.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ActivityRuleTriggerRequest'
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/ActivityRulesTriggerRuleResponse'
'400':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
/exchanges/simulate:
post:
tags:
- Exchanges
summary: Simulate currency exchange
operationId: Exchanges_simulateCurrencyExchange
description: >
This Endpoint is typically used in scenarios where you'd want to show to
your member that how many units of other currency they would get in
exchange for your Loyalty Currency Units or vice versa. For example, if
you allow a user to select the number of units of your Loyalty Currency
to exchange with your partner's Loyalty Currency, you can use this
Endpoint to dynamically show how many units of your partner's Loyalty
Currency will be provided to the user for the selected number.
You can send a specific Loyalty Currency as a destination to identify
the number of units of that specific Loyalty Currency. Or you could send
the destination Loyalty Currency as null and the system will return the
array with the exchange result for all the Exchange Partners’ Loyalty
Currencies.
Note that the member information is not mandatory but is highly
recommended to be input as the exchange price/cost might be dependent on
the member attributes.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ExchangeSimulationRequest'
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/ExchangeSimulationResponse'
'400':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
/exchanges/execute:
post:
tags:
- Exchanges
summary: Execute currency exchange
operationId: Exchanges_executeCurrencyExchange
description: >
This Endpoint is used to exchange Loyalty Currency Units with your
partner’s Loyalty Currency Units. The prerequisite is that an Exchange
Partnership is already established in the Management Dashboard and the
price is set up accordingly. This Endpoint will automatically create two
transactions with type "Member Exchange" in the system.
- Origin Member to the Partner account using the origin Loyalty Currency
- Partner account using the destination Loyalty Currency to the
destination member
DO NOT USE the "Create a transaction" Endpoint to try to execute this
scenario.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ExchangeRequest'
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/ExchangeResponse'
'400':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
/exchanges/linked-account-simulate:
post:
tags:
- Exchanges
summary: Simulate linked account currency exchange
operationId: Exchanges_simulateLinkedAccountCurrencyExchange
description: ''
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ExchangeLinkedAccountSimulationRequest'
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/ExchangeLinkedAccountSimulationResponse'
'400':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
/exchanges/linked-account-execute:
post:
tags:
- Exchanges
summary: Execute linked account currency exchange
operationId: Exchanges_executeLinkedAccountCurrencyExchange
description: ''
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ExchangeLinkedAccountRequest'
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/ExchangeLinkedAccountResponse'
'400':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
/members:
post:
tags:
- Members
summary: Create a member
operationId: Members_createRecord
description: >
This Endpoint is only accessible by Currency Owners to create a member
record if Currency Alliance is the main points bank i.e. the single
source of truth for the loyalty program.
Each member object is associated with one loyalty currency. Thus, the
same person associated with two different loyalty programs would have
two member objects, each with a different corresponding
loyalty_program_identifiers and loyalty_currency.
An important attribute is returned in all successful responses -
`loyalty_program_identifiers`, which is a unique internal identifier for
a member object across the entire Currency Alliance platform.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/MemberCreateRequest'
responses:
'200':
description: >-
A member matching the received loyalty program identifiers was
found, existing information is returned.
content:
application/json:
schema:
$ref: '#/components/schemas/Member'
'201':
description: The member has been created
content:
application/json:
schema:
$ref: '#/components/schemas/MembersCreateRecordResponse'
patch:
tags:
- Members
summary: Update a member
operationId: Members_updateMemberRecord
description: >
This Endpoint allows you to update the information of an existing
member. This Endpoint is only accessible by Currency Owners to update a
member record in Currency Alliance.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/MemberUpdateRequest'
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/MembersUpdateMemberRecordResponse'
'400':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
/members/lookup:
post:
tags:
- Members
summary: Lookup a member
operationId: Members_validateMemberDetails
description: >
This Endpoint allows you to validate a member and get member details
including balance and tier if provided access by the Currency Owner.
Where Currency Alliance is not the Main Points Bank, the system will
call the Loyalty Program to validate if the member exists, conditional
upon if this option is available from the Currency Owner.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/MemberLookupRequest'
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/MembersValidateMemberDetailsResponse'
'404':
description: ''
/loyalty-currencies/fiat-convert:
post:
tags:
- Conversions
summary: Convert fiat to loyalty currency
operationId: Conversions_fiatToLoyaltyCurrency
description: >
This Endpoint is used to convert any fiat currency into a loyalty
currency. If the underlying fiat currency of the loyalty currency is
different than the requested fiat currency, Currency Alliance will do
the currency conversion for the fiat currencies based on the mid-day
exchange rate.
An example scenario where this Endpoint is used is when an Issuing
Partner may want to offer Currency units worth a specific amount of
economic value to a member, but they don´t know how many units of a
destination currency can be obtained for that amount of fiat currency.
For example, if a partner wants to give 2.43€ worth of value, they can
submit that amount via this Endpoint with the desired destination
currency and obtain the maximum number of units in that destination
currency that can be obtained with 2.43€