Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Make amount as non-required in order payment create API

Unknown6d39c7acc250
diff --git a/saleor/graphql/payment/mutations.py b/saleor/graphql/payment/mutations.py
index 36212089f7..193b45c537 100644
--- a/saleor/graphql/payment/mutations.py
+++ b/saleor/graphql/payment/mutations.py
@@ -28,7 +28,7 @@ class PaymentInput(graphene.InputObjectType):
'Client-side generated payment token, representing customer\'s '
'billing data in a secure manner.'))
amount = Decimal(
- required=True,
+ required=False,
description=(
'Total amount of the transaction, including '
'all taxes and discounts.'))
@@ -69,10 +69,10 @@ class CheckoutPaymentCreate(BaseMutation, I18nMixin):
'No billing address associated with this checkout.')
return CheckoutPaymentCreate(errors=errors)
- amount = input['amount']
checkout_total = checkout.get_total(
discounts=info.context.discounts,
taxes=get_taxes_for_address(checkout.billing_address))
+ amount = input.get('amount', checkout_total)
if amount < checkout_total.gross.amount:
cls.add_error(
errors, 'amount',
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 4807f63768..0669730418 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -1313,7 +1313,7 @@ type PaymentCountableEdge {
input PaymentInput {
gateway: GatewaysEnum!
token: String!
- amount: Decimal!
+ amount: Decimal
billingAddress: AddressInput
}