> ## Documentation Index
> Fetch the complete documentation index at: https://docs.clinkbill.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get payment credential

> Issues the signed SD-JWT VC payment approval credential for this authorization. Only available once the instruction is `ACTIVE`, unexpired, has a bound card and was created with `agent_public_key`; otherwise the request fails closed and no credential is produced. `jti` is the instruction id and `exp` is the instruction's `effective_until_time`.

Returns the signed **payment approval credential** for one of the token customer's authorizations: an
SD-JWT VC (`typ: dc+sd-jwt`) that carries an AP2 open payment mandate and states what the user
approved. Clink signs it with an ES256 key the agent cannot access.

## Before you call

The authorization must be `ACTIVE`, unexpired, have a bound card, and have been created with
[`agent_public_key`](https://docs.clinkbill.com/api-reference/agent-portal/create_instruction). Anything else fails closed with
`409` or `422` and no credential is produced:

| Status | Meaning |
| - | - |
| `409` | Not `ACTIVE`, expired, no bound card, more than one mandate (split the authorization per mandate), or an amount that cannot be expressed in minor units |
| `422` | The authorization has no stored `agent_public_key`, so the credential cannot be bound to the agent |

Creating the authorization is not approval. The user approves it with a passkey on Clink's page; only
then does this endpoint answer.

## The credential

Wire format: `<issuer-signed JWT>~<mandate>~<instrument 1>~...~`.

* `jti` is the instruction id, and `exp` is the instruction's `effective_until_time` — the same value
  returned as `expires_at`.
* `cnf` is the agent's public key; the agent adds a key-binding JWT signed with the matching private
  key when a verifier requires it (Clink does not issue that JWT).
* `constraints` carry `payment.amount_range` (the maximum for **one** payment, in minor units) and
  `payment.allowed_payment_instruments` (one digest per approved card).
* Each card is its own disclosure, so the agent can reveal only the card a merchant accepts.

Every call returns a freshly serialized credential for the same approval; `jti` and the approved terms
stay the same.

## Verifying it

1. Read `GET <issuer>/.well-known/jwt-vc-issuer` and select the key whose `kid` matches the credential
   header.
2. Verify the issuer JWT signature.
3. Hash each presented disclosure and match it against the digest in the layer above it: instruments
   against `allowed`, the mandate against `delegate_payload`.
4. Reject the credential if the two copies of `cnf`, `iat` and `exp` disagree.

## What it does not do

The credential records consent; it does not grant a new capability. Whether a payment may proceed is
still decided by Clink at payment time against the instruction, its mandate and its usages. Revoking an
authorization is done by the user on Clink's page, not through this API.


## OpenAPI

````yaml GET /agent/platform/authorizations/{instructionId}/payment-credential
openapi: 3.1.0
info:
  title: Clink Agent Portal API
  description: >-
    Agent Portal APIs let an Agent platform read and manage one user's Clink
    account with a portal user token: payment methods, orders, refunds, purchase
    instructions, payment credentials, payment results, and settings.
  version: 1.0.0
servers:
  - url: https://uat-api.clinkbill.com
    description: Sandbox
security:
  - PortalToken: []
paths:
  /agent/platform/authorizations/{instructionId}/payment-credential:
    get:
      summary: Get payment credential
      description: >-
        Issues the signed SD-JWT VC payment approval credential for this
        authorization. Only available once the instruction is `ACTIVE`,
        unexpired, has a bound card and was created with `agent_public_key`;
        otherwise the request fails closed and no credential is produced. `jti`
        is the instruction id and `exp` is the instruction's
        `effective_until_time`.
      operationId: getPaymentCredential
      parameters:
        - name: instructionId
          in: path
          required: true
          description: Instruction ID.
          schema:
            type: string
            example: inst_...
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    format: int32
                    example: 200
                  msg:
                    type: string
                    example: Success
                  data:
                    $ref: '#/components/schemas/PaymentApprovalCredential'
              example:
                code: 200
                msg: Success
                data:
                  credential: <sd-jwt>
                  jti: inst_...
                  vct: https://clinkbill.com/vct/agent-mandate/1
                  expires_at: '2026-12-31T00:00:00Z'
        '401':
          description: Missing, expired, or invalid portal token.
        '403':
          description: The portal token lacks the `portal:read` scope.
        '404':
          description: No such authorization for this customer.
        '409':
          description: >-
            The authorization cannot produce a credential yet (not active,
            expired, no bound card, or unusable amount).
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  msg:
                    type: string
        '422':
          description: >-
            The authorization was created without `agent_public_key`, so the
            credential cannot be bound to the agent.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  msg:
                    type: string
components:
  schemas:
    PaymentApprovalCredential:
      type: object
      description: >-
        Signed SD-JWT VC recording what the user approved for this
        authorization.
      properties:
        credential:
          type: string
          description: >-
            Compact SD-JWT: `<issuer-signed JWT>~<mandate>~<instrument>...~`.
            Treat it as a bearer artifact while valid.
          example: >-
            eyJhbGciOiJFUzI1NiIsInR5cCI6ImRjK3NkLWp3dCIsImtpZCI6ImtleS0xIn0.eyJpc3MiOi...~WyJzYWx0Iiw...~
        jti:
          type: string
          description: Clink approval id; equals the instruction id.
          example: inst_...
        vct:
          type: string
          description: Credential type identifier.
          example: https://clinkbill.com/vct/agent-mandate/1
        expires_at:
          type: string
          description: >-
            Credential expiry (ISO-8601 UTC); equals the instruction's
            `effective_until_time`.
          format: date-time
          example: '2026-12-31T00:00:00Z'
  securitySchemes:
    PortalToken:
      type: http
      scheme: bearer
      description: >-
        Portal user token from `POST /agent/cwallet/platform/portal/tokens`.
        Reads require `portal:read`; writes require `portal:write`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.