Migrate to Purchasely
Guide to migrate your existing subscriptions to Purchasely.
A quick overview of the migration process to help you understand why we are doing things when we'll go deeper in the explanations:
- 1.Configure your app/products/plans in the Purchasely console: without this data, we won't be able to do anything
- 2.Send us every new subscription created on you side with a call on our API: this step ensure we'll know everything about the subscriptions created from this point in time (needed for the users still using old versions of your app)
- 3.Extract your existing subscriptions into a CSV: this step ensure we'll known everything about the subscriptions created in the past
- 4.Release your new app: at this point, our backend will know every past/present/future subscriptions and you'll be able to release your app, everything will work smoothly.
If you have a lot of products / plans that you want to migrate, you can fill the following CSV file and send it to [email protected] We will import it for you.
The following values for the field
Type
are accepted- RENEWING_SUBSCRIPTION
- NON_RENEWING_SUBSCRIPTION
- CONSUMABLE
- NON_CONSUMABLE
The following values for the field Periodicity are accepted (only for renewing and non renewing subscription)
- P1W
- P2W
- P1M
- P2M
- P3M
- P6M
- P1Y
plans-migration.csv
1KB
Text
post
https://s2s.purchasely.io
/receipts
Post receipt
The not-mandatory-fields are highly recommended: we use them to calculate the LTV (life-time value) of your users and track your revenues.
Apple App Store
Google Play Store
{
// Mandatory
"receipt_data": "abcdFEbsbs",
"user_id": "1234",
// Country - highly recommanded
"country": "FR",
// Pricings
"store_product_id": "com.foo.bar",
"amount_cents": 1235,
"currency": "EUR",
"intro_amount_cents": 0,
"intro_cycles": 2,
"intro_duration": 4,
"intro_period": "week"
}
{
// Mandatory
"purchase_token": "abcdFEbsbs",
"store_product_id": "com.foo.bar",
"user_id": "1234",
// Pricing
"quantity": 1
}
cURL
ruby
curl \
--request POST \
-i \
-H "Content-Type: application/json" \
-H "X-API-KEY:00000000-1111-2222-3333-444444444444" \
-H "X-PLATFORM-TYPE:PLAY_STORE" \
--data '{"purchase_token":"aaaNNNcccDDDeeeFFF","user_id":"1234567890","store_product_id":"com.my.product","quantity":1}' \
https://s2s.purchasely.io/receipts
require 'net/http'
require 'json'
# Url
url = URI('https://s2s.purchasely.io/receipts')
request = Net::HTTP::Post.new(url)
# Headers
request['Content-Type'] = 'application/json'
request['X-API-KEY'] = '00000000-1111-2222-3333-444444444444'
request['X-PLATFORM-TYPE'] = 'PLAY_STORE'
# Payload
payload = {
purchase_token: "abcdeFGHIJklmnoPQRSTuvwxyZ",
user_id: "1234567890",
store_product_id: "product.monthly",
quantity: 1
}
request.body = payload.to_json
# Send request
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
response = http.request(request)
# Response
case response.code
when '200'
transaction_id = JSON.parse(response.body)['id']
when '403', '422'
errors = JSON.parse(response.body)['errors']
end
It's time to extract all you existing subscriptions (active and expired)!
As before, we'll need different fields, depending of the platform (same rules apply for mandatory/recommended fields).
When extracted, send us these files and we'll take care of importing them.
Mandatory fields: user_id, receipt_data
example-apple.csv
user_id;receipt_data
1234;abcdFEbsbs
Or if you have the information you can also provide more information
example-apple.csv
user_id;receipt_data;store_product_id;amount_cents;currency;intro_amount_cents;intro_cycles;intro_duration;intro_period;country
1234;abcdFEbsbs;com.foo.bar;1235;EUR;0;2;4;week;FR
purchasely-appstore-migration.csv
214B
Text
Mandatory fields: user_id, purchase_token, store_product_Id
example-google.csv
user_id;purchase_token;store_product_id;quantity
1234;abcdFEbsbs;com.foo.bar;1
purchasely-playstore-migration.csv
204B
Text
When everything is ok on our side, we'll send you a confirmation that you can release your apps.
Dernière mise à jour 2mo ago