APG PayAPG Paydocs

Payment tokens

Create payment tokens

POST/payment-tokens

Issue a payment token. The payment method is selected by the body's type.

6 actionsPtknCmdCreateFromApplePayPtknCmdCreateFromBankAccountPtknCmdCreateFromCardPtknCmdCreateFromGooglePayPtknCmdCreateFromPayToPtknCmdCreateFromSavedSource

Permissions

Required permission
paymentTokens:create

Requires the `create` action on `paymentTokens` for the supplied runtime context

Request body

This body is a typed union. Pick a variant to see its fields and a matching example.

Discriminated by type
type = "PtknCmdCreateFromApplePay"

An amount in minor current units of a given currency.

applePayPayloadstringrequired

The paymentData object Apple returns to your page, passed through unchanged.

applePayMethodstringrequired

The paymentMethod object Apple returns beside it, passed through unchanged.

curl -X POST https://api.tst.au.apgpay.dev/payment-tokens \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "PtknCmdCreateFromApplePay",
  "amount": {
    "type": "IsoCurrencyAmount",
    "minorCurrencyUnits": 1250,
    "currency": "AUD"
  },
  "applePayPayload": "string",
  "applePayMethod": "string",
  "surcharge": {
    "type": "PtknSurchargeNone"
  }
}'

Responses

The response is a tagged shape: type is always "PtknCreateRspAttributes". Switch on it; subtypes can be added, and a client that already reads it will not break.

Discriminated by type
type = "PtknCreateRspAttributes"

The resource that was created.

Example
{
  "type": "PtknCreateRspAttributes",
  "created": {
    "type": "PtknViewAttributes",
    "paymentTokenId": "ptkn_9f2Kd8QpLzXw",
    "sourceId": "psrc_9f2Kd8QpLzXw",
    "amounts": {
      "type": "PtknAmountsAttributes",
      "currency": "AUD",
      "amount": 1250,
      "surcharge": 1250
    },
    "paymentType": {
      "type": "PtknTypePayInFull"
    },
    "method": {
      "type": "PtknMethodBankTransfer",
      "reference": "your-own-reference"
    }
  }
}

Error responses