Apple Messages for Business allows shoppers to make purchases right in Messages on their Apple devices using Apple Pay. Apple Pay is compatible with these devices.
Note: When returning the details of an order the actual credit or debit card is shown as payment method (e.g. "MAESTRO") instead of Apple Messages for Business.
Prerequisites
For Apple Messages for Business payments the following prerequisites need to be fulfilled:
- You need an Apple Pay compatible device.
- Apple Pay (and relevant credit and debit card payment methods) needs to be enabled on your account.
Implementing Apple Messages for Business
This rest of this page covers how to implement Apple Pay in Apple Messages for Business.
Besides, implementing an additional requests to the Payment Service (Initialize an Apple Messages for Business session), the Sending an Apple Pay Payment Request flow as described by Apple has to be implemented.
Merchant Enrollment
CM.com handles setting up the required ID's and certificates.
Payment Flow
The following diagram shows the payment flow when using Apple Messages for Business.
Creating an Order
The first thing to do when the shopper requests payment is creating an order. (See also Create a new order.)
Request Merchant Session
The next step is to request a merchant session by sending an initialization request to the Payment System.
The returned response contains the opaque Apple Pay merchant session in string format. This string needs to be converted to a JavaScript object before it can be passed to Business Chat in the next step. The response also contains the payment gateway url and the merchant identifier that are needed in the next step.
Send Apple Pay Payment Request
Finally, an Apple Pay Payment Request can be created and send to Apple Messages for Business using the data from the previous step (see Sending an Apple Pay Payment Request). Business Chat will forward the payment request to the device of the shopper.
The following details need to be provided in the request (in the interactiveData.data.payment dictionary) :
Field | Description |
---|---|
endpoints.paymentGatewayUrl | The payment gateway url which was in the response of the previous step. |
merchantSession | The merchant session which was encoded as string in the response of the previous step. |
paymentRequest.applePay.merchantCapabilities | The payment capabilities supported by the merchant. The only supported value is 'supports3DS'. |
paymentRequest.applePay.merchantIdentifier | The merchant identifier which was in the response of the previous step. |
paymentRequest.applePay.supportedNetworks | The payment networks supported by the merchant. The supported values are 'visa', 'masterCard', 'maestro', 'vPay'. (Depending on the payment methods enabled on your account.) |
The supported networks can be determined using: List payment methods of an Order.
Authorizing the payment
When the shopper clicks on the Apple Pay button the payment sheet is shown on the device. Apple initiates the authorization of the payment when the shopper authenticates the payment with Touch ID or Face ID, by calling the authorize request using the payment gateway url.
After the Payment System authorizes the payment the result is sent back to the Apple device, and the payment sheet closes.
Determining the status of the order
The Payment System sends status change notifications to the customer service agent application during the authorization of the payment, which should be used to get the order details from the Payment System. The order details request should be used to determine if the shopper has paid the order.
Optionally an Order Tracking Endpoint can be implemented as described by Apple (see Tracking Orders).