Get response about a completed transaction from the payment system.
Either send data about the received transaction for verification by calling devtodev anti-cheat methods or use your own tools for transaction verification.
If the transaction has successfully passed verification, perform the Payment event.
If the transaction hasn’t passed verification, do not perform the Payment event and mark the user as a cheater.
The devtodev service allows you to validate transactions to prevent fraud from influencing your statistics. For this, you need to integrate DTDAntiCheat
module.
We strongly discourage you from using verification results for deciding on allowing or denying users to receive their purchases! Employ this method exclusively for preventing fraud transaction data from being sent to devtodev!
To validate the transaction you can use the verifyPayment(completionHandler: @escaping (DTDVerifyResponse) -> Void)
method immediately during the transaction processing, e.g.:
DTDVerifyResponse
The DTDVerifyResponse object returned while validating the transaction has two properties:
DTDReceiptStatus
The enum type returned as a result of validation can receive the following values:
We recommend calling the Real Currency Payment method in all cases except when you receive receiptNotValid
or receiptSandbox
as a result of the validation.
To validate the transaction you can use the (void)verifyPaymentCompletion:( void (^ _Nonnull)(DTDVerifyResponse * _Nonnull))completionHandler;
method immediately during the transaction processing, e.g.:
DTDVerifyResponse
The DTDVerifyResponse object returned while validating the transaction has two properties:
DTDReceiptStatus
The enum type returned as a result of validation can receive the following values:
We recommend calling the Real Currency Payment method in all cases except when you receive receiptNotValid
or receiptSandbox
as a result of the validation.
When GooglePlay sends the transaction back to your onActivityResult
, validate it by calling the following method: verifyPayment(receipt: String, signature: String, publicKey: String, completionHandler:(DTDVerifyResponse) -> Unit)
immediately during the transaction processing, e.g.:
DTDVerifyResponse
The DTDVerifyResponse object returned while validating the transaction has two properties:
DTDReceiptStatus
The enum type returned as a result of validation can receive the following values:
We recommend calling the Real Currency Payment method in all cases except when you receive receiptNotValid
as a result of the validation.
When GooglePlay sends the transaction back to your onActivityResult
, validate it by calling the following method: verifyPayment(receipt: String, signature: String, publicKey: String, completionHandler:(DTDVerifyResponse) -> Unit)
immediately during the transaction processing, e.g.:
DTDVerifyResponse
The DTDVerifyResponse object returned while validating the transaction has two properties:
DTDReceiptStatus
The enum type returned as a result of validation can receive the following values:
We recommend calling the Real Currency Payment method in all cases except when you receive receiptNotValid
as a result of the validation.
devtodev sends a request for transaction verification to the payment platform and then forwards the answer to the app.
To validate the transaction you can use theTask<DTDReceiptStatus> VerifyPayment(string: receipt)
method. As an argument pass the PurchaseResults.ReceiptXml
property. More information about it here.
Example of verification:
DTDVerifyResponse
The DTDVerifyResponse object returned while validating the transaction has two properties:
DTDReceiptStatus
The enum type returned as a result of validation can receive the following values:
We recommend calling the Real Currency Payment method in all cases except when you receive Invalid
as a result of the validation.
If you use Unity IAP for payment validation, call the following method: void VerifyPayment(string publicKey, string receipt, Action completionHandler)
Example:
To validate data received from Google play, use void VerifyPayment(string publicKey, string receipt, string signature,Action<DTDVerifyResponse> completionHandler)
when handling the transaction.
Here's how to find your app's public key for licensing (for Google Play platform only, for other platforms the publicKey is not used):
Go to the Google Play Console and sign in. Make sure that you sign in to the account from which the app you are licensing is published (or will be published).
In the app details page, locate the Services & APIs link and click it.
In the Services & APIs page, locate the Licensing & In-App Billing section. Your public key for licensing is given in the Your License Key For This Application field.
If you use Unity IAP for payment validation, call the following method: void VerifyPayment(string receipt, Action completionHandler)
If you use Unity IAP for payment validation, call the following method: void VerifyPayment(string receipt, Action completionHandler)
N.B. You can pass a native XML recipe to the receipt argument.
DTDVerifyResponse
The DTDVerifyResponse object returned while validating the transaction has two properties:
DTDReceiptStatus
The enum type returned as a result of validation can receive the following values:
We recommend calling the Real Currency Payment method in all cases except when you receive receiptNotValid
or receiptSandbox
as a result of the validation.
Property
Description
receiptStatus
Enum type DTDReceiptStatus
that represents the result of the transaction validation.
verificationResult
Additional information from the validation server.
Value
Description
receiptValid
The payment is valid, the transaction is genuine.
receiptNotValid
The payment is invalid, the transaction may be a duplicate or fraud.
receiptServerError
Server error when validating the payment.
receiptSandbox
Test payment.
receiptInternalError
Internal SDK error.
Property
Description
receiptStatus
Enum type DTDReceiptStatus
that represents the result of the transaction validation.
verificationResult
Additional information from the validation server.
Value
Description
receiptValid
The payment is valid, the transaction is genuine.
receiptNotValid
The payment is invalid, the transaction may be a duplicate or fraud.
receiptServerError
Server error when validating the payment.
receiptSandbox
Test payment.
receiptInternalError
Internal SDK error.
Property
Description
receiptStatus
Enum type DTDReceiptStatus
that represents the result of the transaction validation.
verificationResult
Additional information from the validation server.
Value
Description
receiptValid
The payment is valid, the transaction is genuine.
receiptNotValid
The payment is invalid, the transaction may be a duplicate or fraud.
receiptServerError
Server error when validating the payment.
receiptInternalError
Internal SDK error.
Property
Description
receiptStatus
Enum type DTDReceiptStatus
that represents the result of the transaction validation.
verificationResult
Additional information from the validation server.
Value
Description
receiptValid
The payment is valid, the transaction is genuine.
receiptNotValid
The payment is invalid, the transaction may be a duplicate or fraud.
receiptServerError
Server error when validating the payment.
receiptInternalError
Internal SDK error.
Property
Description
ReceiptStatus
Enum type DTDReceiptStatus
that represents the result of the transaction validation.
VerificationResult
Additional information from the validation server.
Value
Description
Valid = 0L
The payment is valid, the transaction went through successfully
Invalid = 1L
The payment is invalid, the transaction may be a duplicate or fraud
ServerError = 2L
Server error when validating the payment
InternalError = 4L
Internal SDK error
Property
Description
receiptStatus
Enum type DTDReceiptStatus
that represents the result of the transaction validation.
verificationResult
Additional information from the validation server.
Value
Description
receiptValid
The payment is valid, the transaction is genuine.
receiptNotValid
The payment is invalid, the transaction may be a duplicate or fraud.
receiptServerError
Server error when validating the payment.
receiptSandbox
Test payment.
receiptInternalError
Internal SDK error.