Apple Receipt Verification — Ruby on Rails Implementation

def get_expire_date(max_expires_date_ms)
sec = (max_expires_date_ms.to_f / 1000).to_s
return Time.strptime(sec, '%s')
end
def get_last_payment_expire_date(subscription)
last_payment = [Query to get the last payment record]
if last_payment && last_payment.expire_date != nil
return last_payment.expire_date.to_time
end
return nil
end
def save_details_of_the_receipt(subscription, should_activate,    product_id, expire_date, receipt)  save_subscription(details)  if should_activate
# When Time.now < expire_date
make_payment(subscription, expire_date, receipt)
end
end

--

--

Developer ❤️ JS

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store