# Connect Apple Pay to a Messages purchase

Define the merchant, payment processor and order integration needed to complete an Apple Pay purchase in a Messages conversation.

## Prerequisites

You need the merchant’s Apple Pay configuration, supported payment processing integration, order system and authorized test environment. Use test payment facilities for evaluation.

## 1. Connect the merchant configuration

Prepare the merchant identity, certificates, supported networks, payment capabilities and required endpoints for the integration. Keep secrets in the normal credential mechanism and configure only supported callbacks. Apple’s [Apple Pay integration instructions](https://register.apple.com/resources/messages/msp-api-tutorial/applepay) define the merchant-session and payment flow. Use the [provider setup explanation](/explained/apple-messages/what-does-apple-pay-in-messages-need-from-a-provider) to check certificate, session and gateway responsibilities.

## 2. Prepare the customer’s order

Retrieve the actual item, quantity, tax, shipping and payable amount from the commerce system. Use the published currency and amount. Explain what the customer is purchasing before opening the payment interaction.

## 3. Handle customer authorization

Use the supported Apple Pay experience and process the resulting payment information through the merchant gateway. Customer authorization and successful processing are distinct stages.

## 4. Confirm the actual outcome

Read the payment and order result. Send a confirmation that reflects the recorded transaction, order reference and next step. If payment fails or remains uncertain, explain how the customer can continue.

## 5. Test recovery and alternatives

Exercise refusal, cancellation, unavailable device support and a lost processor response. Reconcile the original payment before retrying. Use a supported checkout alternative when needed.

## Verify the order and payment together

Use your payment processor’s approved test environment and an authorized Apple Messages test experience. Prepare an order using the commerce system’s amount and currency, complete the native review and inspect the processor result. Confirm that the recorded order and the customer reply refer to the same purchase.

| Test case                                               | Action                                                                               | Expected result                                                                    |
| ------------------------------------------------------- | ------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------- |
| The customer cancels payment authorization              | Leave the order in its appropriate unpaid state and offer a continuation.            | No purchase confirmation is sent.                                                  |
| The processor result is pending or the response is lost | Look up the existing payment attempt using your processor’s supported recovery path. | The application resolves the original attempt before another charge is considered. |
| A paid order needs a refund                             | Use the payment system’s refund operation and record its result against the order.   | The service reply explains the recorded refund status.                             |

## Troubleshooting

If the payment sheet fails, inspect merchant configuration and optional callback setup. If the customer authorized but no order is confirmed, inspect the gateway and order records before charging again. The message channel does not settle the transaction.

## Next steps

- [Explore the related Apple Messages capability](/products/apple-messages/payments).
- [Find Apple Messages guides and answers](/products/apple-messages/resources).
- [Prepare your first complete conversation](/products/apple-messages/getting-started).

## Related resources

- [What is Apple Messages for Business?](/explained/apple-messages/what-is-apple-messages-for-business) (answer)
- [Apple Messages for Business](/products/apple-messages) (product)
- [Integrate an Apple Messages customer journey](/docs/guides/apple-messages/api) (docs)

[Get an implementation brief](/learn/workspace?topic=apple-messages)
