29 May 2020
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 
Metype:- Added the 
paymentsfield to theMetype. - Added the 
paymentfield to theMetype. 
 - Added the 
 - [GraphQL API] Changed the 
StoreUpdateActiontype:- Input field 
setSupplyChannelswas added toStoreUpdateActiontype 
 - Input field 
 - [GraphQL API] Changed the 
CreateStoretype:- Input field 
supplyChannelswas added toCreateStoretype 
 - Input field 
 - [GraphQL API] Changed the 
Mutationtype:- Added the 
createPaymentfield to theMutationtype. - Added the 
createMyPaymentfield to theMutationtype. - Added the 
updatePaymentfield to theMutationtype. - Added the 
updateMyPaymentfield to theMutationtype. - Added the 
deletePaymentfield to theMutationtype. - Added the 
deleteMyPaymentfield to theMutationtype. 
 - Added the 
 
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
}