Queries and mutations for managing Payments in the platform.
Queries
Query Payments
| Arguments | |
|---|---|
whereString | |
sortArray of String | |
limitInt | |
offsetInt | |
Get Payment
| Arguments | |
|---|---|
idString | Queries with specified ID |
keyString | Queries with specified key |
Mutations
Create Payment
Update Payment
| Arguments | |
|---|---|
versionLong | |
actionsArray of PaymentUpdateAction | |
idString | Queries with specified ID |
keyString | Queries with specified key |
Delete Payment
Output types
Payment
keyString | User-defined unique identifier of the Payment. |
customerRef | Reference to a Customer associated with the Payment. |
customer | Reference to a Customer associated with the Payment. |
anonymousIdString | Anonymous session associated with the Payment. |
interfaceIdString | Identifier used by the payment service that processes the Payment (for example, a PSP).
The combination of interfaceId and the paymentInterface field on PaymentMethodInfo must be unique. |
amountPlanned | |
paymentMethodInfo | Information regarding the payment interface (for example, a PSP), and the specific payment method used. |
paymentStatus | Current status of the Payment. |
transactionsArray of Transaction | Financial transactions of the Payment. Each Transaction has a TransactionType and a TransactionState. |
interfaceInteractionsRaw | Represents information exchange with the payment service, for example, a PSP. An interaction may be a request sent, or a response or notification received from the payment service. |
custom | Custom Fields of the Payment. |
idString | Unique identifier of the Payment. |
versionLong | Current version of the Payment. |
createdAt | Date and time (UTC) the Payment was initially created. |
lastModifiedAt | Date and time (UTC) the Payment was last updated. |
createdBy | IDs and references that created the Payment. |
lastModifiedBy | IDs and references that last modified the Payment. |
PaymentMethodInfo
Represents a snapshot of the PaymentMethod data used for a Payment.
paymentInterfaceString | Payment service that processes the Payment—for example, a PSP.
The combination of paymentInterface and the interfaceId of a Payment is unique. |
methodString | Payment method used—for example, a credit card or direct debit. |
nameString | Name of the Payment Method. |
nameAllLocalesArray of LocalizedString | Name of the Payment Method. |
token | BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta |
interfaceAccountString | BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta |
custom | BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta |
PaymentMethodToken
valueString | Tokenized representation of the Payment Method. It is displayed in the following instances:
It is masked in the following instances:
|
PaymentStatus
Transaction
Represents a financial transaction typically created as a result of a notification from the payment service.
idString | Unique identifier of the Transaction. |
timestamp | Date and time (UTC) the Transaction took place. |
type | Type of the Transaction. For example, Can be Authorization.Authorization, CancelAuthorization, Charge, Chargeback, or Refund |
amount | Money value of the Transaction. |
interactionIdString | Identifier used by the interface that manages the Transaction (usually the PSP).
If a matching interaction was logged in the interfaceInteractions array, the corresponding interaction can be found with this ID. |
state | State of the Transaction. Can beFailure, Initial, Pending, or Success |
custom | Custom Fields defined for the Transaction. |
interfaceIdString | Identifier used by the payment service that processes the Payment (for example, a PSP) in the current transaction. |
TransactionType
AuthorizationCancelAuthorizationChargeChargebackRefund
TransactionState
FailureInitialPendingSuccess
InterfaceInteractionsRawResult
limitInt | |
offsetInt | |
totalInt | |
resultsArray of InterfaceInteractionsRaw |
InterfaceInteractionsRaw
typeRef | |
type | |
fieldsArray of RawCustomField |
Payment Query Result
Input types
PaymentDraft
amountPlanned | |
paymentMethodInfo | Information regarding the payment interface (for example, a PSP), and the specific payment method used. |
custom | Custom Fields for the Payment. |
keyString | User-defined unique identifier for the Payment. |
customer | Reference to a Customer associated with the Payment. |
anonymousIdString | Anonymous session associated with the Payment. |
interfaceIdString | Identifier used by the payment service that processes the Payment (for example, a PSP).
The combination of interfaceId and the paymentInterface field on PaymentMethodInfo must be unique.
Once set, it cannot be changed. |
paymentStatus | Current status of the Payment. |
transactionsArray of TransactionDraft | Financial transactions of the Payment. Each Transaction has a TransactionType and a TransactionState. |
interfaceInteractionsArray of CustomFieldsDraft | Represents information exchange with the payment service, for example, a PSP. An interaction may be a request sent, or a response or notification received from the payment service. |
PaymentMethodInfoInput
paymentInterfaceString | |
methodString | |
nameArray of LocalizedStringItemInputType | |
token | BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta |
interfaceAccountString | BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta |
custom | BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta |
PaymentMethodTokenDraft
valueString |
PaymentStatusInput
interfaceCodeString | |
interfaceTextString | |
state |
TransactionDraft
timestamp | Date and time (UTC) the Transaction took place. |
type | Type of the Transaction. Can beAuthorization, CancelAuthorization, Charge, Chargeback, or Refund |
amount | Money value for the Transaction. |
interactionIdString | Identifier used by the payment service that manages the Transaction. Can be used to correlate the Transaction to an interface interaction. |
state | State of the Transaction. Can beFailure, Initial, Pending, or Success |
custom | Custom Fields for the Transaction. |
interfaceIdString | Identifier used by the payment service that processes the Payment (for example, a PSP) in the current transaction. |
TransactionType
AuthorizationCancelAuthorizationChargeChargebackRefund
TransactionState
FailureInitialPendingSuccess
PaymentUpdateAction
addInterfaceInteraction | |
addTransaction | |
changeAmountPlanned | |
changeTransactionInteractionId | |
changeTransactionState | |
changeTransactionTimestamp | |
setAmountPaid | |
setAmountRefunded | |
setAnonymousId | |
setAuthorization | |
setCustomField | |
setCustomType | |
setCustomer | |
setExternalId | |
setInterfaceId | |
setKey | |
setMethodInfo | BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta |
setMethodInfoCustomField | BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta |
setMethodInfoCustomType | BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta |
setMethodInfoInterface | |
setMethodInfoInterfaceAccount | BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta |
setMethodInfoMethod | |
setMethodInfoName | |
setMethodInfoToken | BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta |
setStatusInterfaceCode | |
setStatusInterfaceText | |
setTransactionCustomField | |
setTransactionCustomType | |
setTransactionInterfaceId | |
transitionState |
Update actions
Add InterfaceInteraction
fieldsArray of CustomFieldInput | |
type | |
typeKeyString | |
typeIdString |
Add Transaction
transaction | Value to append to the transactions array. |
TransactionDraft
timestamp | Date and time (UTC) the Transaction took place. |
type | Type of the Transaction. Can beAuthorization, CancelAuthorization, Charge, Chargeback, or Refund |
amount | Money value for the Transaction. |
interactionIdString | Identifier used by the payment service that manages the Transaction. Can be used to correlate the Transaction to an interface interaction. |
state | State of the Transaction. Can beFailure, Initial, Pending, or Success |
custom | Custom Fields for the Transaction. |
interfaceIdString | Identifier used by the payment service that processes the Payment (for example, a PSP) in the current transaction. |
TransactionType
AuthorizationCancelAuthorizationChargeChargebackRefund
TransactionState
FailureInitialPendingSuccess
Change AmountPlanned
amount | New value to set. |
Change TransactionInteractionId
transactionIdString | Unique identifier of the Transaction. |
interactionIdString | New value to set. |
Change TransactionState
transactionIdString | Unique identifier of the Transaction. |
state | New TransactionState. Can beFailure, Initial, Pending, or Success |
TransactionState
FailureInitialPendingSuccess
Change TransactionTimestamp
transactionIdString | Unique identifier of the Transaction. |
timestamp | Timestamp of the Transaction as reported by the payment service. |
Set AmountPaid
amount |
Set AmountRefunded
amount |
Set AnonymousId
anonymousIdString | Value to set. If omitted, any existing value is removed. |
Set CustomField
nameString | Name of the Custom Field. |
valueString | If value is absent or null, this field will be removed if it exists.
Removing a field that does not exist returns an InvalidOperation error.
If value is provided, it is set for the field defined by name. |
Set Custom Type
fieldsArray of CustomFieldInput | |
type | |
typeKeyString | |
typeIdString |
Set Customer
customer | Value to set. If omitted, any existing reference is removed. |
Set ExternalId
externalIdString |
Set InterfaceId
interfaceIdString | Value to set.
The combination of
interfaceId and paymentInterface of a PaymentMethodInfo must be unique.The value cannot be modified after it is set. |
Set Key
keyString | Value to set.
If key is absent or null, the existing key, if any, will be removed. |
Set MethodInfo BETA
paymentInterfaceString | Payment service that processes the Payment—for example, a PSP.
The combination of
paymentInterface and the interfaceId of a Payment must be unique.
The value cannot be modified after it is set.Setting this field is equivalent to the setMethodInfoInterface action and will generate the PaymentMethodInfoInterfaceSet Message. |
methodString | Payment method to use—for example, a credit card or direct debit. If omitted, any existing value is removed. Setting this field is equivalent to the setMethodInfoMethod action and will generate the PaymentMethodInfoMethodSet Message. |
nameArray of LocalizedStringItemInputType | Name of the Payment Method. If omitted, any existing value is removed. Setting this field is equivalent to the setMethodInfoName action and will generate the PaymentMethodInfoNameSet Message. |
token | Tokenized payment method information of the Payment Method. If omitted, any existing value is removed. Setting this field is equivalent to the setMethodInfoToken action and will generate the PaymentMethodInfoTokenSet Message. |
interfaceAccountString | Account or instance of the payment interface when multiple accounts are used (per interface). If omitted, any existing value is removed. Setting this field is equivalent to the setMethodInfoInterfaceAccount action and will generate the PaymentMethodInfoInterfaceAccountSet Message. |
custom | Custom Fields for the PaymentMethodInfo. If omitted, any existing Custom Fields are removed, including the Custom Type. Setting this field is equivalent to the
setMethodInfoCustomType and setMethodInfoCustomField actions, and will generate the following Messages:
|
PaymentMethodTokenDraft
valueString |
Set MethodInfo CustomField BETA
nameString | Name of the Custom Field. |
valueString | If value is absent or null, this field will be removed if it exists.
If value is provided, it is set for the field defined by name.
Trying to remove a field that does not exist will fail with an InvalidOperation error. |
Set MethodInfo Custom Type BETA
fieldsArray of CustomFieldInput | |
type | |
typeKeyString | |
typeIdString |
Set MethodInfo Interface
interfaceString | Value to set.
Once set, the paymentInterface of the paymentMethodInfo cannot be changed. |
Set MethodInfo InterfaceAccount BETA
interfaceAccountString | New account or instance of the payment interface. If omitted, any existing value is removed. |
Set MethodInfo Method
methodString | Value to set. If omitted, any existing value is removed. |
Set MethodInfo Name
nameArray of LocalizedStringItemInputType | Value to set. If omitted, any existing value is removed. |
Set MethodInfo Token BETA
token | Value to set. If omitted, any existing value is removed. |
PaymentMethodTokenDraft
valueString |
Set StatusInterfaceCode
interfaceCodeString | Value to set. If omitted, any existing value is removed. |
Set StatusInterfaceText
interfaceTextString | Value to set. Set to an empty string to remove any existing value. |
Set Transaction CustomField
nameString | Name of the Custom Field. |
valueString | If value is absent or null, this field will be removed if it exists.
Removing a field that does not exist returns an InvalidOperation error.
If value is provided, it is set for the field defined by name. |
transactionIdString | Unique identifier of the Transaction. |
Set Transaction Custom Type
fieldsArray of CustomFieldInput | |
type | |
typeKeyString | |
typeIdString | |
transactionIdString |
Set TransactionInterfaceId
transactionIdString | Unique identifier of the Transaction. |
interfaceIdString | Identifier used by the payment service that processes the Payment (for example, a PSP) in the current transaction. It must be unique across all transactions.
If interfaceId is absent, this field will be removed from the specified Transaction, if it exists. |
Transition State
initial must be true for the new State.
If the existing State has transitions set, the new State must be a valid transition.
If the existing State has no transitions set, no validations are performed when transitioning to the new State.state | ResourceIdentifier to a State. |
forceBoolean | Whether to skip validations when transitioning to the new State. Default:false |