Apple Pay

Info

This guide provides information for integrating Apple Pay acceptance with an iOS or web-based application.

How It Works

Endpoint

https://api.grubpay.io/v4/apple_pay

Method:

POST

Content-Type: application/json;charset=UTF-8

Request
NameRequiredTypeSampleDescription
mchIdyString10000701assigned by GrubPay
loginNameyString(12)jack123merchant's login name
channelyStringAPPLE_PAYfixed to APPLE_PAY
mchOrderNoyString1234567890abcassigned by merchant
amountyInt1500amount in cents and USD, must be a positive non-zero integer
datayStringpayment data encrypted by Apple Pay
signatureyStringpayment signature found in the Apple Pay payment object
ephemeralPublicKeyyStringephemeralPublicKey is found in the Apple Pay payment object
transactionIdyStringtransactionId is found in the Apple Pay payment object
publicKeyHashyStringpublicKeyHash is found in the Apple Pay payment object
signyString(32)C380BEC2BFD727A4B6845133519F3AD6Sign algorithm
Response
nameRequiredtypesampledescription
retCodeyStringSUCCESS or FAIL
retMsgyStringData decryption failed.
retDatayJSONif retCode=SUCCESS, order detailed info returned

Note

The Apple Pay payload must be tokenized within 2 minutes of retrieval. Any attempt to tokenize an expired payload will result in a "decryption failure" error from GrubPay.

retData contains order information:

namerequiredtypesampledescription
payOrderIdyStringAP20240925185259123018212304assigned by GrubPay, an unique ID for the order
mchIdyString10000701assigned by GrubPay
mchOrderNonString1234567890abcassigned by merchant
originalOrderIdnStringoriginal pay order id for refund
amountyInt100in cents
currencyyStringUSDTransaction currency
payTypeyStringpaypay or refund
refundableyInt100in cents
statusyInt0,1,2,90 = pending order, 1 = unknown, 2 = success, 9 = fail
recurringIdyIntrecurring payment id this transaction belongs to ( 0 if non-recurring)
paySuccTimeyString2021-04-07 19:44:51time when the payment succeeded
cardTypeyString
invoiceNumyString
authNumyString
transNumyString
channelyStringAPPLE_PAYfixed value: APPLE_PAY
Last Updated:
Contributors: HowardBian