Complete a checkout with Stripe as the payment method.
Checkout to be completed, instead it throws an error

System information
Operating system:
MacOS Cataline 10.15.5
Running Saleor with Docker
I'll be happy to submit a PR to resolve this if it is indeed a bug, what I did as a workaround was to modify the PaymentIntent creation arguments in saleor/payment/gateways/stripe/__init__.py to:
intent = client.PaymentIntent.create(
payment_method_data=dict(
type="card",
card=dict(
token=payment_information.token
)
),
...
)
This change allowed it to be accepted by Stripe.
Hi @thomasjiangcy,
Which version of Saleor are you using? I've just tested it with our storefront and everything works correctly. Please send exact mutation with input variables that cause the problem.
Hi I used the latest version of Saleor, and I'm experieincing the same issue version 2.10, I get the same error....
We're also experiencing this checkoutError on 2.10. It's happening after we call the checkoutComplete mutation with a valid checkoutId, which is being called after we await a call to checkoutPaymentCreate which contains a token that we've previously obtained from Stripe.
The specific error we're receiving is A token may not be passed in as a PaymentMethod. Instead, use payment_method_data with type=card and card[token]=<% our_valid_stripe_token_here %>.
Here's our checkoutPaymentCreate mutation:
export const CHECKOUT_PAYMENT_CREATE_MUTATION = gql`
mutation CHECKOUT_PAYMENT_CREATE_MUTATION(
$checkoutId: ID!
$gateway: String!
$token: String!
$amount: Decimal!
) {
checkoutPaymentCreate(
checkoutId: $checkoutId
input: { gateway: $gateway, token: $token, amount: $amount }
) {
payment {
id
chargeStatus
}
paymentErrors {
field
message
}
}
}
`;
@IKarbowiak I had a look through the release notes and didn't find mention of a fix for this. When you tested, on which version did you run your tests?
Most helpful comment
I'll be happy to submit a PR to resolve this if it is indeed a bug, what I did as a workaround was to modify the
PaymentIntentcreation arguments insaleor/payment/gateways/stripe/__init__.pyto:This change allowed it to be accepted by Stripe.