> For the complete documentation index, see [llms.txt](https://docs.lucrasports.com/lucra-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lucrasports.com/lucra-sdk/games-you-play-gyp/gyp-sdks.md).

# Games You Play Implementation Guide

## Briefing

By the end of this implementation guide, users on your platform will be able to create and join Games You Play (GYP) matchups for real money or rewards, increasing engagement in your ecosystem.

There are many ways to integrate the GYP Lucra Product, this guide focuses on leaning on the client side Lucra SDK to standup the UI. If you're looking for other approaches, see the [SDKs & APIs](/lucra-sdk/sdks-and-apis.md) section

### Prerequisites

* Your Lucra account has been setup with Games tied to your account and has predefined Games to display on the Lucra landing page

{% hint style="info" %}
This can be done through the Lucra Console or ask your Lucra representative for assistance
{% endhint %}

* Obtain Lucra Keys for your application, two `apiKey` values, one for `sandbox` environment and another for `production` environment.

{% content-ref url="/pages/uxPGQLZg2rHMgJoCse2X" %}
[Lucra API Keys](/lucra-sdk/readme/whats-included/lucra-api-keys.md)
{% endcontent-ref %}

## Step by step guide

{% stepper %}
{% step %}

#### Install & Initialize the SDK

Set up the SDK and confirm initialization is successful.

**Install**

{% tabs %}
{% tab title="iOS" %}
{% content-ref url="/pages/NkHdjUFmx0pufBioBAEy" %}
[Project Setup (iOS)](/lucra-sdk/sdks-and-apis/client-sdks/ios/1.0.0_project_setup.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Javascript" %}
{% content-ref url="/pages/0Gf8EooSZqrZvD3C2CMR" %}
[Getting Started](/lucra-sdk/sdks-and-apis/client-sdks/javascript-web/1.0_project_setup.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Android" %}
{% content-ref url="/pages/QLMpPk8VpWr4Qw5DI28y" %}
[Getting Started](/lucra-sdk/sdks-and-apis/client-sdks/android/1.0.0_project_setup.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="React Native" %}
{% content-ref url="/pages/ihc5rUDwDwDUzFkaH1ta" %}
[Getting Started](/lucra-sdk/sdks-and-apis/client-sdks/react-native/1.0.0_project_setup.md)
{% endcontent-ref %}
{% endtab %}
{% endtabs %}

**Initialize the SDK**

With the provided `apiKey` you can now initialize the LucraClient SDK on your platform

{% tabs %}
{% tab title="iOS" %}
{% content-ref url="/pages/np2OOS1D9c7T0YH7FbMI" %}
[LucraClient Initialization (iOS)](/lucra-sdk/sdks-and-apis/client-sdks/ios/1.2.0_initialize_client.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Javascript" %}
{% content-ref url="/pages/PkTGPYh2Jj3FNZWR6wqX" %}
[Initializing the LucraClient](/lucra-sdk/sdks-and-apis/client-sdks/javascript-web/1.2_initialize_client.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Android" %}
{% content-ref url="/pages/6GiryIVJmsReaiw5Puqg" %}
[Initializing the LucraClient](/lucra-sdk/sdks-and-apis/client-sdks/android/1.2.0_initialize_client.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="React Native" %}
{% content-ref url="/pages/hXageI3tzKAdanQ2MbwP" %}
[LucraSDK Initialization](/lucra-sdk/sdks-and-apis/client-sdks/react-native/1.2.0_initialize_client.md)
{% endcontent-ref %}
{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}

#### Apply brand theming

Provide brand colors and images to make the Lucra experience as familiar as your own

{% content-ref url="/pages/zWiz3LPiEX9gh4U3OY6q" %}
[Branding & Theming](/lucra-sdk/readme/whats-included/branding-and-theming.md)
{% endcontent-ref %}
{% endstep %}

{% step %}

#### Configure your user

{% hint style="info" %}
This is an optional but **recommended** step.
{% endhint %}

When a user logs into Lucra for the first time, they are given a randomly generated name and will have no other identifying properties beyond the phone number they used to two-factor-authenticate into the experience.

{% hint style="success" %}
If a user has previously logged into Lucra under a separate product using the same phone number, their information will be merged and can be automatically verified if their account is still in good standing.
{% endhint %}

Upon attempting to create or join a matchup, or deposit money, they will be prompted for identifying information such as age and location so that we can verify they are compliant to proceed.

Supplying the information you have for the current user through the Lucra SDK can streamline the experience for a number of reasons:<br>

* Pre fill user information such as name, city, state, zip, address and email
* Pre fill and **lock** the phone number used to login
* Predefine their username so that the Lucra account is familiar to your platform's account
* Supply arbitrary metadata to Lucra users

{% hint style="warning" %}
To avoid compliance issues, we recommend sending identifying information that is accurate and up to date.
{% endhint %}

Find your client configure user SDK docs here

{% tabs %}
{% tab title="iOS" %}
{% content-ref url="/pages/hc6BkNd9161LAIuwukKk" %}
[Headless Functionality (iOS)](/lucra-sdk/sdks-and-apis/client-sdks/ios/1.2.9_headless_interactions.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Javascript" %}
{% content-ref url="/pages/f741cRKYLxLqnIR0Kn5C" %}
[Updating Users](/lucra-sdk/sdks-and-apis/client-sdks/javascript-web/1.8_updating_users.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Android" %}
{% content-ref url="/pages/icLjJly9wpu0cLQuZLcR" %}
[Interacting with Lucra Headless Functionality](/lucra-sdk/sdks-and-apis/client-sdks/android/1.2.9_headless_interactions.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="React Native" %}
{% content-ref url="/pages/vwFlUjjFRvIzWUzF0Oci" %}
[Headless Functionality](/lucra-sdk/sdks-and-apis/client-sdks/react-native/1.2.9_headless_interactions.md)
{% endcontent-ref %}
{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}

#### Setup Free to Play support

{% hint style="info" %}
This is an optional step, the Lucra SDK will not show reward options for matchup creation if not provided
{% endhint %}

The Lucra SDK offers the ability to provide Free to Play rewards to users who aren't interested in putting real money on the line. Rewards are entities defined and provided by you, at runtime. These rewards will show up as available items to select to put on the line instead of real money.

Learn more here:

{% content-ref url="/pages/pjOkLDuaoXvuwDPYltgM" %}
[Free to Play](/lucra-sdk/games-you-play-gyp/free-to-play.md)
{% endcontent-ref %}

Find your client platform Free To Play technical docs here

{% tabs %}
{% tab title="iOS" %}
{% content-ref url="/pages/kpiVSI6PS0HJna8YTZHo" %}
[Free to Play (FTP) Support — iOS](/lucra-sdk/sdks-and-apis/client-sdks/ios/1.2.6_free_to_play_support.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Javascript" %}
{% content-ref url="/pages/iSkJbeUMbXRQfIAF7wBX" %}
[Rewards](/lucra-sdk/sdks-and-apis/client-sdks/javascript-web/1.9_rewards.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Android" %}
{% content-ref url="/pages/7ef7SbcYUbbJBGHiCfHN" %}
[Free to Play support](/lucra-sdk/sdks-and-apis/client-sdks/android/1.2.6_free_to_play_support.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="React Native" %}
{% content-ref url="/pages/RsbVcguR97WnQhYQag7u" %}
[Free to Play Support](/lucra-sdk/sdks-and-apis/client-sdks/react-native/1.2.6_free_to_play_support.md)
{% endcontent-ref %}
{% endtab %}
{% endtabs %}

Find your API and Webhook Free To Play technical docs here

{% tabs %}
{% tab title="API Reference" %}
{% content-ref url="/pages/tRwOsOHKLm6f7TNMCeef" %}
[Broken mention](broken://pages/tRwOsOHKLm6f7TNMCeef)
{% endcontent-ref %}
{% endtab %}

{% tab title="Webhooks" %}
{% content-ref url="/pages/OfpSi1TA9riQfSSU7Rsp" %}
[Broken mention](broken://pages/OfpSi1TA9riQfSSU7Rsp)
{% endcontent-ref %}
{% endtab %}
{% endtabs %}

{% hint style="info" %}
Backend integration is not required for Free to Play support, but it can help with end to end user reward experiences
{% endhint %}
{% endstep %}

{% step %}

#### Setup Convert to Credit support

{% hint style="info" %}
This is an optional step, the Lucra SDK will not show Convert to Credit options if not provided
{% endhint %}

Convert to credit functionality allows users to convert their real money earnings into a defined currency of your choosing. An example would be converting $10 for 120 tokens within your ecosystem.

Learn more here:

{% content-ref url="/pages/FNscRl349D0rEKQcm44z" %}
[Convert to Credit](/lucra-sdk/convert-to-credit.md)
{% endcontent-ref %}

Find your platform technical convert to credit docs here:

{% tabs %}
{% tab title="iOS" %}
{% content-ref url="/pages/NZaHHqdzozTthoHjIvb4" %}
[Convert to Credit (C2C) Support — iOS](/lucra-sdk/sdks-and-apis/client-sdks/ios/1.2.5_convert_to_credit.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Javascript" %}
{% content-ref url="/pages/yg5qEKrL5B4jrPqgfWFt" %}
[Setting up Convert to Credit](/lucra-sdk/sdks-and-apis/client-sdks/javascript-web/1.7_convert_to_credit.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Android" %}
{% content-ref url="/pages/qN2esWt7N1Af3p8ZwsXs" %}
[Setting up Convert to Credit](/lucra-sdk/sdks-and-apis/client-sdks/android/1.2.5_convert_to_credit.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="React Native" %}
{% content-ref url="/pages/6KfnMoS3FC5qTBaRMLMi" %}
[Convert to Credit](/lucra-sdk/sdks-and-apis/client-sdks/react-native/1.2.5_convert_to_credit.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Server to Server" %}
{% content-ref url="/pages/t9PPD5nVAY1ps4bFPXeN" %}
[Broken mention](broken://pages/t9PPD5nVAY1ps4bFPXeN)
{% endcontent-ref %}
{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Successful [server to server integration](/lucra-sdk/games-you-play-gyp/gyp-sdks.md) is required for a successful convert to credit implementation
{% endhint %}
{% endstep %}

{% step %}

#### Enable Apple Pay, Paypal, Venmo for payments

{% hint style="info" %}
This is an optional step, a default payment processor comes out of the box.
{% endhint %}

{% hint style="info" %}
If Apple Pay enablement is desired for iOS, ReactNative and Javascript, please reach out to Lucra for further assistance
{% endhint %}

Read more here

{% content-ref url="/pages/1k8jP8csQLxtHF4Ax3eV" %}
[Payments](/lucra-sdk/readme/whats-included/payments.md)
{% endcontent-ref %}

Find your platform technical payment docs here

{% tabs %}
{% tab title="iOS" %}
{% content-ref url="/pages/pcDcWNn3maIuUVI5TNvY" %}
[Payments (iOS)](/lucra-sdk/sdks-and-apis/client-sdks/ios/1.2.4_payments.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Javascript" %}
{% hint style="info" %}
Web based Apple Pay requires assistance from the Lucra team, please reach out for more information
{% endhint %}
{% endtab %}

{% tab title="Android" %}
{% content-ref url="/pages/4gFtRIuyyCVzrewAr2qX" %}
[Payment Integrations](/lucra-sdk/sdks-and-apis/client-sdks/android/1.2.4_payments.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="React Native" %}
{% content-ref url="/pages/cZXOcqL5oee5w8TLp5m5" %}
[Payments](/lucra-sdk/sdks-and-apis/client-sdks/react-native/1.2.4_payments.md)
{% endcontent-ref %}
{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}

#### Implement Deeplink support

A key function of the Games You Play implementation is the ability for matchup creators to send matchup links to invite participants and allowing participants to open the link to join the fun.

This is a simple two step process of providing Lucra with a link that is recognized in *your platform ecosystem,* and forwarding the embedded Lucra details to the Lucra SDK to navigate invited users to the correct location at runtime.

{% hint style="warning" %}
If a deeplink is not provided to the Lucra SDK, the creation of a matchup will not allow the creator to proceed in the experience.
{% endhint %}

**Generating Lucra Deeplinks**

When a GYP matchup is created, the Lucra SDK will request a deeplink URL to be generated given a `matchupId` , it is your responsibility to take that `matchupId` and embed it in a link that is recognized by your platform.

An example of a returned deeplink could look something like this `https://www.app.com/matchupId?={matchupId}` or `app://matchupId?={matchupId}`

{% hint style="warning" %}
Ensure the deeplink URL is correctly recognized by your platform; otherwise, the links won't open your platform or direct an invitee to the Lucra GYP matchup.
{% endhint %}

**Handle incoming Lucra Deeplinks**

At this point, the link will be shared to participants who expect to be navigated to your platform (website or mobile app) and see the matchup to join on their own.

Continuing the example links above, `https://www.app.com/matchupId?={matchupId}` or `app://matchupId?={matchupId}` , you will simply extract the `matchupId` value and provide it to the Lucra SDK to open and navigate the user to the details of the matchup.

Find your platform technical deeplink docs here

{% tabs %}
{% tab title="iOS" %}
{% content-ref url="/pages/tEOEIk5BCe7JQIW6Bw0W" %}
[Deep Links (iOS)](/lucra-sdk/sdks-and-apis/client-sdks/ios/1.2.2_deeplinks.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Javascript" %}
{% content-ref url="/pages/nUdNXrwfHNrX9j3s6Uhn" %}
[Deeplink Support](/lucra-sdk/sdks-and-apis/client-sdks/javascript-web/1.4_deeplinks.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Android" %}
{% content-ref url="/pages/4aDgAFKxRfXwd8cg8n6t" %}
[Deeplink Support](/lucra-sdk/sdks-and-apis/client-sdks/android/1.2.2_deeplinks.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="React Native" %}
{% content-ref url="/pages/4aDgAFKxRfXwd8cg8n6t" %}
[Deeplink Support](/lucra-sdk/sdks-and-apis/client-sdks/android/1.2.2_deeplinks.md)
{% endcontent-ref %}
{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}

#### Launch the Create a Game Lucra experience

At this point, the Lucra SDK is ready get your users involved in GYP matchups. Lucra will handle user authentication, user identification, and any compliance forms required for real money actions.

That said, this requires intentional action by your platform to launch the Create A Game experience, both for creating and joining matchups.

**Creating a matchup**

{% tabs %}
{% tab title="iOS" %}
{% content-ref url="/pages/3LKCW3ULI30TvxXuVGYO" %}
[GYP Lucra Flows](/lucra-sdk/sdks-and-apis/client-sdks/ios/2.1_gyp_flows.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Javascript" %}
{% content-ref url="/pages/Z7XvxVs7vLDUrON9zORK" %}
[Lucra Flows Setup and Usage](/lucra-sdk/sdks-and-apis/client-sdks/javascript-web/1.3_lucraflows.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Android" %}
{% content-ref url="/pages/0uDgoviBjsb4jiP808eb" %}
[Games You Play Lucra Flows](/lucra-sdk/sdks-and-apis/client-sdks/android/2.1_gyp_flows.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="React Native" %}
{% content-ref url="/pages/n7HD8WLzROw83lApGIyg" %}
[GYP Flows](/lucra-sdk/sdks-and-apis/client-sdks/react-native/2.1_gyp_flows.md)
{% endcontent-ref %}
{% endtab %}
{% endtabs %}

**Joining a matchup**

This step is handled by a successful implementation of the [Handling Incoming Lucra Deeplinks](#handle-incoming-lucra-deeplinks) step above.
{% endstep %}

{% step %}

#### Listen for key events

Depending on your integration, you might need to know when users take certain actions. This can be for many reasons, including, but not limited to, the following:

* Know when a user creates a matchup
* Know when a user decides to join a matchup
* Know when a matchup has been started to navigate them away from the Lucra SDK
* Know the outcome of a matchup

The Lucra SDKs, APIs and Webhooks allow you to be in tune with much of the user's and matchup's lifecycle.

**Client SDKs**

Setup client side event listeners with the technical docs here

{% tabs %}
{% tab title="iOS" %}
{% content-ref url="/pages/SEXJGNeuWGI3rbbI5Pzr" %}
[GYP Events](/lucra-sdk/sdks-and-apis/client-sdks/ios/2.2_gyp_events.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Javascript" %}
{% content-ref url="/pages/Onnb3FcncGkw3OAlBnnY" %}
[Lucra Event Listener](/lucra-sdk/sdks-and-apis/client-sdks/javascript-web/1.6_lucra_event_listener.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Android" %}
{% content-ref url="/pages/6nZ7J4JYez8Mn7qh05Z2" %}
[Games You Play Events](/lucra-sdk/sdks-and-apis/client-sdks/android/2.2_gyp_events.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="React Native" %}
{% content-ref url="/pages/VFUzqPNlmksWfm3xZp4O" %}
[GYP Events](/lucra-sdk/sdks-and-apis/client-sdks/react-native/2.2_gyp_events.md)
{% endcontent-ref %}
{% endtab %}
{% endtabs %}

**Server Webhooks**

Setup your backend to receive webhooks here

{% content-ref url="/pages/ZmWF2RcqvEiEy4wvKPax" %}
[Broken mention](broken://pages/ZmWF2RcqvEiEy4wvKPax)
{% endcontent-ref %}
{% endstep %}

{% step %}

#### Setup remote matchup settlement

{% hint style="info" %}
This is an optional step, the out-of-the-box experience is such that, the creator decides the outcome of the GYP matchup, for both real money payouts and Free to Play rewards.
{% endhint %}

Given the nature of your platform, it may not be desirable to let the creator of matchups decide the outcome, this is where our GYP APIs come into play. If you're in full control of the game and know the outcome, you can settle matchups remotely.

The GYP REST API allows you to submit outcomes remotely.

{% content-ref url="/pages/bpTw0mvqHGFLCyxZ2aEL" %}
[Broken mention](broken://pages/bpTw0mvqHGFLCyxZ2aEL)
{% endcontent-ref %}

{% hint style="warning" %}
GYP remote settlement API functionality requires you to know the Lucra-owned IDs of the matchup and groups (teams). Use the appropriate GYP APIs and webhooks to keep track of these details and link them to your user so that accurate outcome details can be provided.
{% endhint %}
{% endstep %}

{% step %}

#### Test end-to-end

At this point, testing the full integration will likely be on your to-do list. This is where our `sandbox` environment comes in. This environment allows you to simulate a production environment with test users and money transactions that don't impact anyone's bank account.

Read more here

{% content-ref url="/pages/75qBkq1W3CD60doO42QQ" %}
[Testing](/lucra-sdk/readme/whats-included/implementation-support/testing.md)
{% endcontent-ref %}

{% hint style="warning" %}
When testing your Lucra SDK and API integration, be sure to use your provided `sandbox` keys for both client side SDKs and API endpoints.
{% endhint %}
{% endstep %}
{% endstepper %}

***

## GYP Platform Technical Documentation

{% tabs %}
{% tab title="iOS" %}
{% content-ref url="/pages/T6tPLgGIqqeBcFLdg9SN" %}
[Games You Play](/lucra-sdk/sdks-and-apis/client-sdks/ios/2.0_gyp.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Javascript" %}
{% content-ref url="/pages/1LtIv5lporn9jZzGvsBQ" %}
[Lucra SDK](/lucra-sdk/sdks-and-apis/client-sdks/javascript-web/0.0_readme.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Android" %}
{% content-ref url="/pages/rkndw7qS8bRwybUq296K" %}
[Games You Play](/lucra-sdk/sdks-and-apis/client-sdks/android/2.0.0_gyp.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="React Native" %}
{% content-ref url="/pages/kTsNHk3NA683mhh4vjG5" %}
[Games You Play (GYP)](/lucra-sdk/sdks-and-apis/client-sdks/react-native/2.0.0_gyp.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="APIs & Webhooks" %}
{% content-ref url="/pages/bpTw0mvqHGFLCyxZ2aEL" %}
[Broken mention](broken://pages/bpTw0mvqHGFLCyxZ2aEL)
{% endcontent-ref %}

{% content-ref url="/pages/ZmWF2RcqvEiEy4wvKPax" %}
[Broken mention](broken://pages/ZmWF2RcqvEiEy4wvKPax)
{% endcontent-ref %}
{% endtab %}
{% endtabs %}

***

## Mobile Notification Support

{% hint style="warning" %}
Successful mobile notification integration will require Lucra involvement, please reach out to your contact to learn more.
{% endhint %}

{% tabs %}
{% tab title="iOS" %}
{% content-ref url="/pages/fbduIajxAtBk81xSQjeO" %}
[Push Notifications (iOS)](/lucra-sdk/sdks-and-apis/client-sdks/ios/1.2.3_push_notifications.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Android" %}
{% content-ref url="/pages/sQsFPqNR56xpNCutK1Tm" %}
[Setting up Push Notifications](/lucra-sdk/sdks-and-apis/client-sdks/android/1.2.3_push_notifications.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="React Native" %}
{% content-ref url="/pages/h3cvYwUp8kMVx7IqKPMx" %}
[Push Notifications](/lucra-sdk/sdks-and-apis/client-sdks/react-native/1.2.3_push_notifications.md)
{% endcontent-ref %}
{% endtab %}
{% endtabs %}

***

## Common troubleshooting

### The Lucra SDK says I'm unauthorized after launching a Flow

Be sure to double check your provided `apiKey`(s) and the environment you're pointing to. Each platform (web, mobile, server) have a respective key *per environment*

### The deeplink doesn't navigate the user to the matchup join page

Double check your [deeplink implementation](#implement-deeplink-support), and verify the links you generate are registered/aligned with your mobile app/website's domain.

### Lucra says my account is suspended

Our compliance ruleset will suspend accounts for a number of different reasons due to suspicious activity. If you don't think your account should be suspended, please reach out to Lucra for assistance.

{% hint style="info" %}
Not finding the answers you're looking for? Reach out to your Lucra representative for further assistance
{% endhint %}
