Skip to content

paymentCancel

Mutationin Payment

Withdraw a payment the shopper abandoned in the provider's component, such as a closed PayPal sheet, and release its cart. Only a payment the provider has not taken money for can be withdrawn; one it already settled answers PAYMENT_IN_PROGRESS.

Arguments

ArgumentTypeDescription
targetPaymentTargetInput!The cart or order the payment was created against
paymentIdID!The payment PaymentSdkAction named

Returns

PaymentCancelResponse!

FieldTypeDescription
successBoolean!Whether the payment was withdrawn and its cart released
paymentErrors[PaymentCancelError!]Error details if the payment could not be withdrawn

Example

mutation PaymentCancel($target: PaymentTargetInput!, $paymentId: ID!) {
paymentCancel(target: $target, paymentId: $paymentId) {
success
paymentErrors {
__typename
... on PaymentError {
code
message
}
... on ValidationError {
message
}
}
}
}

The query selects the return type's fields two levels deep; pick the ones you need. The response shows its shape with placeholder values.

Served by

@evolve-framework/commercetoolsResolved
@evolve-framework/medusaNot resolved
@evolve-framework/sfccNot resolved

Used by

The storefront packages that send it, in these GraphQL documents: