Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When hitting the api I get a Unsupported Payment error on confirm stage; Get request on order shows payment info w/ last four #278

Open
quesurifn opened this issue Jun 9, 2017 · 0 comments

Comments

@quesurifn
Copy link

When I use authorize.net live, with the api it
{ error: 'The order could not be transitioned. Please fix the errors and try again.',
errors: { base: [ 'That payment method is unsupported. Please choose another one.' ] } }
on confirm stage.

We are using authorize.net..

When I do a get request on the order number, cc_type is missing but last 4, exp and name are all listed as a payment source.

Context

I am trying to follow this guide: http://guides.spreecommerce.org/api/checkouts.html
with the exception of step one passing in JSON to add items to cart and step two hits the endpoint /api/v1/orders/:number.json?order_token=###&order[email]=email@address.com

Step three starts at the delivery step.

When adding a payment method we use

{
  "order": {
    "payments_attributes": [
      {
        "payment_method_id": "1"
      }
    ]
  },
  "payment_source": {
    "1": {
      "number": "4111111111111111",
      "month": "1",
      "year": "2017",
      "verification_value": "123",
      "name": "John Smith"
    }
  }
}

If the payment gateway ID we use is 4 it looks like this:


{
  "order": {
    "payments_attributes": [
      {
        "payment_method_id": "4"
      }
    ]
  },
  "payment_source": {
    "4": {
      "number": "4111111111111111",
      "month": "1",
      "year": "2017",
      "verification_value": "123",
      "name": "John Smith"
    }
  }
}

Payment methods 1, 2 and 3 do not exist in the table

Expected Behavior

{
...
"state": "confirm",
...
"payments": [
Status:200

{
    "id": 3,
    "source_type": "Spree::CreditCard",
    "source_id": 2,
    "amount": "65.37",
    "display_amount": "$65.37",
    "payment_method_id": 1,
    "response_code": null,
    "state": "checkout",
    "avs_response": null,
    "created_at": "2014-07-06T19:55:08.308Z",
    "updated_at": "2014-07-06T19:55:08.308Z",
    "payment_method": {
      "id": 1,
      "name": "Credit Card"
    },
    "source": {
      "id": 2,
      "month": "1",
      "year": "2017",
      "cc_type": null,
      "last_digits": "1111",
      "name": "John Smith"
    }
  }
],

Actual Behavior

errors: { base: [ 'That payment method is unsupported. Please choose another one.' ] } }

Possible Fix

N/A

Steps to Reproduce

Spin up spree server on either 3.1 OR 3.2,
Curl the api as this script does:
https://pastebin.com/n759FHN6

very much like

http://guides.spreecommerce.org/api/checkouts.html

Your Environment

MACOSX Sierra
Chrome
Rails: 5.0.1
Spree: 3.2.0 && 3.1.0
GEM:Link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant