Apple Pay Hosted Checkout Objects Reference (Request)
For complete sample code please refer here
Available dictionary objects
iStatus
Use: iStatus.success
APButtonColor
Use: APButtonColor.black
APButtonType
Use: APButtonType.buy
APRequiredFeatures
Use: APRequiredFeatures.address_validation
APErrorCode
Use: APErrorCode.addressUnserviceable
APErrorContactField
Use: APErrorContactField.administrativeArea
Request objects
ApplePayRequest
The Main object that contains all the information necessary to communicate with Apple Pay API.
Name | Type | Required | Description |
merchantIdentifier | String | Yes | For merchants integrating their own Apple Developer account must be Merchant Identifier from the account, otherwise must be merchant.cardknox.com |
buttonOptions | No | Provides Apple Pay button customization options. For more information please click the link. | |
requiredFeatures | No | Features required by Merchant. Each Feature is available with the certain iOS version. Therefore if device doesn’t support that version (Feature) - Apple Pay Button won’t be displayed. | |
requiredBillingContactFields | No | List of field names used for requesting contact information in a payment request. | |
requiredShippingContactFields | No | List of field names used for requesting contact information in a payment request. | |
onAPButtonLoaded | String | Yes | Name of a callback function to be called when Apple Pay button is loaded. Accepts an object of type APButtonLoadedResult Please click here for the sample code. |
onGetTransactionInfo | String | Yes | Name of a callback function to be called that returns the final price and tax calculations. Please click here for the sample code. |
onGetShippingMethods | String | Yes | Name of a callback function to be called that returns a list of available Shipping Methods. Please click here for the sample code. |
onShippingContactSelected | String | Yes | Name of a callback function to be called when Shipping Contact is selected/changed.
Accepts a parameter PaymentContact.
Returns ShippingContactResponse.
If |
onShippingMethodSelected | String | Yes | Name of a callback function to be called when Shipping Method is selected/changed. Accepts a parameter ShippingMethod. Please click here for the sample code. |
onPaymentMethodSelected | String | Yes | Name of a callback function to be called when Payment Method is selected/changed. Accepts a parameter PaymentMethod. Please click here for the sample code. |
onBeforeProcessPayment | String | Yes | Name of a callback function to be called when consumer clicked the button but before Apple Pay sheet is loaded. Usually used to make validations before the payment. Please click here for the sample code. |
onValidateMerchant | String | Yes | Name of a callback function to be called to validate the Merchant. This functions accepts a parameter validationUrl. Please click here for the sample code. |
onPaymentAuthorize | String | Yes | Name of a callback function to be called when Apple Payment is authorized for the completion of the transaction. This function accepts a parameter of PaymentResponse. Please click here for the sample code. |
onPaymentComplete | String | Yes | Name of a callback function to be called when Apple confirms the completion of the transaction. This function accepts a parameter of PaymentComplete. Please click here for the sample code. |
onError | String | Yes | |
onCancel | String | Yes | Name of a callback function to be called when user cancels. Please click here for the sample code. |
Request Examples
Payment Request example
onAPButtonLoaded callback example
onGetTransactionInfo callback example
onGetShippingMethods callback example
onShippingContactSelected callback example
onShippingMethodSelected callback example
onPaymentMethodSelected callback example
onBeforeProcessPayment callback example
onValidateMerchant callback example
onPaymentAuthorize callback example
onPaymentComplete callback example
onError callback example
onCancel callback example
ButtonOptions Object
Name | Type | Required | Description |
buttonContainer | String | Yes | Name of the <div> where Apple Pay Button will be loaded |
buttonColor | No | From Google documentation:
| |
buttonType | No | From Google documentation:
|
Button Options example
APButtonLoadedResult Object
Name | Type | Description |
status | iStatus | There are 3 possible cases:
|
reason | String | If Apple Pay Button failed to load this field will be populated with the reason. |
ApplePayContactField
Field names used for requesting contact information in a payment request.
Available fields:
name
email
phone
postalAddress
ApplePay Contact Field example
PaymentContact Object
Name | Type | Description |
phoneNumber | String | A phone number for the contact |
emailAddress | String | An email address for the contact |
givenName | String | The contact’s given name |
familyName | String | The contact’s family name |
addressLines | String[] | The street portion of the address for the contact |
subLocality | String | Additional information associated with the location, typically defined at the city or town level (such as district or neighborhood), in a postal address |
locality | String | The city for the contact |
postalCode | String | The zip code or postal code, where applicable, for the contact |
subAdministrativeArea | String | The subadministrative area (such as a county or other region) in a postal address |
administrativeArea | String | The state for the contact |
country | String | The name of the country or region for the contact |
countryCode | String | The contact’s two-letter ISO 3166 country code |
ShippingContactResponse Object
Name | Type | Description |
| LineItem[] | A set of line items that explain recurring payments and additional charges and discounts. |
| A line item that represents the total for the payment. | |
| A list of Shipping Methods | |
| Error code |
LineItem Object
We’re now supporting Recurring and Deferred Payments as well as Subscriptions. These features are supported starting iOS 15.4.
These features are available if support_recurring
and/or support_subscription
is part of requiredFeatures list.
Name | Type | Description |
---|---|---|
type | ApplePayLineItemType | A value that indicates whether the line item is final or pending |
label | String | A required value that’s a short, description of the line item |
amount | String | A required value that’s the monetary amount of the line item. |
Recurring and Subscription | ||
| ApplePayPaymentTiming object | The time that the payment occurs as part of a successful transaction |
| Date | The date of the first payment |
| Date | The date of the final payment |
| ApplePayRecurringPaymentDateUnit | The amount of time — in calendar units, such as day, month, or year — that represents a fraction of the total payment interval |
| Long | The number of interval units that make up the total payment interval |
| Date | The date, in the future, of the payment |
| String | The balance an account reaches before the merchant applies the automatic reload amount |
ApplePayLineItemType
final
- A line item representing the known, final cost.pending
- A line item representing an estimated or unknown cost.
ApplePayRecurringPaymentDateUnit
year
month
day
hour
minute
Recurring Line Item Example (Charging $20 starting today for the next year)
ShippingMethod Object
Name | Type | Description |
label | String | Label for this Shipping Method |
amount | String | Price for this shipping option |
detail | String | Description for this Shipping Method |
identifier | String | Identifier for this Shipping Method |
ShippingMethod example
PaymentMethod Object
Name | Type | Description |
displayName | String | A string, suitable for display, that describes the card |
network | String | Name of the payment network backing the card |
type | PaymentMethodType | The card's type of payment |
billingContact | PaymentContact | The billing contact associated with the card |
PaymentMethodType
A payment card’s type of payment.
The payment method type value is one of:
debit
credit
prepaid
store
Error Object
Note: Supported starting iOS 11.
Available when address_validation
is part of requiredFeatures list.
Name | Type | Description |
| One of Apple Pay Error Codes | |
| One of Apple Pay Error Contact fields | |
| String | Error message displayed to the customer |
Last updated