Jump to content

Stripe InvalidRequest error: statement_descriptor_suffix can't be updated


Recommended Posts

We are currently testing WHMCS to see if it fits our needs, and encountering the below error consistently when a client pays by Stripe an invoice created in the admin area. It doesn't occur when the client creates the order themselves. I'm at a loss as to what I can do about this as it seems to be an issue internal to the module as opposed to something I've done.

The payment is still successful, and refreshing the page with the error brings up the order confirmation page. I haven't been able to see anything in the Gateway Log that seems related at all. We're using WHMCS 7.9.

 

Stripe\Error\InvalidRequest: This PaymentIntent's statement_descriptor_suffix could not be updated because it has a status of succeeded. You may only update the statement_descriptor_suffix of a PaymentIntent with one of the following statuses: requires_payment_method, requires_confirmation, requires_capture. in /var/www/html/whmcs/vendor/stripe/stripe-php/lib/ApiRequestor.php:210 from API request 'req_ibbukrAIVLkrq9'
Stack trace:
#0 /var/www/html/whmcs/vendor/stripe/stripe-php/lib/ApiRequestor.php(173): Stripe\ApiRequestor::_specificAPIError('{\n "error": {\n...', 400, Object(Stripe\Util\CaseInsensitiveArray), Array, Array)
#1 /var/www/html/whmcs/vendor/stripe/stripe-php/lib/ApiRequestor.php(473): Stripe\ApiRequestor->handleErrorResponse('{\n "error": {\n...', 400, Object(Stripe\Util\CaseInsensitiveArray), Array)
#2 /var/www/html/whmcs/vendor/stripe/stripe-php/lib/ApiRequestor.php(126): Stripe\ApiRequestor->_interpretResponse('{\n "error": {\n...', 400, Object(Stripe\Util\CaseInsensitiveArray))
#3 /var/www/html/whmcs/vendor/stripe/stripe-php/lib/ApiOperations/Request.php(57): Stripe\ApiRequestor->request('post', '/v1/payment_int...', Array, Array)
#4 /var/www/html/whmcs/vendor/stripe/stripe-php/lib/ApiOperations/Request.php(39): Stripe\ApiResource::_staticRequest('post', '/v1/payment_int...', Array, Object(Stripe\Util\RequestOptions))
#5 /var/www/html/whmcs/vendor/stripe/stripe-php/lib/ApiOperations/Update.php(41): Stripe\ApiResource->_request('post', '/v1/payment_int...', Array, NULL)
#6 /var/www/html/whmcs/modules/gateways/stripe.php(0): Stripe\PaymentIntent->save()
#7 /var/www/html/whmcs/vendor/whmcs/whmcs-foundation/lib/Module/AbstractModule.php(0): stripe_post_checkout(Array)
#8 /var/www/html/whmcs/vendor/whmcs/whmcs-foundation/lib/Module/Gateway.php(0): WHMCS\Module\AbstractModule->call('post_checkout', Array)
#9 /var/www/html/whmcs/cart.php(0): WHMCS\Module\Gateway->call('post_checkout', Array)
#10 {main}

Link to comment
Share on other sites

  • 4 weeks later...

I'd made a post previously here, but I've got a bit more information to add now.

When a client uses Stripe to pay an invoice which was created in the admin area, the below error message is output. This does not occur if the client creates the order themselves in the shopping cart.

Stripe\Error\InvalidRequest: This PaymentIntent's statement_descriptor_suffix could not be updated because it has a status of succeeded. You may only update the statement_descriptor_suffix of a PaymentIntent with one of the following statuses: requires_payment_method, requires_confirmation, requires_capture. in /var/www/html/whmcs/vendor/stripe/stripe-php/lib/ApiRequestor.php:210 from API request 'req_MbP2wl7zdEb2Ue'
Stack trace:
#0 /var/www/html/whmcs/vendor/stripe/stripe-php/lib/ApiRequestor.php(173): Stripe\ApiRequestor::_specificAPIError('{\n "error": {\n...', 400, Object(Stripe\Util\CaseInsensitiveArray), Array, Array)
#1 /var/www/html/whmcs/vendor/stripe/stripe-php/lib/ApiRequestor.php(473): Stripe\ApiRequestor->handleErrorResponse('{\n "error": {\n...', 400, Object(Stripe\Util\CaseInsensitiveArray), Array)
#2 /var/www/html/whmcs/vendor/stripe/stripe-php/lib/ApiRequestor.php(126): Stripe\ApiRequestor->_interpretResponse('{\n "error": {\n...', 400, Object(Stripe\Util\CaseInsensitiveArray))
#3 /var/www/html/whmcs/vendor/stripe/stripe-php/lib/ApiOperations/Request.php(57): Stripe\ApiRequestor->request('post', '/v1/payment_int...', Array, Array)
#4 /var/www/html/whmcs/vendor/stripe/stripe-php/lib/ApiOperations/Request.php(39): Stripe\ApiResource::_staticRequest('post', '/v1/payment_int...', Array, Object(Stripe\Util\RequestOptions))
#5 /var/www/html/whmcs/vendor/stripe/stripe-php/lib/ApiOperations/Update.php(41): Stripe\ApiResource->_request('post', '/v1/payment_int...', Array, NULL)
#6 /var/www/html/whmcs/modules/gateways/stripe.php(0): Stripe\PaymentIntent->save()
#7 /var/www/html/whmcs/vendor/whmcs/whmcs-foundation/lib/Module/AbstractModule.php(0): stripe_post_checkout(Array)
#8 /var/www/html/whmcs/vendor/whmcs/whmcs-foundation/lib/Module/Gateway.php(0): WHMCS\Module\AbstractModule->call('post_checkout', Array)
#9 /var/www/html/whmcs/cart.php(0): WHMCS\Module\Gateway->call('post_checkout', Array)
#10 {main}

From what I can see in the Stripe API logs, in these cases an extra API call is made after the payment capture is completed.

1074196327_Screenshotfrom2020-02-2015-14-10.thumb.png.2da051b0b3e774a7895353087fb940e8.png

This Post which causes the error has the following body:

{
  "description": "{Company Name} - Invoice #INV-159",
  "statement_descriptor_suffix": "{company} WHMCS Testing"
}

This post occurring doesn't seem to me to be something I have control over; am I wrong, or is it a bug with the gateway module? The payment still succeeds, and refreshing the page brings up the Order Confirmation screen. I had thought the error occurred consistently but it appears to happen about half the time in these circumstances.

I'll update this post if I figure out how to replicate the error consistently, but I'd appreciate any ideas in the meantime.

 

Link to comment
Share on other sites

Hi @WHMCS John, I've done the update as you requested, but am still getting an error some of the time, though the error itself is slightly different:

Stripe\Error\InvalidRequest: You cannot cancel this PaymentIntent because it has a status of succeeded. Only a PaymentIntent with one of the following statuses may be canceled: requires_payment_method, requires_capture, requires_confirmation, requires_action. in /var/www/html/whmcs/vendor/stripe/stripe-php/lib/ApiRequestor.php:210 from API request 'req_vJhmAKjx40Uyzs'
Stack trace:
#0 /var/www/html/whmcs/vendor/stripe/stripe-php/lib/ApiRequestor.php(173): Stripe\ApiRequestor::_specificAPIError('{\n "error": {\n...', 400, Object(Stripe\Util\CaseInsensitiveArray), Array, Array)
#1 /var/www/html/whmcs/vendor/stripe/stripe-php/lib/ApiRequestor.php(473): Stripe\ApiRequestor->handleErrorResponse('{\n "error": {\n...', 400, Object(Stripe\Util\CaseInsensitiveArray), Array)
#2 /var/www/html/whmcs/vendor/stripe/stripe-php/lib/ApiRequestor.php(126): Stripe\ApiRequestor->_interpretResponse('{\n "error": {\n...', 400, Object(Stripe\Util\CaseInsensitiveArray))
#3 /var/www/html/whmcs/vendor/stripe/stripe-php/lib/ApiOperations/Request.php(57): Stripe\ApiRequestor->request('post', '/v1/payment_int...', Array, Array)
#4 /var/www/html/whmcs/vendor/stripe/stripe-php/lib/ApiOperations/Request.php(39): Stripe\ApiResource::_staticRequest('post', '/v1/payment_int...', NULL, Object(Stripe\Util\RequestOptions))
#5 /var/www/html/whmcs/vendor/stripe/stripe-php/lib/PaymentIntent.php(74): Stripe\ApiResource->_request('post', '/v1/payment_int...', NULL, NULL)
#6 /var/www/html/whmcs/modules/gateways/stripe.php(0): Stripe\PaymentIntent->cancel()
#7 /var/www/html/whmcs/vendor/whmcs/whmcs-foundation/lib/Module/AbstractModule.php(0): stripe_post_checkout(Array)
#8 /var/www/html/whmcs/vendor/whmcs/whmcs-foundation/lib/Module/Gateway.php(0): WHMCS\Module\AbstractModule->call('post_checkout', Array)
#9 /var/www/html/whmcs/cart.php(0): WHMCS\Module\Gateway->call('post_checkout', Array)
#10 {main}

23176507_Screenshotfrom2020-02-2113-57-29.thumb.png.8d7a21a64ab7e085e678b331858df378.png

The error no longer occurs with the API call immediately following the capture (content of this has now changed to only

{
  "description": "{Company Name} - Invoice #INV-159",

but instead following that, a cancel request is made for the payment intent which was just created, which causes an error as the succeeded payment can't be cancelled (and I don't want it to be!)

Any ideas?

Link to comment
Share on other sites

  • WHMCS Support Manager

Hi @steph.hope,

If you click through to the cancel command in your Stripe account, can you let me know the cancellation_reason that is being sent please?

Do you have a custom template? If so, does the problem persist if you switch to the stock Six template and Standard Cart order form template?

 

I tried to reproduce the error on my stock 7.9.2 install but so far have been unable:

  • Created a new client
  • Created a custom invoice to a total of1.00
  • Logged in as the client
  • Navigated to the invoice
  • Clicked "Pay Now"
  • Entered valid card details
  • The payment was processed successfully and the  invoice marked paid.

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated