- File > Swift Packages > Add Package Dependency
- Add
https://github.com/GoMarketMe/gomarketme-swift.git - Select "Exact Version" > "3.0.1"
Using an older version of Xcode? Do this instead:
- Navigate to the project navigator and select your project or the blue project icon.
- Package Dependencies > Add a New Package > +
- In the search bar that appears, enter
https://github.com/GoMarketMe/gomarketme-swift.git - Press "Add Package"
import GoMarketMeprivate let goMarketMe = GoMarketMe.shared
init() {
goMarketMe.initialize(apiKey: "API_KEY") // Initialize with your API key
}// Step 1: Retrieve the product
// Step 2: Attempt the purchase
// Step 3: Handle the purchase result
switch result {
case .success(let verification):
if case .verified(let transaction) = verification {
await goMarketMe.syncAllTransactions() // <- add this line for faster processing
}
}Make sure to replace API_KEY with your actual GoMarketMe API key. You can find it on the onboarding page and under Profile > API Key.
Check out our sample app for an example.