Skip to content

Add Card From Hosted-Capture Token

POST
/api/members/{memberId}/payment-methods/from-token
curl --request POST \
--url https://example.com/api/members/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/payment-methods/from-token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: example' \
--data '{ "memberId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "merchantId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "providerToken": "example", "type": "Card", "isDefault": true }'

Stores a card captured via PayChoice’s hosted widget. The token is exchanged server-side for the authoritative card details; Topiic never sees the PAN.

POST /api/members/{memberId}/payment-methods/from-token
{ "providerToken": "…", "type": "Card", "isDefault": true }
memberId
required
string format: uuid
Idempotency-Key
required
string
<= 255 characters

Required. A unique value (a UUID is ideal) per logical operation; reuse it when retrying that operation. A retry with the same key and body replays the original response instead of running twice. A 4xx frees the key, so the operation can be corrected and retried on it. A 5xx does not: the attempt may already have moved money, so retries with that key replay a problem+json saying the outcome is unknown, and a genuinely fresh attempt needs a new key. Missing → 400.

object
memberId
string format: uuid
merchantId
string format: uuid
providerToken
string
nullable
type
string
Allowed values: Card BankAccount
isDefault
boolean
nullable

Card stored.

Media type application/json
object
id
string format: uuid
merchantId
string format: uuid
memberId
string format: uuid
type
string
Allowed values: Card BankAccount
brand
string
nullable
last4
string
nullable
expiryMonth
integer format: int32
nullable
expiryYear
integer format: int32
nullable
accountName
string
nullable
bsb
string
nullable
isDefault
boolean
priority
integer format: int32
createdAt
string format: date-time
updatedAt
string format: date-time
Example
{
"type": "Card"
}

The token was missing or invalid.

Media type application/json
object
type
string
nullable
title
string
nullable
status
integer format: int32
nullable
detail
string
nullable
instance
string
nullable
key
additional properties
Example generated
{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example"
}

The Idempotency-Key was reused with a different request body, or a request with this key is still in progress.