Validation of payments and time adjustments in devtosev SDK for Unity

Payments validation

To be protected from fraudulent transactions, we recommend you to use devtodev Anticheat service.

Use this method, and devtodev will check the transaction validity with the payment platform, and the response will be returned to the application.

1. Call the method for payment verification:

DevToDev.AntiCheat.VerifyReceipt(string receipt, string signature, string publicKey,
                                 OnReceiptVerifyCallback callback);

where OnReceiptVerifyCallback is the function like this:

public void onReceiptVerifyCallback (DevToDev.ReceiptVerificationStatus status) {
  Debug.Log ("Verification status" + status);
  //TODO put your source here
}

ReceiptVerificationStatus can take one of following values:

public enum ReceiptVerificationStatus {
  ReceiptValid,
  ReceiptNotValid,
  ReceiptServerError,
  ReceiptSandbox,
  ReceiptInternalError    
};

Don't forget that it is enough to set only receipt field to check the payment on iOS (iTunes) or Windows/Windows Phone (Microsoft Store), and for Android (Google Play) the fields signature and publicKey should be set.

NOTICE! Сore SDK should be initialized prior the call of VerifyPayment function. 

2. In case of successful check call following main SDK method:

DevToDev.Anatylics.RealPayment(string pPaymentId, float pInAppPrice, string pInAppName,
                               string pInAppCurrencyISOCode);

 

Time cheats check

To check for time cheats call VerifyTime method.

1. Call the method to time verification:

DevToDev.AntiCheat.VerifyTime(OnTimeVerifyCallback callback);

where OnTimeVerifyCallback is the function like this:

public void onTimeVerifyFinished (DevToDev.TimeVerificationStatus status) {
  Debug.Log ("Verification status" + status);
  //TODO put your source here
};

DevToDevTimeVerificationStatus can take one of following values:

public enum TimeVerificationStatus {
   TimeValid,
   TimeForward,
   TimeRewind
};

NOTICE! Сore SDK should be initialized prior the call of VerifyTime function.

Secondary methods
Checking the events