Advanced Settings

VCS Rewarding VCS Errors Custom Params Debug Logging

VCS is the default rewarding option in the Console, so you should not have to make any configuration changes unless you have previously altered the setting.

If modifications to the rewarding settings are required, you can refer back to modifying your app settings.

Rewarding: VCS

Step 1: The Console 

VCS (Virtual Currency Server) is configured by default.

mceclip0.png

Going to VCS

However, it can be turned On or Off by changing the Reward Handling mode in the Settings section at any time.

mceclip1.png

Adjusting Reward Handling

Now that VCS is configured, let's set up the SDK side.

Step 2: Conforming to the VCS Protocol

Handling VCS is based on asynchronous operations.

Make one of your classes conform to the FYBVirtualCurrencyClientDelegate protocol and register it, via its delegate property:

Objective-C
#import "FyberSDK.h"
  
  @interface GemStoreViewController : UIViewController 
  @end
Swift
class GemStoneDelegate: UIResponder, UIWindowSceneDelegate, FYBVirtualCurrencyClientDelegate {
    // ...
  }

Step 3: Request for New Rewards

To reward your users after they have engaged with a rewarded ad format, you request the delta of coins:

Objective-C
// Get the Virtual Currency Client
  FYBVirtualCurrencyClient *virtualCurrencyClient = [FyberSDK virtualCurrencyClient];
  
  virtualCurrencyClient.delegate = self; // self should conform to the FYBVirtualCurrencyClientDelegate protocol
  
  // Request the delta of coins
  [virtualCurrencyClient requestDeltaOfCoins];
Swift
// Get the Virtual Currency Client
  let virtualCurrencyClient: FYBVirtualCurrencyClient = FyberSDK.virtualCurrencyClient()
  
  virtualCurrencyClient.delegate = self // self should conform to the FYBVirtualCurrencyClientDelegate protocol
  
  // Request the delta of coins
  virtualCurrencyClient.requestDeltaOfCoins()

Best Practice Check

Some DT Offer Wall requests can take a few moments longer to load, so ensure that you've configured for a potential 5 second delay.

Although we recommend you call the VCS when returning from the DT Offer Wall (after a short delay; recommended 5 seconds), you can also call when you're loading the screen that shows currency or after the user comes back from the DT Offer Wall.

Handling Multiple Currencies

If you have created multiple currencies for your application on your dashboard, the previous usage returns the delta of coins to your default currency.

Objective-C
FYBVirtualCurrencyClient *virtualCurrencyClient = [FyberSDK virtualCurrencyClient];
  virtualCurrencyClient.delegate = self;
  
  // Specify the currency id parameter
  FYBRequestParameters *parameters = [[FYBRequestParameters alloc] init];
  parameters.currencyId = @"gems";
  
  [virtualCurrencyClient requestDeltaOfCoinsWithParameters:parameters];
Swift
let virtualCurrencyClient: FYBVirtualCurrencyClient = FyberSDK.virtualCurrencyClient()
  virtualCurrencyClient.delegate = self
          
  // Specify the currency id parameter
  let parameters: FYBRequestParameters = FYBRequestParameters.init(placementId: "Placement", currencyId: "gems")
          
  virtualCurrencyClient.requestDeltaOfCoins(with: parameters)

Step 4: Handling the Response

You'll also need to implement the following method which will be called once the delta of coins has been requested:

Objective-C
- (void)virtualCurrencyClient:(FYBVirtualCurrencyClient *)client 
             didReceiveResponse:(FYBVirtualCurrencyResponse *)response
  {
      // Process the deltaOfCoins in the way that makes most sense for your application...
      NSLog(@"Received delta of coins: %.2f %@ (currency id: %@)", response.deltaOfCoins, response.currencyName, response.currencyId);
  }
Swift
func virtualCurrencyClient(_ client: FYBVirtualCurrencyClient!, didReceive response: FYBVirtualCurrencyResponse!) {
    // Process the deltaOfCoins in the way that makes most sense for your application...
    print(String(format: "Received delta of coins: %.2f %@ (currency id: %@)", response.deltaOfCoins, response.currencyName!, response.currencyId!))
  }

You've set up DT Offer Wall via SDK!

Is your VCS throwing an error code? Review the VCS Error Types.

Optional: Disable the Toast Message

DT SDK displays a notification such as "Congratulations! You have earned 10 gold coins" whenever a reward is received. If you would like to disable the notification, add the following after starting the SDK:

Objective-C
[FyberSDK instance].shouldShowToastOnReward = NO;
Swift
FyberSDK.instance()?.shouldShowToastOnReward = false

Back to Top ⇧