money-bill-transferConvert to Credit

Overview

The Convert to Credit feature allows end users to convert dollars they've deposited or won playing contests into credit they can use within your ecosystem. The conversion process can be configured with a multiplier to incentivize opting for this conversion over other withdrawal methods.

The integration process consists of configuration data being passed in the mobile SDK as well a server to server integration to accept the Convert to Credit request payload and confirm it's status.

iOS Integration

Provider Interface

public protocol ConvertToCreditProvider {
    func withdrawMethod(for amount: Decimal) async -> CreditWithdrawal
}

Callback Registration

In order to use the feature, create an object that conforms to the ConvertToCreditProvider protocol, and pass that object into the LucraClient's registerConvertToCreditProvider method.

@State var convertToCreditProvider: ConvertToCreditProvider? = YourC2CProvider()

lucraClient.registerConvertToCreditProvider(convertToCreditProvider)

Interface Implementation

Create a class that implements the ConvertToCredit protocol. This protocol will be called on the Withdraw Funds screen when the Convert To Credit button is visible, and when the amount is updated. This method will expect a CredithWithdrawal object to be returned, which can be initialized with the parameters below.

This method is async, allowing time to make a callback to your server if necessary for any updates needed with the newly provided amount.

Theme Object

A Theme object is available to be passed in as well which will allow you to customize the colors of the Convert To Credit button. The icon is customized by the iconUrl parameter in the CreditWithdrawal object.

Convert to Credit Initial Presentation
Convert to Credit Transfer Confirmation

Android Integration

To integrate the Convert to Credit implementation on Android, you will need to provide the LucraConvertToCreditProvider to the LucraClient via the setConvertToCreditProvider() call.

The getCreditAmount function needs to return a LucraConvertToCreditWithdrawMethod data object. LucraConvertToCreditWithdrawMethod will dictate what is shown to the end user and will be used to coordinate the conversion to credit with the back-end servers.

If the provider is never set or it returns a null value, the Convert to Credit withdrawal option will not be displayed on the Withdraw Screen.

LucraConvertToCreditWithdrawMethod

LucraWithdrawCardTheme

getCreditAmount can handle longer-running operations if you want to keep your conversion logic on your back-end servers.

A sample implementation can be seen below.

As you can see from the screenshot below, the String values provided to the LucraConvertToCreditWithdrawMethod map directly to the UI that the end user will see. The colors provided to WithdrawCardTheme dictate the colors of both the pill and the card item. If no theme is provided, the SDK will fall back on the color scheme provided by the ClientTheme object.

Server to Server Integration

Subscribing to the webhook event C2CWithdrawal as outlined in the webhook documentation is a required part of completing the Convert to Credit integration. The webhook and response determine what gets shown to the end user including success and error messaging.

Convert to Credit Confirmation

Last updated