All Release Notes

Added GraphQL mutations for Payments and MyPayments

29 May 2020
Enhancement
GraphQLPayments

Payments and MyPayments can now be created, updated, and deleted using the GraphQL API.

  • [GraphQL API] Added the following types to the GraphQL schema: AddMyPaymentTransaction, AddPaymentInterfaceInteraction, AddPaymentTransaction, ChangePaymentAmountPlanned, ChangePaymentTransactionInteractionId, ChangePaymentTransactionState, ChangePaymentTransactionTimestamp, MyPayment, MyPaymentDraft, MyPaymentQueryResult, MyPaymentUpdateAction, MyTransactionDraft, PaymentDraft, PaymentMethodInfoInput, PaymentStatusInput, PaymentUpdateAction, SetPaymentAmountPaid, SetPaymentAmountRefunded, SetPaymentAnonymousId, SetPaymentAuthorization, SetPaymentCustomField, SetPaymentCustomType, SetPaymentCustomer, SetPaymentExternalId, SetPaymentInterfaceId, SetPaymentKey, SetPaymentMethodInfoInterface, SetPaymentMethodInfoMethod, SetPaymentMethodInfoName, SetPaymentStatusInterfaceCode, SetPaymentStatusInterfaceText, SetStoreSupplyChannels, TransactionDraft, TransitionPaymentState.
  • [GraphQL API] Changed the Me type:
    • Added the payments field to the Me type.
    • Added the payment field to the Me type.
  • [GraphQL API] Changed the StoreUpdateAction type:
    • Input field setSupplyChannels was added to StoreUpdateAction type
  • [GraphQL API] Changed the CreateStore type:
    • Input field supplyChannels was added to CreateStore type
  • [GraphQL API] Changed the Mutation type:
    • Added the createPayment field to the Mutation type.
    • Added the createMyPayment field to the Mutation type.
    • Added the updatePayment field to the Mutation type.
    • Added the updateMyPayment field to the Mutation type.
    • Added the deletePayment field to the Mutation type.
    • Added the deleteMyPayment field to the Mutation type.

Introduced the following changes to the GraphQL schema (in SDL format):

extend type Me {
payment(id: String!): MyPayment
payments(where: String, sort: [String!], limit: Int, offset: Int): MyPaymentQueryResult!
}
extend type Mutation {
createMyPayment(draft: MyPaymentDraft!): MyPayment
createPayment(draft: PaymentDraft!): Payment
deleteMyPayment(id: String!, version: Long!): MyPayment
deletePayment(version: Long!, personalDataErasure: Boolean = false,
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String): Payment
updateMyPayment(id: String!, version: Long!, actions: [MyPaymentUpdateAction!]!): MyPayment
updatePayment(version: Long!, actions: [PaymentUpdateAction!]!,
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String): Payment
}
input AddMyPaymentTransaction {
transaction: MyTransactionDraft!
}
input AddPaymentInterfaceInteraction {
fields: [CustomFieldInput!]
type: ResourceIdentifierInput
typeKey: String
typeId: String
}
input AddPaymentTransaction {
transaction: TransactionDraft!
}
input ChangePaymentAmountPlanned {
amount: MoneyInput!
}
input ChangePaymentTransactionInteractionId {
transactionId: String!
interactionId: String!
}
input ChangePaymentTransactionState {
transactionId: String!
state: TransactionState!
}
input ChangePaymentTransactionTimestamp {
transactionId: String!
timestamp: DateTime!
}
"""
My Payments endpoint provides access to payments scoped to a specific user.
[documentation](https://docs.commercetools.com/http-api-projects-me-payments#mypayment)
"""
type MyPayment {
id: String!
version: Long!
customerRef: Reference
customer: Customer
anonymousId: String
paymentMethodInfo: PaymentMethodInfo!
amountPlanned: Money!
transactions: [Transaction!]!
custom: CustomFieldsType
}
input MyPaymentDraft {
amountPlanned: MoneyInput!
paymentMethodInfo: PaymentMethodInfoInput
custom: CustomFieldsDraft
transaction: MyTransactionDraft
}
type MyPaymentQueryResult {
offset: Int!
count: Int!
total: Long!
results: [MyPayment!]!
}
input MyPaymentUpdateAction {
addTransaction: AddMyPaymentTransaction
changeAmountPlanned: ChangePaymentAmountPlanned
setCustomField: SetPaymentCustomField
setMethodInfoInterface: SetPaymentMethodInfoInterface
setMethodInfoMethod: SetPaymentMethodInfoMethod
setMethodInfoName: SetPaymentMethodInfoName
}
input MyTransactionDraft {
timestamp: DateTime
type: TransactionType!
amount: MoneyInput!
interactionId: String
}
input PaymentDraft {
amountPlanned: MoneyInput!
paymentMethodInfo: PaymentMethodInfoInput
custom: CustomFieldsDraft
key: String
customer: ResourceIdentifierInput
anonymousId: String
interfaceId: String
paymentStatus: PaymentStatusInput
transactions: [TransactionDraft!]
interfaceInteractions: [CustomFieldsDraft!]
}
input PaymentMethodInfoInput {
paymentInterface: String
method: String
name: [LocalizedStringItemInputType!]
}
input PaymentStatusInput {
interfaceCode: String
interfaceText: String
state: ReferenceInput
}
input PaymentUpdateAction {
addInterfaceInteraction: AddPaymentInterfaceInteraction
addTransaction: AddPaymentTransaction
changeAmountPlanned: ChangePaymentAmountPlanned
changeTransactionInteractionId: ChangePaymentTransactionInteractionId
changeTransactionState: ChangePaymentTransactionState
changeTransactionTimestamp: ChangePaymentTransactionTimestamp
setAmountPaid: SetPaymentAmountPaid
setAmountRefunded: SetPaymentAmountRefunded
setAnonymousId: SetPaymentAnonymousId
setAuthorization: SetPaymentAuthorization
setCustomField: SetPaymentCustomField
setCustomType: SetPaymentCustomType
setCustomer: SetPaymentCustomer
setExternalId: SetPaymentExternalId
setInterfaceId: SetPaymentInterfaceId
setKey: SetPaymentKey
setMethodInfoInterface: SetPaymentMethodInfoInterface
setMethodInfoMethod: SetPaymentMethodInfoMethod
setMethodInfoName: SetPaymentMethodInfoName
setStatusInterfaceCode: SetPaymentStatusInterfaceCode
setStatusInterfaceText: SetPaymentStatusInterfaceText
transitionState: TransitionPaymentState
}
input SetPaymentAmountPaid {
amount: MoneyInput
}
input SetPaymentAmountRefunded {
amount: MoneyInput
}
input SetPaymentAnonymousId {
anonymousId: String
}
input SetPaymentAuthorization {
amount: MoneyInput
until: DateTime
}
input SetPaymentCustomField {
name: String!
value: String
}
input SetPaymentCustomType {
fields: [CustomFieldInput!]
type: ResourceIdentifierInput
typeKey: String
typeId: String
}
input SetPaymentCustomer {
customer: ReferenceInput
}
input SetPaymentExternalId {
externalId: String
}
input SetPaymentInterfaceId {
interfaceId: String
}
input SetPaymentKey {
key: String
}
input SetPaymentMethodInfoInterface {
interface: String!
}
input SetPaymentMethodInfoMethod {
method: String
}
input SetPaymentMethodInfoName {
name: [LocalizedStringItemInputType!]
}
input SetPaymentStatusInterfaceCode {
interfaceCode: String
}
input SetPaymentStatusInterfaceText {
interfaceText: String
}
input SetStoreSupplyChannels {
supplyChannels: [ResourceIdentifierInput!]
}
input TransactionDraft {
timestamp: DateTime
type: TransactionType!
amount: MoneyInput!
interactionId: String
state: TransactionState
}
input TransitionPaymentState {
state: ResourceIdentifierInput!
force: Boolean = false
}
Developer Center
HTTP APIGraphQL APIBETAPlatform Release NotesCustom ApplicationsBETASDKs & Client LibrariesImport & ExportSUNRISE Starter FrontendsTutorialsFAQ
Sign upLog inTech BlogIntegrationsStatusSupportUser Research Program
Copyright © 2021 commercetools