Module: ApplePay
Constant Summary collapse
- URL =
'https://buy.itunes.apple.com/verifyReceipt'
- SANDBOX_URL =
'https://sandbox.itunes.apple.com/verifyReceipt'
Instance Method Summary collapse
Instance Method Details
#detect_verify(receipt_data) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/rails_trade/apple_pay.rb', line 7 def detect_verify(receipt_data) r = verify(receipt_data) if r['status'] == 21007 verify(receipt_data, true) else r end end |
#verify(receipt_data, sandbox = false) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rails_trade/apple_pay.rb', line 17 def verify(receipt_data, sandbox = false) if sandbox url = SANDBOX_URL else url = URL end body = { 'receipt-data': receipt_data } r = HTTPX.post(url, form: body) JSON.parse(r.body) end |