Skip to content

Commit

Permalink
add loyalty gifts API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
otothea committed Oct 21, 2022
1 parent e623811 commit 34616ee
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 2 deletions.
4 changes: 3 additions & 1 deletion docs/loyalty/user-documentation/authentication.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ membership number Membership ID
returnPath [string] The URL path to return to after stripe checkout
username [string] Custom username
referralId [number] The ID from a referral link (this is the ID of another user)
giftToken [string] The token for the gift
=========== ======== ======================================================

.. code-block:: js
Expand Down Expand Up @@ -91,6 +92,7 @@ Field Type Description
=========== ======== ==========================================
email string
password string
giftToken [string] The token for the gift
=========== ======== ==========================================

.. code-block:: js
Expand Down Expand Up @@ -160,7 +162,7 @@ user_auth_token [string] If the user is already logged in, you should include th
Forgot Password
---------------

After intiating a forgot password request, an email will be sent to the user if the email exists in our system. The email will have a link with a token in it. Your client should be able to handle this token when the user clicks on the link. The link looks like this::
After initiating a forgot password request, an email will be sent to the user if the email exists in our system. The email will have a link with a token in it. Your client should be able to handle this token when the user clicks on the link. The link looks like this::

https://yourapp.com/?password_token=xxxxx

Expand Down
96 changes: 96 additions & 0 deletions docs/loyalty/user-documentation/gifts.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
User API
========

- `Send Gift`_
- `Verify Gift Token`_

Send Gift
---------

After initiating a the gift flow, you will be given a URL for the checkout session.

After checkout, an email will be sent to the recipient's inbox. The email will have a link with a token in it. Your client should be able to handle this token when the user clicks on the link. The link looks like this::

https://yourapp.com/?gift_token=xxxxx

When the user lands on this page, you should submit the token to the ``/gift/verify`` endpoint to get info about the gift

- **POST** /gift

Request

====================== ========== ==========================================================================
Field Type Description
====================== ========== ==========================================================================
membershipId string ID of the membership to gift
senderEmail string Email address of the sender
recipientEmail string Email address of the gift recipient
returnPath [string] The URL path to return to after stripe checkout
====================== ========== ==========================================================================

.. code-block:: js
const response = await axios.post('https://botisimo.com/api/v1/loyalty/:team/gift', {
membershipId: 2,
senderEmail: 'jack@example.com',
recipientEmail: 'jill@example.com',
returnPath: '/gift?completed=true',
}, {
headers: {
'x-user-auth-token': 'xxxxxxx', // In this case the auth token is optional
},
});
Response

=========== ======== =====================================================================================
Field Type Description
=========== ======== =====================================================================================
href string The href to the Stripe checkout session, you should immediately redirect to this href
=========== ======== =====================================================================================

.. code-block:: js
{
"href": "https://xxxxx"
}
Verify Gift Token
-----------------

This endpoint should ONLY be used if you have a token from a ``/gift`` request

- **POST** /gift/verify

Request

=========== ======== ======================================================
Field Type Description
=========== ======== ======================================================
token string The token from the gift
=========== ======== ======================================================

.. code-block:: js
const response = await axios.post('https://botisimo.com/api/v1/loyalty/:team/gift/verify', {
token: 'xxxxx'
});
Response

====================================== ======== =================================================================================
Field Type Description
====================================== ======== =================================================================================
gift object
gift.email string The email address of the gift recipient
gift.loyaltyMembership object
gift.loyaltyMembership.id number The ID of the membership
gift.loyaltyMembership.name string The name of the membership
gift.loyaltyMembership.description string The membership description
gift.loyaltyMembership.priceMonth number The cost of the membership per month in cents
gift.loyaltyMembership.priceYear number The cost of the membership per year in cents
gift.loyaltyMembership.gold number The price in loyalty points to redeem
gift.loyaltyMembership.goldMultiplier number The loyalty points multiplier for this membership
gift.loyaltyMembership.resourceId number The resource ID of the membership image
gift.loyaltyMembership.badgeResourceId number The resource ID of the membership badge
====================================== ======== =================================================================================
2 changes: 2 additions & 0 deletions docs/loyalty/user-documentation/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ User API Documentation
- :doc:`Events API <events>`
- :doc:`Transactions API <transactions>`
- :doc:`Notifications API <notifications>`
- :doc:`Gifts API <gifts>`

.. toctree::
:maxdepth: 1
Expand All @@ -33,6 +34,7 @@ User API Documentation
events
transactions
notifications
gifts

API Endpoint
------------
Expand Down
2 changes: 1 addition & 1 deletion docs/loyalty/user-documentation/user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ user.tags.name string The name of the tag
Verify Email Address
--------------------
After intiating an email verification request, an email will be sent to the user's inbox. The email will have a link with a token in it. Your client should be able to handle this token when the user clicks on the link. The link looks like this::
After initiating an email verification request, an email will be sent to the user's inbox. The email will have a link with a token in it. Your client should be able to handle this token when the user clicks on the link. The link looks like this::
https://yourapp.com/?email_token=xxxxx
Expand Down

0 comments on commit 34616ee

Please sign in to comment.