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
Header
Content-Type: application/json;charset=UTF-8
Request
Name | Required | Type | Sample | Description |
---|---|---|---|---|
mchId | y | String | 10000701 | assigned by GrubPay |
loginName | y | String(12) | jack123 | merchant's login name |
channel | y | String | APPLE_PAY | fixed to APPLE_PAY |
mchOrderNo | y | String | 1234567890abc | assigned by merchant |
amount | y | Int | 1500 | amount in cents and USD, must be a positive non-zero integer |
data | y | String | payment data encrypted by Apple Pay | |
signature | y | String | payment signature found in the Apple Pay payment object | |
ephemeralPublicKey | y | String | ephemeralPublicKey is found in the Apple Pay payment object | |
transactionId | y | String | transactionId is found in the Apple Pay payment object | |
publicKeyHash | y | String | publicKeyHash is found in the Apple Pay payment object | |
sign | y | String(32) | C380BEC2BFD727A4B6845133519F3AD6 | Sign algorithm |
Response
name | Required | type | sample | description |
---|---|---|---|---|
retCode | y | String | SUCCESS or FAIL | |
retMsg | y | String | Data decryption failed. | |
retData | y | JSON | if 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:
name | required | type | sample | description |
---|---|---|---|---|
payOrderId | y | String | AP20240925185259123018212304 | assigned by GrubPay, an unique ID for the order |
mchId | y | String | 10000701 | assigned by GrubPay |
mchOrderNo | n | String | 1234567890abc | assigned by merchant |
originalOrderId | n | String | original pay order id for refund | |
amount | y | Int | 100 | in cents |
currency | y | String | USD | Transaction currency |
payType | y | String | pay | pay or refund |
refundable | y | Int | 100 | in cents |
status | y | Int | 0,1,2,9 | 0 = pending order, 1 = unknown, 2 = success, 9 = fail |
recurringId | y | Int | recurring payment id this transaction belongs to ( 0 if non-recurring) | |
paySuccTime | y | String | 2021-04-07 19:44:51 | time when the payment succeeded |
cardType | y | String | ||
invoiceNum | y | String | ||
authNum | y | String | ||
transNum | y | String | ||
channel | y | String | APPLE_PAY | fixed value: APPLE_PAY |