Skip to content

Commit

Permalink
Move purchase verification info
Browse files Browse the repository at this point in the history
  • Loading branch information
Sporiff committed Jan 12, 2024
1 parent a2c39f4 commit 84cd3d6
Showing 1 changed file with 45 additions and 47 deletions.
92 changes: 45 additions & 47 deletions src/content/docs/en/sdk/ios/features/events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import TrackEvent from "@ios-examples/Adjust/trackEvent.mdx"
import TrackEventSig from "@ios-signatures/Adjust/trackEvent.mdx"
import SetRevenue from "@ios-examples/ADJEvent/setRevenue.mdx"
import SetRevenueSig from "@ios-signatures/ADJEvent/setRevenue.mdx"
import SetTransactionId from "@ios-examples/ADJEvent/setTransactionId.mdx"
import SetTransactionIdSig from "@ios-signatures/ADJEvent/setTransactionId.mdx"
import SetCallbackId from "@ios-examples/ADJEvent/setCallbackId.mdx"
import SetCallbackIdSig from "@ios-signatures/ADJEvent/setCallbackId.mdx"
import AddCallbackParameter from "@ios-examples/ADJEvent/addCallbackParameter.mdx"
Expand Down Expand Up @@ -202,6 +200,51 @@ class ViewControllerSwift: UIViewController {
</Tab>
</Tabs>

### Purchase verification

If you've enabled [purchase verification](https://help.adjust.com/en/article/purchase-verification), you must send additional information with your purchase events to verify them. When Adjust's servers receive this information in an event object, they forward it to Apple to verify the purchase.

`transactionId` (NSString)
: The [`transactionIdentifier` value](https://developer.apple.com/documentation/storekit/skpaymenttransaction/1411288-transactionidentifier) of the successfully completed purchase

`productId` (NSString)
: The product identifier of the item that was successfully purchased

`receipt` (NSData)
: The [signed receipt](https://developer.apple.com/documentation/foundation/bundle/1407276-appstorereceipturl) containing the information about the successfully completed purchase

<Tabs>
<Tab title="Swift" sync="swift">

```swift
let receiptURL = Bundle.main.appStoreReceiptURL;
let receipt = try Data(contentsOf: receiptURL, options: .alwaysMapped)

let event = ADJEvent(eventToken: "abc123")
event?.setRevenue(6.0, currency: "EUR");
event?.setTransactionId("transaction-id");
event?.setProductId("product-id");
event?.setReceipt(receipt);
Adjust.trackEvent(event)
```

</Tab>
<Tab title="Objective-C" sync="objc">

```objc
NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
NSData *receipt = [NSData dataWithContentsOfURL:receiptURL];
ADJEvent *event = [ADJEvent eventWithEventToken::@"your-event-token"];
[event setRevenue:6.0 currency:@"EUR"];
[event setTransactionId:@"transaction-id"];
[event setProductId:@"product-id"];
[event setReceipt:receipt];
[Adjust trackEvent:event];
```
</Tab>
</Tabs>
## Add callback parameters
If you [register a callback URL](https://help.adjust.com/en/article/set-up-callbacks) in the Adjust dashboard, the SDK sends a GET request to your callback URL when it records an event.
Expand Down Expand Up @@ -519,48 +562,3 @@ class ViewControllerSwift: UIViewController {

</Tab>
</Tabs>

## Purchase verification

If you've enabled [purchase verification](https://help.adjust.com/en/article/purchase-verification), you must send additional information with your purchase events to verify them. When Adjust's servers receive this information in an event object, they forward it to Apple to verify the purchase.

`transactionId` (NSString)
: The [`transactionIdentifier` value](https://developer.apple.com/documentation/storekit/skpaymenttransaction/1411288-transactionidentifier) of the successfully completed purchase

`productId` (NSString)
: The product identifier of the item that was successfully purchased

`receipt` (NSData)
: The [signed receipt](https://developer.apple.com/documentation/foundation/bundle/1407276-appstorereceipturl) containing the information about the successfully completed purchase

<Tabs>
<Tab title="Swift" sync="swift">

```swift
let receiptURL = Bundle.main.appStoreReceiptURL;
let receipt = try Data(contentsOf: receiptURL, options: .alwaysMapped)

let event = ADJEvent(eventToken: "abc123")
event?.setRevenue(6.0, currency: "EUR");
event?.setTransactionId("transaction-id");
event?.setProductId("product-id");
event?.setReceipt(receipt);
Adjust.trackEvent(event)
```

</Tab>
<Tab title="Objective-C" sync="objc">

```objc
NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
NSData *receipt = [NSData dataWithContentsOfURL:receiptURL];
ADJEvent *event = [ADJEvent eventWithEventToken::@"your-event-token"];
[event setRevenue:6.0 currency:@"EUR"];
[event setTransactionId:@"transaction-id"];
[event setProductId:@"product-id"];
[event setReceipt:receipt];
[Adjust trackEvent:event];
```
</Tab>
</Tabs>

0 comments on commit 84cd3d6

Please sign in to comment.