Shinara is a mobile-first social referral platform tailored for in-app purchases, empowering brands to grow through influencer-driven advocacy. The Swift SDK enables seamless integration of Shinara's referral and attribution system into your iOS applications.
ShinaraSDK.instance.initialize(apiKey: "<YOUR_API_KEY>") { result in
switch result {
case .success:
print("Shinara SDK initialized successfully")
case .failure(let error):
print("Shinara SDK initialization failed")
}
}
return true
}
}
Referral Code Validation
To validate a referral code, use the validateReferralCode method. This method checks the validity of the given code.
Note: Ensure that the referral code is validated before initiating an In-App Purchase. This is crucial for proper attribution of the purchase to the referral code in the Shinara SDK.
ShinaraSDK.instance.validateReferralCode(code: referralCode) { result in
switch result {
case .success(let programId):
// Valid referral code
// programId can be used to map and apply discounts
print("Valid referral code with program ID: \(programId)")
By default, Shinara generates a new user id and attribute to the purchase. Optionally, you can provide your own userId and other user details to make sure attribution of the purchase has the user id of your choice.
Note: Ensure that the referral code is validated before registering a user. This is crucial for proper attribution of the user to the referral code in the Shinara SDK.
The SDK automatically tracks and attributes in-app purchases. No additional code is required for basic purchase tracking. The SDK listens to StoreKit transactions and handles attribution automatically.
Example App
Want to print your doc? This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (