ovh/terraform-provider-ovh

[BUG] when creating a public cloud project, got 403 "This order can't be paid with 'bankAccount'" error

louisdussarps opened this issue · 6 comments

Describe the bug

When creating a new public cloud project via terraform, on some OVH accounts, we got the following behavior :

  • the order is well created
  • but the order is not paid and terraform fall in error
    Regarding the order creation process describe in https://github.com/ovh/order-cart-examples :
  • the checkout step is done
  • the payment is not done and generate an error

The problematic call is made from these lines in terraform :
https://github.com/ovh/terraform-provider-ovh/blob/dd08eda87f08d32e22358c026d6ea1ff5138c1fb/ovh/order.go#L352C1-L355C4

At the API level, the error come from the call to this route :
POST /me/order/{orderId}/pay
body : paymentMethod={id: paymentId}
(cf https://eu.api.ovh.com/console/#/me/order/%7BorderId%7D/pay~POST)

The output of this call is an error :
403 : {"message":"This order can't be paid with 'bankAccount'"}

Affected Resource(s)

  • ovh_cloud_project
    `

Expected Behavior

What should have happened?
The public cloud project should be created

Steps to Reproduce

just run the terraform example : https://registry.terraform.io/providers/ovh/ovh/latest/docs/resources/cloud_project

Note that it does not happen on every OVH account.

References

We discussed with the OVH support on this bug.
According to them, the POST /me/order/{orderId}/pay doesn't work for order of price 0.
Another payment route should be call, e.g. "validateZeroEasy" or "promotion"

Hello @louisdussarps , thanks for opening this issue.

It is possible that your payment method has not been registered as a SEPA_DIRECT_DEBIT payment method (even if it is one), depending on the moment that is was added to your account.
Could you try removing this payment method from your account and re-adding it (using Direct debit type) ?

Hello and thank you for the response.
The accounts in question belong to a client (our software operates as a Platform as a Service, so it's installed on the client's cloud account), thus I am not authorized to perform such a manipulation as modifying the payment method. However, your hypothesis appear to be accurate:

  • the payment method is SEPA
  • the accounts are "old" OVH accounts.

Is there a workaround for this?
Despite the explanation being clear, it's possible we'll encounter this scenario again on another client account.

OK I see, I don't have any easy workaround for this.
Could you provide us the ticket number that you had when contacting the support ? With this, we'll be able to escalate the issue to the right team so that they fix it.

Yes, the ticket number is : 9429967
Thanks for the reactivity.
One question, which is more for curiosity : why the terraform use /pay instead of /payWithRegisteredPaymentMean ? The web interface seems to use /payWithRegisteredPaymentMean and as a consequence, doesn't seem to have this problem.

Thanks, we'll look into it and come back to you.

For your question, /payWithRegisteredPaymentMean is a deprecated route that is replaced by /pay, that's why it is the one used in the provider. We're checking internally why they don't behave the same way ;)