# Authorize Payment (Apple Pay)

**Method:** `POST`

**Path:** `/api/pay/v1/orders/{order_id}/payments/{payments_id}/authorize`

**Category:** Apple Pay

**Authentication:** Required

## Description

Use this API to authorize payments initiated through Apple Pay.

**Note:** You can use this API only if you are decrypting the Apple Pay payment token
on your end using the Apple Pay JS SDK.


## Path Parameters

- `order_id` (`string`) **required** — Unique identifier of the order in the Pine Labs Online database.
- `payments_id` (`string`) **required** — Unique identifier of the payment in the Pine Labs Online database.
Maximum length: 50 characters.


## Request Body

Content-Type: `application/json`

- `decrypted_card_details` (`object`) — An object that contains the decrypted card details.
  - `token` (`string`) **required** — Unique identifier of the card as per the token transaction type. Supported characters: A-Z, a-z, 0-9, . / \\ - _ , ( ) ' 
  - `expiration_month` (`string`) **required** — Card token expiry month. Must be 2 digits.
  - `expiration_year` (`string`) **required** — Card token expiry year. Must be 4 digits.
  - `cryptogram` (`string`) **required** — Unique encrypted text from the Apple Pay token.
  - `cavv` (`string`) — Unique encrypted text. **Mandatory for Mastercard.** 
  - `eci` (`string`) — Indicates the authentication outcome for the transaction.
  - `card_meta_data` (`object`) — An object that contains additional card meta details.
    - `card_type` (`CREDIT | DEBIT | PREPAID`) **required** — Type of the card.
    - `network_name` (`VISA | MASTERCARD | RUPAY | AMEX`) **required** — Type of card network.



### Example Request

```json
{
  "decrypted_card_details": {
    "token": "4111111111111111",
    "expiration_month": "12",
    "expiration_year": "2031",
    "cryptogram": "AceY+igABPs3jdwNaDg3MAACAAA=",
    "cavv": "AceY+igABPs3jdwNaDg3MAACAAA=",
    "eci": "05",
    "card_meta_data": {
      "card_type": "DEBIT",
      "network_name": "VISA"
    }
  }
}
```

## Responses

- `200` — Payment authorized successfully.
- `400` — 
- `401` — 
- `404` — 
- `422` — Unprocessable Entity — invalid card details or authorization failed.
- `500` — 

### Response Schema

- `data` (`object`)
  - `order_id` (`string`)
  - `merchant_order_reference` (`string`)
  - `type` (`CHARGE | REFUND`)
  - `status` (`CREATED | PENDING | PROCESSED | AUTHORIZED | CANCELLED | ATTEMPTED | FAILED | FULLY_REFUNDED | PARTIALLY_REFUNDED`)
  - `callback_url` (`string`)
  - `failure_callback_url` (`string`)
  - `merchant_id` (`string`)
  - `order_amount` (`object`)
    - `value` (`integer`)
    - `currency` (`string`)

  - `pre_auth` (`boolean`)
  - `part_payment` (`boolean`) — Whether the transaction is a part payment.
  - `allowed_payment_methods` (`string[]`)
  - `purchase_details` (`object`)
    - `customer` (`object`)
      - `email_id` (`string`)
      - `first_name` (`string`)
      - `last_name` (`string`)
      - `mobile_number` (`string`)
      - `country_code` (`string`)
      - `billing_address` (`object`) — Physical address.
        - `address1` (`string`) — Address line 1.
        - `address2` (`string`) — Address line 2.
        - `address3` (`string`) — Address line 3.
        - `pincode` (`string`) — Postal/ZIP code.
        - `city` (`string`) — City name.
        - `state` (`string`) — State or province.
        - `country` (`string`) — Country name.
        - `full_name` (`string`) — Full name of the address holder.
        - `adddress_type` (`string`) — Type of address (e.g., Home, Office).
        - `address_category` (`billing | shipping`) — Category of the address.

      - `shipping_address` (`object`) — Physical address.
        - `address1` (`string`) — Address line 1.
        - `address2` (`string`) — Address line 2.
        - `address3` (`string`) — Address line 3.
        - `pincode` (`string`) — Postal/ZIP code.
        - `city` (`string`) — City name.
        - `state` (`string`) — State or province.
        - `country` (`string`) — Country name.
        - `full_name` (`string`) — Full name of the address holder.
        - `adddress_type` (`string`) — Type of address (e.g., Home, Office).
        - `address_category` (`billing | shipping`) — Category of the address.

      - `is_edit_customer_details_allowed` (`boolean`)

    - `merchant_metadata` (`object`) — Arbitrary key-value pairs for merchant use. Maximum 10 pairs, 256 characters each.

  - `payments` (`object[]`)
    - `id` (`string`)
    - `merchant_payment_reference` (`string`)
    - `status` (`PENDING | AUTHORIZED | CANCELLED | PROCESSED | FAILED`)
    - `payment_amount` (`object`)
      - `value` (`integer`)
      - `currency` (`string`)

    - `payment_method` (`CARD | UPI | POINTS | NETBANKING | WALLET`)
    - `payment_option` (`object`)
      - `wallet_details` (`object`)
        - `wallet_code` (`string`)
        - `wallet_card_data` (`object`)
          - `card_type` (`DEBIT | CREDIT`)
          - `network_name` (`string`)
          - `issuer_name` (`string`)
          - `card_category` (`string`)
          - `country_code` (`string`)
          - `token_txn_type` (`ALT_TOKEN | NETWORK_TOKEN | ISSUER_TOKEN`)
          - `save` (`boolean`)
          - `card_holder_name` (`string`)
          - `bin_min` (`string`)
          - `bin_max` (`string`)



    - `acquirer_data` (`object`)
      - `approval_code` (`string`)
      - `acquirer_reference` (`string`)
      - `rrn` (`string`)
      - `is_aggregator` (`boolean`)
      - `acquirer_name` (`string`)

    - `created_at` (`string`)
    - `updated_at` (`string`)

  - `created_at` (`string`)
  - `updated_at` (`string`)
  - `integration_mode` (`SEAMLESS | REDIRECT`)


### Example Response

```json
{
  "data": {
    "order_id": "v1-251012055723-aa-Vhv53a",
    "merchant_order_reference": "3fb59787-c38b-4986-87da-39be0a585fae",
    "type": "CHARGE",
    "status": "PROCESSED",
    "callback_url": "https://simple-callback.onrender.com/payment/callback",
    "failure_callback_url": "",
    "merchant_id": "106974",
    "order_amount": {
      "value": 10000,
      "currency": "INR"
    },
    "pre_auth": false,
    "part_payment": false,
    "allowed_payment_methods": [
      "CARD",
      "WALLET"
    ],
    "purchase_details": {
      "customer": {
        "billing_address": {
          "address1": "10 Downing Street Westminster London",
          "address2": "Oxford Street Westminster London",
          "address3": "Baker Street Westminster London",
          "pincode": "51524036",
          "city": "Westminster",
          "state": "Westminster",
          "country": "London",
          "full_name": "Kevin Bob",
          "adddress_type": "Home",
          "address_category": "billing"
        },
        "shipping_address": {
          "address1": "10 Downing Street Westminster London",
          "address2": "Oxford Street Westminster London",
          "address3": "Baker Street Westminster London",
          "pincode": "51524036",
          "city": "Westminster",
          "state": "Westminster",
          "country": "London",
          "full_name": "Kevin Bob",
          "adddress_type": "Home",
          "address_category": "billing"
        }
      },
      "merchant_metadata": {
        "clientId": "DD",
        "transactionReferenceNo": "pine-1223",
        "merchantId": "1234",
        "tid": "9000990",
        "acquirerName": "HDFC_FSS",
        "isOfferDisplayRequired": "true",
        "OfferData": "UHJvZHVjdF9Db2RlPSIgIiZQcm9kdWN0X05hbWU9IiImUGF5bWVudF9Nb2RlPUJhbmsgRU1JJkNhcmRfVHlwZT1EZWJpdCBDYXJkJkJhbmtfTmFtZT1IREZDIERlYml0JkVNSV9UZW51cmU9NiZJbnRlcmVzdF9SYXRlPTkuMCZJbnRlcmVzdF9BbW91bnQ9MTM4MTQwJk1vbnRobHlfSW5zdGFsbG1lbnQ9ODk0NjkwJkF1dGhvcml6YXRpb25fQW1vdW50PTEwMCZMb2FuX2Jvb2tpbmdfQW1vdW50PTUyMzAwMDAmSW50ZXJlc3RfQ2FzaGJhY2tfQW1vdW50PTAmSW50ZXJlc3RfQ2FzaGJhY2tfVHlwZT1EZWZlcnJlZCZBZGRpdGlvbmFsX0Nhc2hiYWNrPSIiJkFkZGl0aW9uYWxfQ2FzaGJhY2tfVHlwZT0iIiZEZXNjcmlwdGlvbj1CYW5rIEVNSSZQcm9kdWN0X1ZhbHVlPTUyMzAwMDA",
        "tenant_id": "PGATPOS",
        "is_offer_validation_required": "true"
      }
    },
    "payments": [
      {
        "status": "PENDING",
        "payment_method": "CARD",
        "payment_option": {
          "wallet_details": {
            "wallet_code": "APPLE_PAY",
            "wallet_card_data": {
              "card_type": "DEBIT",
              "token_txn_type": "ALT_TOKEN"
            }
          }
        }
      }
    ],
    "created_at": "2025-06-04T11:00:51.067Z",
    "updated_at": "2025-06-04T11:01:26.656Z",
    "integration_mode": "SEAMLESS"
  }
}
```

---

Reference: https://localhost:3000/api/apple-pay/authorize-apple-pay-payment
