Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

com.adjust.sdk.purchase

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

com.adjust.sdk.purchase - npm Package Compare versions

Comparing version 0.1.1 to 1.0.0

11

CHANGELOG.md

@@ -0,1 +1,12 @@

### Version 1.0.0 (10th August 2016)
#### Added
- Added product ID to the iOS verification request.
#### Changed
- Updated docs.
- Updated native iOS purchase SDK version is **1.0.0**.
- Updated native Android purchase SDK version is **1.1.2**.
---
### Version 0.1.1 (19th May 2016)

@@ -2,0 +13,0 @@ #### Added

@@ -0,1 +1,11 @@

### Version 1.1.2 (4th August 2016)
#### Changed
- Allowing `developerPayload` parameter in verification request to be empty string.
- Updated docs.
#### Fixed
- Upon invalid verification request parameters, reporting status code `-1`.
---
### Version 1.1.1 (4th April 2016)

@@ -2,0 +12,0 @@ #### Fixed

172

ext/Android/sdk/README.md
## Summary
This is the Android purchase SDK of adjust™. You can read more about adjust™ at
adjust.com.
This is the Android purchase SDK of adjust™. You can read more about adjust™ at [adjust.com].
## Basic Installation
## Table of contents
In order to use the adjust purchase SDK, you must **first enable fraud prevention**
for your app. You can find the instructions in our official
[fraud prevention guide][fraud-prevention] documentation.
* [Basic integration](#basic-integration)
* [Get the SDK](#sdk-get)
* [Import the SDK module](#sdk-import)
* [Add the SDK library to your project](#sdk-add)
* [Integrate the SDK into your app](#sdk-integrate)
* [Adjust Purchase logging](#sdk-logging)
* [Verify your purchases](#verify-purchases)
* [Make the verification request](#verification-request)
* [Process verification response](#verification-response)
* [Track your verified purchases](#track-purchases)
* [Best practices](#best-practices)
* [License](#license)
These are the basic steps required to integrate the adjust purchase SDK into
your Android project. We are going to assume that you use Android Studio for
your Android development and target an Android API level 9 (Gingerbread) or later.
## Basic integration
### 1. Get the SDK
In order to use the adjust purchase SDK, you must **first enable fraud prevention** for your app. You can find the
instructions in our official [fraud prevention guide][fraud-prevention] documentation.
Download the latest version from our [releases page][releases]. Extract the
archive in a folder of your choice.
These are the basic steps required to integrate the adjust purchase SDK into your Android project. We are going to assume
that you use Android Studio for your Android development and target an Android API level 9 (Gingerbread) or later.
### 2. Import the module
### <a id="sdk-get"></a>Get the SDK
Download the latest version from our [releases page][releases]. Extract the archive in a folder of your choice.
### <a id="sdk-import"></a>Import the SDK module
In the Android Studio menu select `File → New → Import Module...`.

@@ -27,14 +38,13 @@

In the `Source directory` field, locate the folder you extracted in step 1.
Select and choose the folder `./android_purchase_sdk/AdjustPurchase/adjust_purchase`.
Make sure the module name `:adjust_purchase` appears before finishing.
In the `Source directory` field, locate the folder you extracted in [previous step](#sdk-get). Select and choose the folder
`./android_purchase_sdk/AdjustPurchase/adjust_purchase`. Make sure the module name `:adjust_purchase` appears before
finishing.
![][select_module]
The `adjust_purchase` module should be imported into your Android Studio project
afterwards.
The `adjust_purchase` module should be imported into your Android Studio project afterwards.
![][imported_module]
### <a id="step3"></a>3. Add the adjust library to your project
### <a id="sdk-add"></a>Add the SDK library to your project

@@ -50,6 +60,6 @@ Open the `build.gradle` file of your app and find the `dependencies` block. Add

### 4. Integrate Adjust into your app
### <a id="sdk-integrate"></a>Integrate the SDK into your app
In your `Application` class find or create the `onCreate` method and add the
following code to initialize the adjust purchase SDK:
In your `Application` class find or create the `onCreate` method and add the following code to initialize the adjust
purchase SDK:

@@ -80,4 +90,3 @@ ```java

Depending on whether you build your app for testing or for production, you must
set `environment` with one of these values:
Depending on whether you build your app for testing or for production, you must set `environment` with one of these values:

@@ -89,17 +98,13 @@ ```java

**Important:** This value should be set to `ADJPConstants.ENVIRONMENT_SANDBOX`
if and only if you or someone else is testing your app. Make sure to set the
environment to `ADJPConstants.ENVIRONMENT_PRODUCTION` just before you publish
the app. Set it back to `ADJPConstants.ENVIRONMENT_SANDBOX` when you start
developing and testing it again.
**Important:** This value should be set to `ADJPConstants.ENVIRONMENT_SANDBOX` if and only if you or someone else is testing
your app. Make sure to set the environment to `ADJPConstants.ENVIRONMENT_PRODUCTION` just before you publish the app. Set it
back to `ADJPConstants.ENVIRONMENT_SANDBOX` when you start developing and testing it again.
We use this environment to distinguish between real traffic and test traffic
from test devices. It is very important that you keep this value meaningful at
all times!
We use this environment to distinguish between real traffic and test traffic from test devices. It is very important that
you keep this value meaningful at all times!
#### Adjust Purchase Logging
### <a id="sdk-logging"></a>Adjust Purchase logging
You can increase or decrease the amount of logs you see in tests by calling
`setLogLevel` on your `ADJPConfig` instance with one of the following
parameters:
You can increase or decrease the amount of logs you see in tests by calling `setLogLevel` on your `ADJPConfig` instance with
one of the following parameters:

@@ -115,12 +120,10 @@ ```java

### 5. Verify your purchases
## <a id="verify-purchases"></a>Verify your purchases
#### Make the verification request
### <a id="verification-request"></a>Make the verification request
In order to verify purchase in your app, you need to call the `verifyPurchase`
method on the `AdjustPurchase` instance. Please make sure to call this method
once your purchase has been successfully performed.
In order to verify purchase in your app, you need to call the `verifyPurchase` method on the `AdjustPurchase` instance.
Please make sure to call this method once your purchase has been successfully performed.
Here is one example (depending on which IAP API
you are using) for how you can do this:
Here is one example (depending on which IAP API you are using) for how you can do this:

@@ -150,10 +153,18 @@ ```java

#### Process verification response
Method of the adjust purchase SDK used to make verification request exects you to pass following parameters:
As described in code above, in the last parameter of this method you should pass an
object that implements the `OnADJPVerificationFinished` protocol. To do this, you need
to override the method called `onVerificationFinished`. This method will called by our
purchase SDK once the response arrives. The response to purchase verification is represented
with an `ADJPVerificationInfo` object and it contains following information:
```
itemSku // Unique order ID (SKU)
itemToken // A token that uniquely identifies a purchase
developerPayload // A developer-specified string that contains supplemental information about an order
callback // Callback method which will process the verification response
```
### <a id="verification-response"></a>Process verification response
As described in code above, in the last parameter of this method you should pass an object that implements the
`OnADJPVerificationFinished` protocol. To do this, you need to override the method called `onVerificationFinished`. This
method will called by our purchase SDK once the response arrives. The response to purchase verification is represented with
an `ADJPVerificationInfo` object and it contains following information:
```java

@@ -174,21 +185,19 @@ info.getVerificationState() // State of purchase verification.

* If the purchase was successfully verified by Google servers, `ADJPVerificationStatePassed`
will be reported together with the status code `200`.
* If the Google servers recognized the purchase as invalid, `ADJPVerificationStateFailed` will
be reported together with the status code `406`.
* If the Google servers didn't provide us with any kind of answer to our request to verify
your purchase, `ADJPVerificationStateUnknown` will be reported together with status
code `204`. This situation means that we didn't manage to get any information from the
Google servers regarding validity of your purchase. This does not say anything about the purchase
itself. It might be both - valid or invalid. This state will also be reported if any
other situation occurs that prevents us from reporting the correct state of your
purchase verification. More details about these errors can be found by calling the
`getMessage()` method on the `ADJPVerificationInfo` object.
* If `ADJPVerificationStateNotVerified` is reported, that means that the call to the
`verifyPurchase` method was done with invalid parameters.
* If the purchase was successfully verified by Google servers, `ADJPVerificationStatePassed` will be reported together with
the status code `200`.
* If the Google servers recognized the purchase as invalid, `ADJPVerificationStateFailed` will be reported together with the
status code `406`.
* If the Google servers didn't provide us with any kind of answer to our request to verify your purchase,
`ADJPVerificationStateUnknown` will be reported together with status code `204`. This situation means that we didn't manage
to get any information from the Google servers regarding validity of your purchase. This does not say anything about the
purchase itself. It might be both - valid or invalid. This state will also be reported if any other situation occurs that
prevents us from reporting the correct state of your purchase verification. More details about these errors can be found by
calling the `getMessage()` method on the `ADJPVerificationInfo` object.
* If `ADJPVerificationStateNotVerified` is reported, that means that the call to the `verifyPurchase` method was done with
invalid parameters.
### 6. Track your verified purchases
### <a id="track-purchases"></a>Track your verified purchases
After a purchase is successfully verified, you can track it with our official
adjust SDK and keep track of revenue in your dashboard.
After a purchase is successfully verified, you can track it with our official adjust SDK and keep track of revenue in your
dashboard.

@@ -209,14 +218,12 @@ Using the examples from above, you can do this as follows:

#### Best practices
## <a id="best-practices"></a>Best practices
Once `ADJPVerificationStatePassed` or `ADJPVerificationStateFailed` are reported, you can
be sure that this decision was made by Google servers and you can rely on them to track
or not to track your purchase revenue. Once `ADJPVerificationStateUnknown` is reported,
you can decide what you want to do with this purchase.
Once `ADJPVerificationStatePassed` or `ADJPVerificationStateFailed` are reported, you can be sure that this decision was
made by Google servers and you can rely on them to track or not to track your purchase revenue. Once
`ADJPVerificationStateUnknown` is reported, you can decide what you want to do with this purchase.
For statistical purposes, it may be wise to have a single defined event for each of
these scenarios in the adjust dashboard. This way, you can have better overview of how
many of your purchases was marked as passed, how many of them failed and how many of them
were not able to be verified and returned an unknown status. You can also keep track of
unverified purchases if you would like to.
For statistical purposes, it may be wise to have a single defined event for each of these scenarios in the adjust dashboard.
This way, you can have better overview of how many of your purchases was marked as passed, how many of them failed and how
many of them were not able to be verified and returned an unknown status. You can also keep track of unverified purchases if
you would like to.

@@ -246,14 +253,19 @@ If you decide to do so, your method for handling the response can look like this:

Purchase Verification is not intended to be used to approve/reject delivery of goods sold. Purchase Verification is
intended to align reported transaction data with actual transaction data.
[dashboard]: http://adjust.com
[adjust.com]: http://adjust.com
[dashboard]: http://adjust.com
[maven]: http://maven.org
[releases]: https://github.com/adjust/android_purchase_sdk/releases
[fraud-prevention]: https://docs.adjust.com/en/fraud-prevention/
[releases]: https://github.com/adjust/android_purchase_sdk/releases
[import_module]: https://raw.github.com/adjust/sdks/master/Resources/android_purchase/import_module.png
[select_module]: https://raw.github.com/adjust/sdks/master/Resources/android_purchase/select_module.png
[imported_module]: https://raw.github.com/adjust/sdks/master/Resources/android_purchase/imported_module.png
[application_config]: https://raw.github.com/adjust/sdks/master/Resources/android_purchase/application_config.png
[gradle_adjust_purchase]: https://raw.github.com/adjust/sdks/master/Resources/android_purchase/gradle_adjust_purchase.png
[application_config]: https://raw.github.com/adjust/sdks/master/Resources/android_purchase/application_config.png
## License
## <a id="license"></a>License

@@ -260,0 +272,0 @@ The adjust purchase SDK is licensed under the MIT License.

@@ -1,6 +0,15 @@

### Version 0.2.1 (18th May 2016)
### Version 1.0.0 (4th August 2016)
#### Added
- Added check to determine if receipt is already base64 encoded.
- Added `product ID` to the verification request.
#### Changed
- Updated docs.
---
### Version 0.2.1 (18th May 2016) [pre-release]
#### Added
- Added check to determine if receipt is already `base64` encoded.
#### Changed
- Improved logging and status code reporting.

@@ -10,5 +19,5 @@

### Version 0.2.0 (4th April 2016)
### Version 0.2.0 (4th April 2016) [pre-release]
#### Added
- Added possibility to set SDK prefix (for non-native purchase SDK usage only).
- Added possibility to set SDK prefix (**for non-native purchase SDK usage only**).
- Added possibility to verify purchase by passing only transaction ID string.

@@ -21,4 +30,4 @@

### Version 0.1.0 (2nd March 2016)
### Version 0.1.0 (2nd March 2016) [pre-release]
#### Added
- Initial release of the adjust purchase SDK for iOS.
## Summary
This is the iOS purchase SDK of adjust™. You can read more about adjust™ at
[adjust.com].
This is the iOS purchase SDK of adjust™. You can read more about adjust™ at [adjust.com].
## Basic integration
## Table of contents
In order to use the adjust purchase SDK, you must **first enable fraud prevention**
for your app. You can find the instructions in our official
[fraud prevention guide][fraud-prevention] documentation.
* [Basic integration](#basic-integration)
* [Get the SDK](#sdk-get)
* [Add the SDK to your project](#sdk-add)
* [Integrate the SDK into your app](#sdk-integrate)
* [Import statement](#sdk-import)
* [Basic setup](#basic-setup)
* [Adjust Purchase logging](#sdk-logging)
* [Verify your purchases](#verify-purchases)
* [Make the verification request](#verification-request)
* [Process verification response](#verification-response)
* [Track your verified purchases](#track-purchases)
* [Best practices](#best-practices)
* [License](#license)
We will describe the steps to integrate the adjust purchase SDK into your iOS project.
We are going to assume that you use Xcode for your iOS development.
## <a id="basic-integration">Basic integration
If you're using [Carthage][carthage], you can add following line to your `Cartfile`
and continue with [step 3](#step3):
In order to use the adjust purchase SDK, you must **first enable fraud prevention** for your app. You can find the
instructions in our official [fraud prevention guide][fraud-prevention] documentation.
We will describe the steps to integrate the adjust purchase SDK into your iOS project. We are going to assume that you use
Xcode for your iOS development.
If you're using [Carthage][carthage], you can add following line to your `Cartfile` and continue with [step 3](#step3):
```ruby

@@ -22,4 +35,4 @@ github "adjust/ios_purchase_sdk"

You can also choose to integrate the adjust purchase SDK by adding it to your project as a framework.
On the [releases page][releases] you can find four archives:
You can also choose to integrate the adjust purchase SDK by adding it to your project as a framework. On the [releases
page][releases] you can find four archives:

@@ -29,29 +42,25 @@ * `AdjustPurchaseSdkStatic.framework.zip`

Since the release of iOS 8, Apple has introduced dynamic frameworks (also known as embedded frameworks).
If your app is targeting iOS 8 or higher, you can use the adjust purchase SDK dynamic framework.
Choose which framework you want to use – static or dynamic – and add it to your project
before continuing with [step 3](#step3).
Since the release of iOS 8, Apple has introduced dynamic frameworks (also known as embedded frameworks). If your app is
targeting iOS 8 or higher, you can use the adjust purchase SDK dynamic framework. Choose which framework you want to use –
static or dynamic – and add it to your project before continuing with [step 3](#step3).
### 1. Get the SDK
### <a id="sdk-get"></a>Get the SDK
Download the latest version from our [releases page][releases]. Extract the
archive into a directory of your choice.
Download the latest version from our [releases page][releases]. Extract the archive into a directory of your choice.
### 2. Add it to your project
### <a id="sdk-add"></a>Add the SDK to your project
In Xcode's Project Navigator locate the `Supporting Files` group (or any other
group of your choice). From Finder, drag the `AdjustPurchase` subdirectory into Xcode's
`Supporting Files` group.
In Xcode's Project Navigator locate the `Supporting Files` group (or any other group of your choice). From Finder, drag the
`AdjustPurchase` subdirectory into Xcode's `Supporting Files` group.
![][drag]
In the dialog `Choose options for adding these files` make sure to check the
checkbox to `Copy items if needed` and select the radio button to `Create
groups`.
In the dialog `Choose options for adding these files` make sure to check the checkbox to `Copy items if needed` and select
the radio button to `Create groups`.
![][add]
### <a id="step3"></a>3. Integrate Adjust Purchase into your app
### <a id="sdk-integrate"></a>Integrate the SDK into your app
#### Import statement
#### <a id="sdk-import"></a>Import statement

@@ -64,4 +73,3 @@ If you added the adjust SDK from the source, you should use following import statement:

If you added the adjust SDK as a framework or via Carthage, you should use
following import statement:
If you added the adjust SDK as a framework or via Carthage, you should use following import statement:

@@ -74,12 +82,11 @@ ```objc

#### Basic Setup
#### <a id="basic-setup"></a>Basic setup
In the Project Navigator, open the source file of your application delegate.
Add the `import` statement at the top of the file, then add the following call
to `AdjustPurchase` in the `didFinishLaunching` or `didFinishLaunchingWithOptions`
method of your app delegate:
In the Project Navigator, open the source file of your application delegate. Add the `import` statement at the top of the
file, then add the following call to `AdjustPurchase` in the `didFinishLaunching` or `didFinishLaunchingWithOptions` method
of your app delegate:
```objc
#import "AdjustPurchase.h"
// or #import #import <AdjustPurchaseSdk/AdjustPurchase.h>
// or #import <AdjustPurchaseSdk/AdjustPurchase.h>

@@ -96,7 +103,5 @@ // ...

Replace `{YourAppToken}` with your app token. You can find this in your
[dashboard].
Replace `{YourAppToken}` with your app token. You can find this in your [dashboard].
Depending on whether you build your app for testing or for production, you must
set `environment` with one of these values:
Depending on whether you build your app for testing or for production, you must set `environment` with one of these values:

@@ -108,16 +113,13 @@ ```objc

**Important:** This value should be set to `ADJPEnvironmentSandbox` if and only
if you or someone else is testing your app. Make sure to set the environment to
`ADJPEnvironmentProduction` just before you publish the app. Set it back to
**Important:** This value should be set to `ADJPEnvironmentSandbox` if and only if you or someone else is testing your app.
Make sure to set the environment to `ADJPEnvironmentProduction` just before you publish the app. Set it back to
`ADJPEnvironmentSandbox` when you start developing and testing it again.
We use this environment to distinguish between real traffic and test traffic
from test devices. It is very important that you keep this value meaningful at
all times!
We use this environment to distinguish between real traffic and test traffic from test devices. It is very important that
you keep this value meaningful at all times!
#### Adjust Purchase Logging
#### <a id="sdk-logging"></a>Adjust Purchase logging
You can increase or decrease the amount of logs you see in tests by calling
`setLogLevel:` on your `ADJPConfig` instance with one of the following
parameters:
You can increase or decrease the amount of logs you see in tests by calling `setLogLevel:` on your `ADJPConfig` instance
with one of the following parameters:

@@ -133,10 +135,9 @@ ```objc

### 4. Verify your purchases
### <a id="verify-purchases"></a>Verify your purchases
#### Make the verification request
#### <a id="verification-request"></a>Make the verification request
In order to verify in-app purchases, you need to call the `verifyPurchase:forTransaction:withResponseBlock`
method on the `AdjustPurchase` instance. Please make sure to call this method
after `finishTransaction` in `paymentQueue:updatedTransaction` only if the
state changed to `SKPaymentTransactionStatePurchased`.
In order to verify in-app purchases, you need to call the `verifyPurchase:forTransaction:productId:withResponseBlock`
method on the `AdjustPurchase` instance. Please make sure to call this method after `finishTransaction` in
`paymentQueue:updatedTransaction` only if the state changed to `SKPaymentTransactionStatePurchased`.

@@ -160,2 +161,3 @@ ```objc

forTransaction:transaction
productId:@"your_product_id"
withResponseBlock:^(ADJPVerificationInfo *info) {

@@ -185,11 +187,20 @@ // Process ADJPVerificationInfo object...

#### Process verification response
Method of the adjust purchase SDK used to make verification request exects you to pass following parameters:
As described in the code above, you need to pass a block which is going to process
verification response to `verifyPurchase:forTransaction:withResponseBlock` method.
```objc
receipt // App receipt of NSData type
transaction // Finished transaction object of SKPaymentTransaction type
productId // Your purchased product identifier of NSString type
responseBlock // Callback method which will process the verification response
```
In the example above, we designed the `adjustVerificationUpdate` method to be called once the response
arrives. The response to purchase verification is represented with an `ADJPVerificationInfo`
object and it contains following information:
#### <a id="verification-response"></a>Process verification response
As described in the code above, you need to pass a block which is going to process verification response to
`verifyPurchase:forTransaction:productId:withResponseBlock` method.
In the example above, we designed the `adjustVerificationUpdate` method to be called once the response arrives. The
response to purchase verification is represented with an `ADJPVerificationInfo` object and it contains following
information:
```objc

@@ -210,24 +221,20 @@ [info verificationState]; // State of purchase verification.

* If the purchase was successfully verified by Apple servers, `ADJPVerificationStatePassed`
will be reported together with the status code `200`.
* If the Apple servers recognized the purchase as invalid, `ADJPVerificationStateFailed` will
be reported together with the status code `406`.
* If the Apple server did not provide us with an answer for our request to verify
your purchase, `ADJPVerificationStateUnknown` will be reported together with the status
code `204`. This means that we did not recieve any information from
Apple servers regarding validity of your purchase. This does not say anything about the purchase
itself. It might be both - valid or invalid. This state will also be reported if any
other situation prevents us from reporting the correct state of your
purchase verification. More details about these errors can be found in the `message` field
of `ADJPVerificationInfo` object.
* If `ADJPVerificationStateNotVerified` is reported, that means that the call to
`verifyPurchase:forTransaction:withResponseBlock` method was done with invalid parameters.
* If the purchase was successfully verified by Apple servers, `ADJPVerificationStatePassed` will be reported together with
the status code `200`.
* If the Apple servers recognized the purchase as invalid, `ADJPVerificationStateFailed` will be reported together with the
status code `406`.
* If the Apple server did not provide us with an answer for our request to verify your purchase,
`ADJPVerificationStateUnknown` will be reported together with the status code `204`. This means that we did not recieve any
information from Apple servers regarding validity of your purchase. This does not say anything about the purchase itself.
It might be both - valid or invalid. This state will also be reported if any other situation prevents us from reporting the
correct state of your purchase verification. More details about these errors can be found in the `message` field of
`ADJPVerificationInfo` object.
* If `ADJPVerificationStateNotVerified` is reported, that means that the call to
`verifyPurchase:forTransaction:productId:withResponseBlock` method was done with invalid parameters.
### 5. Track your verified purchases
### <a id="track-purchases"></a>Track your verified purchases
After a purchase is successfully verified, you can track it with our official
adjust SDK and keep track of revenue in your dashboard. You can also pass in
an optional transaction ID created in an event in order to avoid tracking duplicate revenues.
The last ten transaction IDs are remembered and revenue events with duplicate transaction
IDs are skipped.
After a purchase is successfully verified, you can track it with our official adjust SDK and keep track of revenue in your
dashboard. You can also pass in an optional transaction ID created in an event in order to avoid tracking duplicate
revenues. The last ten transaction IDs are remembered and revenue events with duplicate transaction IDs are skipped.

@@ -256,13 +263,11 @@ Using the examples from above, you can do this as follows:

#### Best practices
## <a id="best-practices"></a>Best practices
Once `ADJPVerificationStatePassed` or `ADJPVerificationStateFailed` are reported, you can
be secure that this decision was made by Apple servers and can rely on them to track
or not to track your purchase revenue. Once `ADJPVerificationStateUnknown` is reported,
you can decide what do you want to do with this purchase.
Once `ADJPVerificationStatePassed` or `ADJPVerificationStateFailed` are reported, you can be secure that this decision was
made by Apple servers and can rely on them to track or not to track your purchase revenue. Once
`ADJPVerificationStateUnknown` is reported, you can decide what do you want to do with this purchase.
For statistical purposes, it may be wise to have a single defined event for each of
these scenarios in the adjust dashboard. This way, you can have better overview of how
many of your purchases was marked as passed, how many of them failed and how many of them
were not able to be verified and returned an unknown status. You can also keep track of
For statistical purposes, it may be wise to have a single defined event for each of these scenarios in the adjust
dashboard. This way, you can have better overview of how many of your purchases was marked as passed, how many of them
failed and how many of them were not able to be verified and returned an unknown status. You can also keep track of
unverified purchases if you would like to.

@@ -294,15 +299,18 @@

Purchase Verification is not intended to be used to approve/reject delivery of goods sold. Purchase Verification is intended to align reported transaction data with actual transaction data.
Purchase Verification is not intended to be used to approve/reject delivery of goods sold. Purchase Verification is
intended to align reported transaction data with actual transaction data.
[dashboard]: http://adjust.com
[adjust.com]: http://adjust.com
[carthage]: https://github.com/Carthage/Carthage
[releases]: https://github.com/adjust/ios_purchase_sdk/releases
[cocoapods]: http://cocoapods.org
[fraud-prevention]: https://docs.adjust.com/en/fraud-prevention/
[carthage]: https://github.com/Carthage/Carthage
[dashboard]: http://adjust.com
[releases]: https://github.com/adjust/ios_purchase_sdk/releases
[add]: https://raw.github.com/adjust/sdks/master/Resources/ios_purchase/add.png
[drag]: https://raw.github.com/adjust/sdks/master/Resources/ios_purchase/drag.png
[add]: https://raw.github.com/adjust/sdks/master/Resources/ios_purchase/add.png
[integration]: https://raw.github.com/adjust/sdks/master/Resources/ios_purchase/integration.png
## License
## <a id="license"></a>License

@@ -309,0 +317,0 @@ The adjust purchase SDK is licensed under the MIT License.

{
"version": "0.1.1",
"version": "1.0.0",
"name": "com.adjust.sdk.purchase",
"cordova_name": "Adjust Purchase SDK Cordova Plugin",
"description": "Cordova plugin for the Adjust Purchase SDK 0.1.1",
"description": "Cordova plugin for the Adjust Purchase SDK 1.0.0",
"license": "MIT License",

@@ -7,0 +7,0 @@ "platforms": [

## Summary
This is the Cordova Purchase SDK of adjust™. You can read more about adjust™ at
[adjust.com].
This is the Cordova purchase SDK of adjust™. You can read more about adjust™ at [adjust.com].
N.B. At the moment, the adjust purchase SDK for Cordova supports Android platform
version `4.0.0 and higher` and iOS platform version `3.0.0 and higher`.
N.B. At the moment, the adjust purchase SDK for Cordova supports Android platform version `4.0.0 and higher` and iOS
platform version `3.0.0 and higher`.
## Basic Installation
## Table of contents
These are the minimal steps required to integrate the adjust purchase SDK into
your Cordova project. We are going to assume you are using the command line interface.
* [Basic integration](#basic-integration)
* [Get the SDK](#sdk-get)
* [Add the SDK to your project](#sdk-add)
* [Integrate the SDK into your app](#sdk-integrate)
* [Adjust Purchase logging](#sdk-logging)
* [Verify your purchases](#verify-purchases)
* [Make the verification request](#verification-request)
* [Process verification response](#verification-response)
* [Track your verified purchases](#track-purchases)
* [Best practices](#best-practices)
* [License](#license)
### 1. Get the SDK
## <a id="basic-integration">Basic integration
Download the latest version from our [releases page][releases]. Extract the
zip file in a folder of your choice.
These are the minimal steps required to integrate the adjust purchase SDK into your Cordova project. We are going to assume
you are using the command line interface.
### 2. Add the SDK to your project
### <a id="sdk-get">Get the SDK
After you have added iOS and/or Android as a platform for your project, enter the
following command in your project folder:
Download the latest version from our [releases page][releases]. Extract the zip file in a folder of your choice.
### <a id="sdk-add">Add the SDK to your project
After you have added iOS and/or Android as a platform for your project, enter the following command in your project folder:
```

@@ -30,5 +41,4 @@ > cordova plugin add path_to_folder/cordova_purchase_sdk

You can alternatively download our Purchase SDK directly as a plugin from the `npm`
[repository][npm-repo]. To do so, simply execute the following command in
your project folder:
You can alternatively download our Purchase SDK directly as a plugin from the `npm` [repository][npm-repo]. To do so, simply
execute the following command in your project folder:

@@ -42,8 +52,7 @@ ```

### 3. Integrate with your app
### <a id="sdk-integrate">Integrate the SDK into your app
#### Basic setup
Add the following code to initialize the adjust purchase SDK in your `index.js` file, after you have received `deviceready`
event:
Add the following code to initialize the adjust Purchase SDK in your `index.js` file, after you have received `deviceready` event:
```javascript

@@ -57,4 +66,3 @@ var adjustPurchaseConfig = new ADJPConfig("{YourAppToken}", ADJPConfig.EnvironmentSandbox);

Depending on whether you build your app for testing or for production, you must
set `environment` with one of these values:
Depending on whether you build your app for testing or for production, you must set `environment` with one of these values:

@@ -66,18 +74,14 @@ ```javascript

**Important:** This value should be set to `ADJPConfig.EnvironmentSandbox`
if and only if you or someone else is testing your app. Make sure to set the
environment to `ADJPConfig.EnvironmentProduction` just before you publish
the app. Set it back to `ADJPConfig.EnvironmentSandbox` when you start
developing and testing it again.
**Important:** This value should be set to `ADJPConfig.EnvironmentSandbox` if and only if you or someone else is testing
your app. Make sure to set the environment to `ADJPConfig.EnvironmentProduction` just before you publish the app. Set it
back to `ADJPConfig.EnvironmentSandbox` when you start developing and testing it again.
We use this environment to distinguish between real traffic and artificial traffic
from test devices. It is very important that you keep this value meaningful at all
times: we are using it to determine whether your purchases should be verified on
We use this environment to distinguish between real traffic and artificial traffic from test devices. It is very important
that you keep this value meaningful at all times: we are using it to determine whether your purchases should be verified on
Apple/Google sandbox or production servers!
#### Adjust purchase Logging
### <a id="sdk-logging">Adjust Purchase logging
You can increase or decrease the amount of logs you see in tests by calling
`setLogLevel` on your `ADJPConfig` instance with one of the following
parameters:
You can increase or decrease the amount of logs you see in tests by calling `setLogLevel` on your `ADJPConfig` instance with
one of the following parameters:

@@ -93,11 +97,9 @@ ```javascript

### 4. Verify your purchases
## <a id="verify-purchases">Verify your purchases
#### Make the verification request
### <a id="verification-request">Make the verification request
In order to verify in-app purchases, you need to call the `verifyPurchaseiOS`
method on the `AdjustPurchase` instance for purchase verification on iOS, or the
`verifyPurchaseAndroid` method for purchase verification on Android. Please
make sure to call this method after the transaction has been finished and your
item purchased.
In order to verify in-app purchases, you need to call the `verifyPurchaseiOS` method on the `AdjustPurchase` instance for
purchase verification on iOS, or the `verifyPurchaseAndroid` method for purchase verification on Android. Please make sure
to call this method after the transaction has been finished and your item purchased.

@@ -108,3 +110,3 @@ ```javascript

// Purchase verification request on iOS.
AdjustPurchase.verifyPurchaseiOS("{Receipt}", "{TransactionId}", function(verificationInfo) {
AdjustPurchase.verifyPurchaseiOS("{Receipt}", "{TransactionId}", "{ProductId}", function(verificationInfo) {
console.log("Verification State = " + verificationInfo.verificationState);

@@ -125,10 +127,28 @@ console.log("Status code = " + verificationInfo.statusCode);

#### Process verification response
Method of the adjust purchase SDK used to make iOS verification request exects you to pass following parameters:
As described in the code above, you need to pass a method which is going to process the
verification response to the `verifyPurchaseiOS` or `verifyPurchaseAndroid` methods.
```
Receipt // App receipt
TransactionId // Finished transaction identifier
ProductId // Your purchased product identifier
Callback // Callback method which will process the verification response
```
The response to purchase verification is represented with an `ADJPVerificationInfo`
object and it contains following information:
Method of the adjust purchase SDK used to make Android verification request exects you to pass following parameters:
```
ItemSKU // Unique order ID (SKU)
ItemToken // A token that uniquely identifies a purchase
DeveloperPayload // A developer-specified string that contains supplemental information about an order
Callback // Callback method which will process the verification response
```
### <a id="verification-response">Process verification response
As described in the code above, you need to pass a method which is going to process the verification response to the
`verifyPurchaseiOS` or `verifyPurchaseAndroid` methods.
The response to purchase verification is represented with an `ADJPVerificationInfo` object and it contains following
information:
```javascript

@@ -149,25 +169,22 @@ verificationInfo.verificationState // State of purchase verification.

* If the purchase was successfully verified by Apple/Google servers,
`ADJPVerificationStatePassed` will be reported together with the status code `200`.
* If the Apple/Google servers recognized the purchase as invalid,
`ADJPVerificationStateFailed` will be reported together with the status code `406`.
* If the Apple/Google servers did not provide us with an answer for our request to verify
your purchase, `ADJPVerificationStateUnknown` will be reported together with the status
code `204`. This means that we did not recieve any information from
Apple/Google servers regarding validity of your purchase. This does not say anything about
the purchase itself. It might be both - valid or invalid. This state will also be reported
if any other situation prevents us from reporting the correct state of your purchase
verification. More details about these errors can be found in the `message` property.
* If `ADJPVerificationStateNotVerified` is reported, that means that the call to
`verifyPurchaseiOS` or `verifyPurchaseAndroid` method was done with invalid parameters
or that in general for some reason verification request was not even sent from the purchase
SDK. Again, more information about error which caused this may be found in `message` property.
* If the purchase was successfully verified by Apple/Google servers, `ADJPVerificationStatePassed` will be reported together
with the status code `200`.
* If the Apple/Google servers recognized the purchase as invalid, `ADJPVerificationStateFailed` will be reported together
with the status code `406`.
* If the Apple/Google servers did not provide us with an answer for our request to verify your purchase,
`ADJPVerificationStateUnknown` will be reported together with the status code `204`. This means that we did not recieve any
information from Apple/Google servers regarding validity of your purchase. This does not say anything about the purchase
itself. It might be both - valid or invalid. This state will also be reported if any other situation prevents us from
reporting the correct state of your purchase verification. More details about these errors can be found in the `message`
property.
* If `ADJPVerificationStateNotVerified` is reported, that means that the call to `verifyPurchaseiOS` or
`verifyPurchaseAndroid` method was done with invalid parameters or that in general for some reason verification request was
not even sent from the purchase SDK. Again, more information about error which caused this may be found in `message`
property.
### 5. Track your verified purchases
### <a id="track-purchases">Track your verified purchases
After a purchase is successfully verified, you can track it with our official
adjust SDK and keep track of revenue in your dashboard. You can also pass in
an optional transaction ID created in an event in order to avoid tracking duplicate revenues.
The last ten transaction IDs are remembered and revenue events with duplicate transaction
IDs are skipped.
After a purchase is successfully verified, you can track it with our official adjust SDK and keep track of revenue in your
dashboard. You can also pass in an optional transaction ID created in an event in order to avoid tracking duplicate
revenues. The last ten transaction IDs are remembered and revenue events with duplicate transaction IDs are skipped.

@@ -194,14 +211,12 @@ **At the moment, the transaction duplication protection mechanism is working only for the iOS platform.**

#### Best practices
## <a id="best-practices">Best practices
Once `ADJPVerificationStatePassed` or `ADJPVerificationStateFailed` are reported, you can
be secure that this decision was made by Apple/Google servers and can rely on them to track
or not to track your purchase revenue. Once `ADJPVerificationStateUnknown` is reported,
you can decide what do you want to do with this purchase.
Once `ADJPVerificationStatePassed` or `ADJPVerificationStateFailed` are reported, you can be secure that this decision was
made by Apple/Google servers and can rely on them to track or not to track your purchase revenue. Once
`ADJPVerificationStateUnknown` is reported, you can decide what do you want to do with this purchase.
For statistical purposes, it may be wise to have a single defined event for each of
these scenarios in the adjust dashboard. This way, you can have better overview of how
many of your purchases was marked as passed, how many of them failed and how many of them
were not able to be verified and returned an unknown status. You can also keep track of
unverified purchases if you would like to.
For statistical purposes, it may be wise to have a single defined event for each of these scenarios in the adjust dashboard.
This way, you can have better overview of how many of your purchases was marked as passed, how many of them failed and how
many of them were not able to be verified and returned an unknown status. You can also keep track of unverified purchases if
you would like to.

@@ -237,9 +252,13 @@ If you decide to do so, your method for handling the response can look like this:

Purchase Verification is not intended to be used to approve/reject delivery of goods sold. Purchase Verification is intended
to align reported transaction data with actual transaction data.
[dashboard]: http://adjust.com
[adjust.com]: http://adjust.com
[npm-repo]: https://www.npmjs.com/package/com.adjust.sdk
[releases]: https://github.com/adjust/cordova_purchase_sdk/releases
[fraud-prevention]: https://docs.adjust.com/en/fraud-prevention/
[dashboard]: http://adjust.com
[releases]: https://github.com/adjust/cordova_purchase_sdk/releases
[npm-repo]: https://www.npmjs.com/package/com.adjust.sdk
## License
## <a id="livense">License

@@ -246,0 +265,0 @@ The adjust purchase SDK is licensed under the MIT License.

@@ -7,3 +7,3 @@ function ADJPConfig(appToken, environment) {

this.logLevel = null;
this.sdkPrefix = "cordova0.1.1";
this.sdkPrefix = "cordova1.0.0";
}

@@ -10,0 +10,0 @@

@@ -36,3 +36,3 @@ function callCordova (action) {

verifyPurchaseiOS: function (receipt, transactionId, verificationCallback) {
verifyPurchaseiOS: function (receipt, transactionId, productId, verificationCallback) {
if (verificationCallback != null) {

@@ -42,3 +42,3 @@ callCordovaCallback('setVerificationCallback', verificationCallback);

callCordova('verifyPurchaseiOS', receipt, transactionId);
callCordova('verifyPurchaseiOS', receipt, transactionId, productId);
}

@@ -45,0 +45,0 @@ };

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc